Feat edit document #13036
Workflow file for this run
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: Unit Tests | |
on: | |
push: | |
branches: [master, alpha, beta, next] | |
pull_request: | |
concurrency: | |
cancel-in-progress: true | |
group: unit-tests-${{ github.ref }} | |
jobs: | |
backend: | |
name: Backend unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Set up Node.js vlts | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Change TimeZone | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Europe/Paris" | |
- name: Set up Yarn cache | |
uses: c-hive/gha-yarn-cache@v2 | |
- name: Create backend .env file | |
run: cp ./packages/backend/.env.backend.test.local.example.env ./packages/backend/.env | |
- name: Install backend dependencies | |
run: yarn workspaces focus @domifa/backend | |
- name: Build common dependencies | |
run: yarn workspace @domifa/common build | |
- name: Create Postgres service | |
run: docker compose -f ./docker-compose.tests.yml up --build --detach | |
- name: Run backend tests | |
# run: yarn workspace @domifa/backend jest --coverage --detectOpenHandles --forceExit --runInBand | |
run: DISABLE_TYPEORM_CLOSE=1 yarn workspace @domifa/backend jest --coverage --detectOpenHandles --forceExit --runInBand | |
- name: Archive code coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: backend-coverage | |
path: packages/backend/coverage | |
frontend: | |
name: Front-end unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Set up Node.js lts | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Change TimeZone | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Europe/Paris" | |
- name: Set up Yarn cache | |
uses: c-hive/gha-yarn-cache@v2 | |
- name: Install front-end dependencies | |
run: yarn workspaces focus @domifa/frontend | |
- name: Build common dependencies | |
run: yarn workspace @domifa/common build | |
- name: Run front-end tests | |
run: yarn workspace @domifa/frontend test --coverage --detectOpenHandles --forceExit | |
- name: Archive code coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frontend-coverage | |
path: packages/frontend/coverage | |
portail-usagers: | |
name: Portail Usagers unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Set up Node.js lts | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Set up Yarn cache | |
uses: c-hive/gha-yarn-cache@v2 | |
- name: Install dependencies | |
run: yarn workspaces focus @domifa/portail-usagers | |
- name: Build common dependencies | |
run: yarn workspace @domifa/common build | |
- name: Run "Mon DomiFa" tests | |
run: yarn workspace @domifa/portail-usagers test --coverage --detectOpenHandles --forceExit | |
- name: Archive code coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: portail-usagers-coverage | |
path: packages/portail-usagers/coverage | |
portail-admins: | |
name: Portail Admins unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Set up Node.js vlts | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Change TimeZone | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Europe/Paris" | |
- name: Set up Yarn cache | |
uses: c-hive/gha-yarn-cache@v2 | |
- name: Install dependencies | |
run: yarn workspaces focus @domifa/portail-admins | |
- name: Build common dependencies | |
run: yarn workspace @domifa/common build | |
- name: Run "Portail Admin" tests | |
run: yarn workspace @domifa/portail-admins test --coverage --detectOpenHandles --forceExit | |
- name: Archive code coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: portail-admins-coverage | |
path: packages/portail-admins/coverage | |
anonymization: | |
name: Anonymization quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Set up Node.js lts | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Set up Yarn cache | |
uses: c-hive/gha-yarn-cache@v2 | |
- name: Install dependencies | |
working-directory: ./.anonymizer | |
run: yarn | |
- name: Lint | |
working-directory: ./.anonymizer | |
run: yarn lint | |
- name: Build | |
working-directory: ./.anonymizer | |
run: yarn build | |
codecov: | |
name: Publish code coverage | |
runs-on: ubuntu-22.04 | |
needs: [backend, frontend, portail-usagers, portail-admins] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Download backend coverage | |
uses: actions/download-artifact@v4 | |
with: | |
name: backend-coverage | |
path: packages/backend/coverage | |
- name: Download front-end coverage | |
uses: actions/download-artifact@v4 | |
with: | |
name: frontend-coverage | |
path: packages/frontend/coverage | |
# - name: Download portail-usagers coverage | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: portail-usagers | |
# path: packages/portail-usagers/coverage | |
- name: Publish backend code coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: packages/backend/coverage | |
- name: Publish front-end code coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: packages/frontend/coverage | |
# - name: Publish portail-usagers code coverage | |
# uses: codecov/codecov-action@v2 | |
# with: | |
# fail_ci_if_error: true | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# directory: packages/portail-usagers/coverage |