Skip to content

Commit

Permalink
ci: adjust docker images, compose and actions to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flpms committed Jul 3, 2024
1 parent 97ed36e commit 71dddc4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
MONGO_INITDB_DATABASE: ${{vars.MONGO_INITDB_DATABASE}}
- name: Build
run: docker build . -t simple-connection
- run: docker-compose up -d
unit-test:
runs-on: ubuntu-20.04
strategy:
Expand All @@ -30,7 +29,7 @@ jobs:
- name: npm CI
run: npm ci
- name: Running Unit Test
run: npm test
run: npm run test:coverage
test-integration:
runs-on: ubuntu-20.04
needs: build
Expand Down
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
FROM node:18-alpine
FROM node:20-alpine
WORKDIR /usr/src/app

COPY package*.json ./

RUN npm ci

COPY src ./src
COPY tests ./tests

CMD ["npm", "run", "test:coverage"]
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
services:
run-tests:
build:
context: .
dockerfile: Dockerfile
mongodb7:
image: mongo:7.0.9-jammy
ports:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"build": "tsup",
"test": "npm run test:coverage && npm run test:integration",
"test:unit": "node --import tsx --test ./tests/unit/*.test.ts --test-reporter spec",
"test:unit": "node --import tsx --test ./tests/unit/*.test.ts",
"test:integration": "node --import tsx --test ./tests/integration/*.spec.ts",
"test:coverage": "c8 npm run test:unit"
},
Expand Down

0 comments on commit 71dddc4

Please sign in to comment.