ci: ✅ add backend tests in ci #276
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-backend: | |
name: Build Backend | |
uses: ./.github/workflows/build.yml | |
with: | |
image: ghcr.io/dnum-mi/referentiel-applications/backend | |
context: ./backend | |
build-frontend: | |
name: Build Frontend | |
uses: ./.github/workflows/build.yml | |
with: | |
image: ghcr.io/dnum-mi/referentiel-applications/frontend | |
context: ./frontend | |
test-format: | |
name: Test Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run Prettier check | |
run: | | |
npm ci | |
npm run format-check | |
test-backend: | |
name: Test Backend | |
needs: build-backend | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Start stack using docker compose | |
run: IMAGE_TAG=${{ needs.build-backend.outputs.image_tag }} docker compose -f docker-compose.yml -f docker-compose.ci.yml up backend postgres -d | |
- run: docker compose exec backend pnpm run test:cov | |
- name: Setup LCOV | |
uses: hrishikesh-kadam/setup-lcov@v1 | |
- name: Jest Coverage Comment | |
uses: MishaKav/jest-coverage-comment@main | |
with: | |
working-directory: ./backend | |
coverage-summary-path: ./coverage/coverage-final.json |