Update nx monorepo to v20.4.0 #2063
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: Monorepo CI | |
on: | |
push: | |
branches: | |
- renovate/* | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_call: | |
inputs: | |
version: | |
description: The npm version to use for generate-license-file | |
default: "0.0.0" | |
required: false | |
type: string | |
env: | |
NODE_VERSION: 20 | |
CWD: ./src | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: npm | |
cache-dependency-path: ${{ env.CWD }}/package-lock.json | |
- name: Install dependencies | |
working-directory: ${{ env.CWD }} | |
run: npm ci | |
- name: Run ESLint | |
working-directory: ${{ env.CWD }} | |
run: npx nx run-many --target lint | |
- name: Run Prettier | |
working-directory: ${{ env.CWD }} | |
run: npx prettier --check . | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: npm | |
cache-dependency-path: ${{ env.CWD }}/package-lock.json | |
- name: Install dependencies | |
working-directory: ${{ env.CWD }} | |
run: npm ci | |
- name: Build | |
working-directory: ${{ env.CWD }} | |
run: npx nx run-many --target build | |
- name: Log Version | |
shell: pwsh | |
run: Write-Host ${{ inputs.version }} | |
- name: Set Version | |
if: inputs.version != '' | |
working-directory: ${{ env.CWD }} | |
run: npx nx run-many --target version --args="--version=${{ inputs.version }}" | |
- name: Upload Build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Build | |
path: ${{ env.CWD }}/dist | |
retention-days: 1 | |
test: | |
name: Unit Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: npm | |
cache-dependency-path: ${{ env.CWD }}/package-lock.json | |
- name: Install dependencies | |
working-directory: ${{ env.CWD }} | |
run: npm ci | |
- name: Run Unit Tests | |
working-directory: ${{ env.CWD }} | |
run: npx nx run-many --target test -- --ci --coverage | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ${{ env.CWD }}/coverage | |
e2e: | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: Ubuntu | |
value: ubuntu-latest | |
- name: MacOS | |
value: macos-latest | |
- name: Windows | |
value: windows-latest | |
node: | |
- 18 | |
- 20 | |
- 21 | |
name: E2E (Node ${{ matrix.node }} on ${{ matrix.os.name }}) | |
runs-on: ${{ matrix.os.value }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node.JS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: npm | |
cache-dependency-path: ${{ env.CWD }}/package-lock.json | |
- name: Install latest npm | |
run: | | |
npm i -g [email protected] | |
node --version | |
npm --version | |
- name: Install dependencies | |
working-directory: ${{ env.CWD }} | |
run: npm ci | |
- name: Download Build | |
uses: actions/download-artifact@v4 | |
with: | |
name: Build | |
path: ${{ env.CWD }}/dist | |
- name: Run E2E Tests | |
working-directory: ${{ env.CWD }} | |
run: npx nx run-many --target e2e --exclude pnpm | |
e2e-pnpm: | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
pnpm: | |
- 9 | |
- 10 | |
name: E2E (pnpm ${{ matrix.pnpm }}) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node.JS | |
uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
cache-dependency-path: ${{ env.CWD }}/package-lock.json | |
- name: Install pnpm | |
run: | | |
corepack enable | |
corepack prepare pnpm@${{ matrix.pnpm }} --activate | |
- name: Install dependencies | |
working-directory: ${{ env.CWD }} | |
run: npm ci | |
- name: Download Build | |
uses: actions/download-artifact@v4 | |
with: | |
name: Build | |
path: ${{ env.CWD }}/dist | |
- name: Run E2E Tests | |
working-directory: ${{ env.CWD }} | |
run: npx nx run pnpm:e2e |