chore(deps): update linting packages (major) #3853
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
# Run the CI: lint, build, tests, ... | |
name: CI | |
on: | |
pull_request: | |
branches: | |
- environments/* | |
- master | |
types: | |
- opened | |
- ready_for_review | |
- synchronize | |
workflow_call: {} | |
workflow_dispatch: {} | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}" | |
cancel-in-progress: true | |
env: | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_WRITE_TOKEN }} | |
NX_NO_CLOUD: ${{ contains(github.event.pull_request.labels.*.name, 'renovate') }} | |
jobs: | |
# Install modules before any test | |
# The install can take to 2min, so it won't be a total of 4min in the following jobs | |
npm_install: | |
# To not run on draft PRs | |
if: ${{ github.event.pull_request.draft == false }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: nrwl/nx-set-shas@v4 | |
with: | |
main-branch-name: master | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
~/.cache/Cypress | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./package.json', './package-lock.json') }} | |
restore-keys: ${{ runner.os }}-${{ env.cache-name }}- | |
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
name: Install packages | |
run: npm ci | |
checks: | |
# To not run on draft PRs | |
if: ${{ github.event.pull_request.draft == false }} | |
needs: | |
- npm_install | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: nrwl/nx-set-shas@v4 | |
with: | |
main-branch-name: master | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
~/.cache/Cypress | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./package.json', './package-lock.json') }} | |
restore-keys: ${{ runner.os }}-${{ env.cache-name }}- | |
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
name: Install packages | |
run: npm ci | |
# If the cache is used | |
- if: ${{ steps.cache-node-modules.outputs.cache-hit == 'true' }} | |
run: npm run postinstall | |
# Verify that all mikro-orm versions are correct and CLI is usable (TS-node resolution) | |
- name: Verify ORM versions | |
run: npx mikro-orm debug && npx mikro-orm seeder:create TestCI && git clean ./apps --force | |
# `test -f ...` => Only if there is initial migrations | |
- name: Check ORM migrations | |
run: if [ -f ./apps/backend/src/orm/migrations/snapshot.json ]; then npx mikro-orm migration:check; fi | |
- name: Lint | |
run: npm run lint | |
- name: Check i18n | |
run: npm run i18n:check | |
- name: Comments coverage | |
run: npm run compodoc:coverage | |
# To verify test files and if some compilers ignore typechecking | |
- name: Run typecheck | |
run: npm run typecheck | |
- name: Tests | |
run: npm run test:ci | |
e2e: | |
# To not run on draft PRs | |
if: ${{ github.event.pull_request.draft == false }} | |
needs: | |
- npm_install | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: nrwl/nx-set-shas@v4 | |
with: | |
main-branch-name: master | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
~/.cache/Cypress | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./package.json', './package-lock.json') }} | |
restore-keys: ${{ runner.os }}-${{ env.cache-name }}- | |
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
name: Install packages | |
run: npm ci | |
# If the cache is used | |
- if: ${{ steps.cache-node-modules.outputs.cache-hit == 'true' }} | |
run: npm run postinstall | |
# Get the number of affected apps | |
- id: get-affected | |
run: | | |
N=$(npx nx show projects --affected -t build | wc -l) | |
echo "N=$N" >> $GITHUB_OUTPUT | |
# Only run when there are affected applications | |
- if: ${{ steps.get-affected.outputs.N != 0 }} | |
run: npm run docker:e2e | |
- if: ${{ steps.get-affected.outputs.N != 0 }} | |
name: "[docker-compose] Prepare for E2E testing" | |
uses: hoverkraft-tech/[email protected] | |
with: | |
compose-file: | | |
./docker-compose.yml | |
./docker-compose.e2e-ci.yml | |
- if: ${{ steps.get-affected.outputs.N != 0 }} | |
name: Wait for E2E Backend instance | |
run: npx wait-port 33000 -t 30000 | |
- if: ${{ steps.get-affected.outputs.N != 0 }} | |
name: Tests e2e | |
run: npm run test:e2e:ci | |
env: | |
BE_E2E_USE_EXISTING: true | |
- name: Upload Cypress artifacts in case of error in `frontend` | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
if-no-files-found: warn | |
name: cypress-frontend-logs | |
path: dist/cypress/apps/frontend/e2e/ | |
retention-days: 7 | |
- name: Upload Cypress artifacts in case of error in `office` | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
if-no-files-found: warn | |
name: cypress-office-logs | |
path: dist/cypress/apps/office/e2e/ | |
retention-days: 7 |