feat!: update to the latest nx #1225
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
permissions: | |
actions: read | |
contents: read | |
concurrency: | |
# Group concurrency on workflow, then: | |
# - Is merge run? Group on branch name (`refs/heads/main`) | |
# - Is pull request? Group on pull request branch name, for example `feat/add-awesome-feature` | |
group: >- | |
${{ github.workflow }}-${{ | |
github.event_name == 'push' | |
&& github.ref | |
|| github.head_ref | |
}} | |
# Run merge workflows in sequence to prevent parallel deployments and releases | |
# Cancel stale pull request runs in progress for the same branch | |
cancel-in-progress: ${{ github.event_name != 'push' }} | |
env: | |
NODE_OPTIONS: --max-old-space-size=6144 | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Connect your workspace on nx.app and uncomment this to enable task distribution. | |
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested | |
- run: pnpm dlx nx-cloud start-ci-run --distribute-on="4 linux-medium-js" | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 9.5 | |
# Cache node_modules | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: nrwl/nx-set-shas@v4 | |
# Restore the previous npm modules and Cypress binary archives. | |
# Any updated archives will be saved automatically after the entire | |
# workflow successfully finishes. | |
# See https://github.com/actions/cache | |
# we use exact restore key to avoid npm module snowballing | |
# https://glebbahmutov.com/blog/do-not-let-npm-cache-snowball/ | |
- name: Cache central npm modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ github.ref }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ github.ref }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
# we use the exact restore key to avoid Cypress binary snowballing | |
# https://glebbahmutov.com/blog/do-not-let-cypress-cache-snowball/ | |
- name: Cache Cypress binary | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/Cypress | |
key: cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
cypress-${{ runner.os }}-cypress-${{ github.ref }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
# Cache local node_modules to pass to testing jobs | |
- name: Cache local node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-modules-${{ github.ref }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-node-modules-${{ github.ref }}- | |
- name: install dependencies and verify Cypress | |
env: | |
# make sure every Cypress install prints minimal information | |
CI: 1 | |
run: | | |
pnpm install --frozen-lockfile | |
pnpm exec cypress cache path | |
pnpm exec cypress cache list | |
pnpm exec cypress verify | |
pnpm exec cypress info | |
- name: Run NX Commands | |
run: | | |
pnpm exec nx-cloud record -- nx format:check | |
pnpm exec nx affected -t lint test build e2e-ci | |
sonarcloud: | |
name: SonarCloud | |
needs: main | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
actions: read | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Necessary for SonarCloud Scan | |
fetch-depth: 0 | |
- name: Setup | |
uses: ./.github/actions/setup | |
# Uses the cache generated in the distributed step (Needed for the sonar eslint reports). | |
- name: Lint with reports | |
run: pnpm exec nx run-many --all --target=lint --configuration=report --parallel=2 --max-warnings=0 | |
# Uses the cache generated in the distributed step (Needed for the sonar jest coverage reports). | |
- name: Tests with coverage | |
run: pnpm exec nx run-many --all --target=test --configuration=coverage --parallel=1 --max-workers=2 | |
- name: Configure Sonar report paths | |
run: pnpm run configure-sonar-report-paths | |
- name: SonarCloud Scan | |
uses: sonarsource/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |