Skip to content

Commit

Permalink
fix:ci testing
Browse files Browse the repository at this point in the history
  • Loading branch information
George-Spanos committed Feb 23, 2024
1 parent cf06009 commit e67cd65
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/web-api-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
JWT_SECRET: SOMEJWTSECRET
steps:
- uses: actions/checkout@v3
- run: touch .npmrc && echo ${{ secrets.NPMRC }} > .npmrc
working-directory: src/web-api
- name: Test api
working-directory: ./src/web-api
run: |
npm run build:test -- --secret id=npmrc,src=${{ secrets.NPMRC }} && npm run docker:test
npm run docker:test
build:
runs-on: "ubuntu-latest"
needs: test
Expand All @@ -43,4 +45,4 @@ jobs:
tags: ${{ secrets.REPOSITORY_NAME }}/ppo-api:latest
context: ./src/web-api
secrets: |
npmrc=${{ secrets.NPMRC }}
npmrc=${{ secrets.NPMRC }}
3 changes: 1 addition & 2 deletions src/web-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM node:18.13.0-alpine as dependencies
FROM node:20.11.0-alpine as dependencies
WORKDIR /src
ARG NPM_TOKEN
COPY package*.json ./
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci -f

Expand Down
4 changes: 2 additions & 2 deletions src/web-api/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
api:
web-api:
ports:
- 3000:3000
build:
Expand Down Expand Up @@ -38,4 +38,4 @@ services:
- '5432:5432'
secrets:
npmrc:
external: true
file: ./.npmrc
11 changes: 8 additions & 3 deletions src/web-api/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
services:
api:
container_name: api
web-api:
ports:
- 3000:3000
build:
dockerfile: Dockerfile
secrets:
- npmrc
env_file:
- docker.env
depends_on:
Expand All @@ -15,6 +15,8 @@ services:
calc-odds-api:
build:
context: ../calc-odds-api
secrets:
- npmrc
environment:
- ITERATIONS=30000
ports:
Expand All @@ -35,3 +37,6 @@ services:
- '5432:5432'
volumes:
- ./postgres-data:/var/lib/postgresql/data
secrets:
npmrc:
file: .npmrc
3 changes: 1 addition & 2 deletions src/web-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"dev": "nodemon ./src/app.ts",
"start": "node ./dist/app.js",
"test": "prisma migrate deploy && jest -i",
"build:test":"docker compose -f docker-compose.test.yml build",
"docker:test": "docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from api",
"docker:test": "docker compose -f docker-compose.test.yml up --build --abort-on-container-exit --exit-code-from web-api",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --fix --ext .ts"
},
Expand Down

0 comments on commit e67cd65

Please sign in to comment.