|
| 1 | +name: CI - LavinMQ |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + node-version: [20.x, 22.x, 23.x, 24.x] |
| 17 | + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Install LavinMQ |
| 21 | + uses: cloudamqp/lavinmq-action@v1 |
| 22 | + - name: Set up Homebrew |
| 23 | + uses: Homebrew/actions/setup-homebrew@master |
| 24 | + - name: Install github.com/FiloSottile/mkcert |
| 25 | + run: brew install mkcert |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - name: Create local CA and certificate |
| 28 | + run: | |
| 29 | + sudo CAROOT=/etc/lavinmq $(brew --prefix)/bin/mkcert -install |
| 30 | + sudo $(brew --prefix)/bin/mkcert -key-file /etc/lavinmq/localhost-key.pem -cert-file /etc/lavinmq/localhost.pem localhost |
| 31 | + sudo chmod +r /etc/lavinmq/localhost-key.pem |
| 32 | + - name: Configure LavinMQ for TLS |
| 33 | + run: | |
| 34 | + sudo tee /etc/lavinmq/lavinmq.ini <<'EOF' |
| 35 | + [main] |
| 36 | + data_dir = /var/lib/lavinmq |
| 37 | +
|
| 38 | + tls_cert = /etc/lavinmq/localhost.pem |
| 39 | + tls_key = /etc/lavinmq/localhost-key.pem |
| 40 | +
|
| 41 | + [amqp] |
| 42 | + tls_port = 5671 |
| 43 | + EOF |
| 44 | + sudo systemctl restart lavinmq |
| 45 | + - name: Use Node.js ${{ matrix.node-version }} |
| 46 | + uses: actions/setup-node@v6 |
| 47 | + with: |
| 48 | + node-version: ${{ matrix.node-version }} |
| 49 | + - run: npm install |
| 50 | + env: |
| 51 | + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 |
| 52 | + - run: npm test |
| 53 | + env: |
| 54 | + AMQPS_URL: amqps://localhost?insecure |
| 55 | + |
| 56 | + test-browser: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + env: |
| 59 | + NODE_VERSION: 22.x |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Install LavinMQ |
| 63 | + uses: cloudamqp/lavinmq-action@v1 |
| 64 | + - name: Bind LavinMQ to IPv4 (workaround for cloudamqp/lavinmq#1838) |
| 65 | + run: | |
| 66 | + sudo sed -i 's/bind = ::/bind = 127.0.0.1/' /etc/lavinmq/lavinmq.ini |
| 67 | + sudo systemctl restart lavinmq |
| 68 | + - uses: actions/checkout@v6 |
| 69 | + - name: Use Node.js ${{ env.NODE_VERSION }} |
| 70 | + uses: actions/setup-node@v6 |
| 71 | + with: |
| 72 | + node-version: ${{ env.NODE_VERSION }} |
| 73 | + - run: npm install |
| 74 | + env: |
| 75 | + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 |
| 76 | + - run: npx playwright install --with-deps chromium |
| 77 | + - run: npm run test-browser -- run --browser.headless |
| 78 | + env: |
| 79 | + VITE_WS_URL: ws://127.0.0.1:15672/ |
0 commit comments