|
| 1 | +# This workflow will do a clean installation 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 | + |
| 4 | +name: Node.js CI |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [main] |
| 9 | + pull_request: |
| 10 | + branches: [main] |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + node-version: [18.x, 20.x, 21.x, 22.x, 23.x] |
| 19 | + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ |
| 20 | + |
| 21 | + services: |
| 22 | + rabbitmq: |
| 23 | + image: rabbitmq:4.1.0-management |
| 24 | + options: --hostname test-node --name test-node |
| 25 | + env: |
| 26 | + RABBITMQ_HOSTNAME: "test-node" |
| 27 | + RABBITMQ_DEFAULT_USER: "test-user" |
| 28 | + RABBITMQ_DEFAULT_PASS: "test-password" |
| 29 | + volumes: |
| 30 | + # these directories will be empty until checkout, but they will be |
| 31 | + # populated by the time we restart the service |
| 32 | + - ${{ github.workspace }}/conf:/etc/rabbitmq |
| 33 | + ports: |
| 34 | + - 5672:5672 |
| 35 | + - 15672:15672 |
| 36 | + |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + - name: Use Node.js ${{ matrix.node-version }} |
| 40 | + uses: actions/setup-node@v3 |
| 41 | + with: |
| 42 | + node-version: ${{ matrix.node-version }} |
| 43 | + cache: "npm" |
| 44 | + # - name: Generate certificates |
| 45 | + # env: |
| 46 | + # CN: test-node |
| 47 | + # run: | |
| 48 | + # git clone https://github.com/rabbitmq/tls-gen tls-gen |
| 49 | + # cd tls-gen/basic |
| 50 | + # make |
| 51 | + # cd ../.. |
| 52 | + # cp -a tls-gen/basic/result certs/ |
| 53 | + # sudo chown -R 999:999 certs |
| 54 | + # sudo mv certs/server_test-node_certificate.pem certs/server_rabbitmq_certificate.pem |
| 55 | + # sudo mv certs/server_test-node_key.pem certs/server_rabbitmq_key.pem |
| 56 | + - name: Restart RabbitMQ |
| 57 | + run: | |
| 58 | + docker restart test-node |
| 59 | + sleep 2 |
| 60 | + docker exec test-node rabbitmqctl await_startup |
| 61 | + - run: npm ci |
| 62 | + - run: npm run check |
| 63 | + - run: npm run build --if-present |
| 64 | + - run: | |
| 65 | + docker exec test-node rabbitmqctl add_user 'O=client,CN=test-node' '' |
| 66 | + docker exec test-node rabbitmqctl clear_password 'O=client,CN=test-node' |
| 67 | + docker exec test-node rabbitmqctl set_permissions 'O=client,CN=test-node' '.*' '.*' '.*' |
| 68 | + - run: npm test |
| 69 | + env: |
| 70 | + RABBITMQ_USER: "test-user" |
| 71 | + RABBITMQ_PASSWORD: "test-password" |
| 72 | + # - run: cd example && npm install && npm start |
| 73 | + # env: |
| 74 | + # RABBITMQ_USER: "test-user" |
| 75 | + # RABBITMQ_PASSWORD: "test-password" |
| 76 | + # - run: cd performance_test && npm install && npm run perftest 100000 |
| 77 | + # env: |
| 78 | + # RABBITMQ_USER: "test-user" |
| 79 | + # RABBITMQ_PASSWORD: "test-password" |
0 commit comments