Skip to content

Commit

Permalink
#26 use compose to test
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcellino-Palerme committed Dec 27, 2023
1 parent 27b6f9b commit c1596e0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/test_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,8 @@ jobs:
steps:
- name: Get repo
uses: actions/checkout@v3
- name: add client
run: |
sudo apt-get update -y
sudo apt-get install --yes postgresql-client
- name: check psql
run: psql --help
- name: Configure Database
run: |
psql -tc "CREATE TABLE proj(id SERIAL PRIMARY KEY);"
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: latest
cache: 'npm'
- name: Installation project s packages
run: npm ci
- name: Test in container with compose
run: docker compose -f "compose.test.yaml" up -d --build
- name: Test & coverage
run: npm run coverage
- name: Report coverage
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:latest
WORKDIR /EP2M2
COPY . .
EXPOSE 3000
RUN mkdir /results
ENV EP2M2_DIR_SHARE=/shareFile
ENV EP2M2_DIR_RESULT=/results
ENV PGHOST=db
CMD ["npm", "run", "test"]
33 changes: 33 additions & 0 deletions compose.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
web:
build: .Dockerfile.test
ports:
- "80:3000"
volumes:
- shareFile:/shareFile
- ./test:/EP2M2/test
env_file:
- ./secrets/pg.env


api:
image: inraep2m2/service-p2m2tools-api:latest
container_name: p2m2ToolsApi
volumes:
- shareFile:/shareFile

db:
image: postgres:latest
container_name: db
volumes:
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
env_file:
- ./secrets/pg.env

volumes:
shareFile:





0 comments on commit c1596e0

Please sign in to comment.