Merge pull request #1039 from MTES-MCT/chore-add-coverage #18
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 | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- e2e/** | |
- frontend/** | |
- queue/** | |
- server/** | |
- packages/** | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
services: | |
postgres: | |
image: postgis/postgis | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: zlv | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:7.2.4-alpine | |
ports: | |
- 6379:6379 | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
s3: | |
image: adobe/s3mock:3.5.2 | |
ports: | |
- 9090:9090 | |
env: | |
initialBuckets: "zerologementvacant" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: yarn | |
- name: Install | |
run: yarn install --immutable | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true | |
- name: Build | |
run: yarn build | |
env: | |
DISABLE_ESLINT_PLUGIN: true | |
METABASE_TOKEN: token | |
- name: Lint | |
run: yarn lint | |
- name: Test | |
run: yarn coverage --parallel | |
env: | |
LOG_LEVEL: fatal | |
REACT_APP_API_URL: http://localhost:3001 | |
- name: Upload frontend coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
disable_search: true | |
files: ./frontend/coverage/coverage-final.json | |
flags: frontend | |
- name: Upload packages coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: packages | |
flags: packages | |
- name: Upload packages coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
disable_search: true | |
files: ./server/coverage/coverage-final.json | |
flags: server | |
- name: Test database migrations | |
run: yarn workspace @zerologementvacant/server run test:migrations --run-in-band | |
deploy-front-staging: | |
uses: ./.github/workflows/deploy.yml | |
needs: [build] | |
with: | |
app: Front staging | |
alias: front-staging | |
branch: main | |
environment: Staging | |
secrets: inherit | |
deploy-api-staging: | |
uses: ./.github/workflows/deploy.yml | |
needs: [build] | |
with: | |
app: API staging | |
alias: api-staging | |
branch: main | |
secrets: inherit | |
deploy-queue-staging: | |
uses: ./.github/workflows/deploy.yml | |
needs: [build] | |
with: | |
app: Queue staging | |
alias: queue-staging | |
branch: main | |
secrets: inherit |