test.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
  2. # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
  3. name: Node.js CI
  4. on:
  5. push:
  6. branches: [main]
  7. pull_request:
  8. branches: [main]
  9. jobs:
  10. build:
  11. runs-on: ubuntu-latest
  12. services:
  13. rabbitmq:
  14. image: rabbitmq:3.12-alpine
  15. ports:
  16. - 5672:5672
  17. strategy:
  18. matrix:
  19. node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
  20. # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
  21. steps:
  22. - uses: actions/checkout@v2
  23. - name: Use Node.js ${{ matrix.node-version }}
  24. uses: actions/setup-node@v2
  25. with:
  26. node-version: ${{ matrix.node-version }}
  27. cache: "npm"
  28. # Install all prerequisites
  29. - run: npm ci
  30. # Ensure RabbitMQ is available before continuing
  31. - run: |
  32. n=0
  33. while :
  34. do
  35. sleep 5
  36. echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
  37. [[ $? = 0 ]] && break || ((n++))
  38. (( n >= 5 )) && break
  39. done
  40. - run: echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
  41. # Run the tests
  42. - run: make test