Skip to content

fix(api): ajout de ressources et d'un replica sur le backend #9752

fix(api): ajout de ressources et d'un replica sur le backend

fix(api): ajout de ressources et d'un replica sur le backend #9752

Workflow file for this run

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@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Node.js v16.19
uses: actions/setup-node@v3
with:
node-version: "16.19"
- 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 workspace @domifa/backend install --frozen-lockfile --prefer-offline
- name: Create Postgres service
run: docker-compose -f ./docker-compose.tests.yml up --build --detach
- name: Create file for upload files
run: mkdir /tmp/files/
- 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@v3
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@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Node.js v16.19
uses: actions/setup-node@v3
with:
node-version: "16.19"
- 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 workspace @domifa/frontend install --frozen-lockfile --prefer-offline
- name: Run front-end tests
run: yarn workspace @domifa/frontend test --coverage --detectOpenHandles --forceExit
- name: Archive code coverage
uses: actions/upload-artifact@v3
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@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Node.js v16.19
uses: actions/setup-node@v3
with:
node-version: "16.19"
- name: Set up Yarn cache
uses: c-hive/gha-yarn-cache@v2
- name: Install dependencies
run: yarn workspace @domifa/portail-usagers install --frozen-lockfile --prefer-offline
- name: Run front-end tests
run: yarn workspace @domifa/portail-usagers test --coverage --detectOpenHandles --forceExit
- name: Archive code coverage
uses: actions/upload-artifact@v3
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@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Set up Node.js v16.19
uses: actions/setup-node@v3
with:
node-version: "16.19"
- name: Set up Yarn cache
uses: c-hive/gha-yarn-cache@v2
- name: Install dependencies
run: yarn workspace @domifa/portail-admins install --frozen-lockfile --prefer-offline
- name: Run front-end tests
run: yarn workspace @domifa/portail-admins test --coverage --detectOpenHandles --forceExit
- name: Archive code coverage
uses: actions/upload-artifact@v3
with:
name: portail-admins-coverage
path: packages/portail-admins/coverage
codecov:
name: Publish code coverage
runs-on: ubuntu-22.04
needs: [backend, frontend, portail-usagers, portail-admins]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Download backend coverage
uses: actions/download-artifact@v3
with:
name: backend-coverage
path: packages/backend/coverage
- name: Download front-end coverage
uses: actions/download-artifact@v3
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@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
directory: packages/backend/coverage
- name: Publish front-end code coverage
uses: codecov/codecov-action@v3
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