Skip to content

Commit 25a33b2

Browse files
committed
CI: Run RabbitMQ in the VM, with TLS
Tests started to fail when the free CloudAMQP account that the tests used elapsed. This should be more stable.
1 parent de29a0b commit 25a33b2

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,39 @@ on:
99
jobs:
1010
test:
1111
runs-on: ubuntu-latest
12-
services:
13-
rabbitmq:
14-
image: rabbitmq:latest
15-
ports:
16-
- 5672:5672/tcp
17-
# needed because the rabbitmq container does not provide a healthcheck
18-
options: >-
19-
--health-cmd "rabbitmqctl node_health_check"
20-
--health-interval 10s
21-
--health-timeout 5s
22-
--health-retries 5
23-
2412
strategy:
2513
fail-fast: false
2614
matrix:
2715
node-version: [12.x, 14.x, 16.x, 17.x]
2816
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2917

3018
steps:
19+
- name: Install RabbitMQ
20+
run: sudo apt-get update && sudo apt-get install -y rabbitmq-server
21+
- name: Stop RabbitMQ
22+
run: sudo systemctl stop rabbitmq-server
23+
24+
- name: Install github.com/FiloSottile/mkcert
25+
run: brew install mkcert
26+
- name: Create local CA
27+
run: sudo CAROOT=/etc/rabbitmq $(brew --prefix)/bin/mkcert -install
28+
- name: Create certificate
29+
run: |
30+
sudo $(brew --prefix)/bin/mkcert -key-file /etc/rabbitmq/localhost-key.pem -cert-file /etc/rabbitmq/localhost.pem localhost
31+
sudo chmod +r /etc/rabbitmq/localhost-key.pem
32+
- name: Create RabbitMQ config
33+
run: |
34+
sudo tee /etc/rabbitmq/rabbitmq.conf <<'EOF'
35+
listeners.ssl.default = 5671
36+
ssl_options.cacertfile = /etc/rabbitmq/rootCA.pem
37+
ssl_options.certfile = /etc/rabbitmq/localhost.pem
38+
ssl_options.keyfile = /etc/rabbitmq/localhost-key.pem
39+
EOF
40+
- name: Start RabbitMQ
41+
run: sudo systemctl start rabbitmq-server
42+
- name: Verify RabbitMQ started correctly
43+
run: while true; do sudo rabbitmq-diagnostics status 2>/dev/null && break; echo -n .; sleep 2; done
44+
3145
- uses: actions/checkout@v2
3246
- name: Use Node.js ${{ matrix.node-version }}
3347
uses: actions/setup-node@v2
@@ -36,5 +50,5 @@ jobs:
3650
- run: npm install
3751
- run: npm test
3852
env:
39-
AMQPS_URL: ${{ secrets.AMQP_URL }}
53+
AMQPS_URL: amqps://localhost
4054
- run: npm run lint

0 commit comments

Comments
 (0)