Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run tests

on:
push:

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
node-version: [20.x, 22.x, 24.x]
rabbit-version: [3.12.5, 4.2.1]

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}

- name: Start services
run: docker compose up -d --wait
env:
RABBITMQ_VERSION: ${{ matrix.rabbit-version }}

- name: Run tests
run: |
npm install
npm test

- name: Stop services
if: always()
run: docker compose down -v

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules
coverage
typings
js
.*
.nyc_output
24 changes: 11 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
version: '2.2'
services:
rabbit-queue:
image: node:14
working_dir: /code
volumes:
- .:/code
links:
- rabbit
environment:
RABBIT_URL: 'amqp://rabbit'
rabbit:
image: rabbitmq
rabbitmq:
image: rabbitmq:${RABBITMQ_VERSION:-4.1.2}-management
container_name: rabbitmq
ports:
- '5672:5672'
- 5672:5672
- 15672:15672
healthcheck:
test: rabbitmq-diagnostics -q ping
timeout: 10s
interval: 5s
retries: 5

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"prepublishOnly": "npm run build && npm run test-docker",
"pretest": "tslint --project ./ts/ && tslint ./test/**/*.ts && npm run build",
"test": "nyc mocha",
"test-docker": "docker-compose run rabbit-queue npm run test",
"prepare": "npm run build"
"deps:up": "docker compose up -d --wait",
"deps:down": "docker compose down"
},
"lint-staged": {
"*.{ts,js}": [
Expand Down