Skip to content

feat!: upgrade to nx 19.1 and angular 18 #1180

feat!: upgrade to nx 19.1 and angular 18

feat!: upgrade to nx 19.1 and angular 18 #1180

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request: {}
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:
# We're using Nx Cloud for Distributed Task Execution
# Reference: https://nx.dev/using-nx/dte
#
# The coordinator outputs the combination of task outputs from the agents,
# both terminal and file outputs
dte_coordinator:
name: DTE Coordinator
uses: nrwl/ci/.github/workflows/[email protected]
secrets:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
permissions:
contents: read
actions: read
with:
main-branch-name: main
# Must match dte_agents.number-of-agents
number-of-agents: 4
# The --stop-agents-after parameter must match the task target listed last
# in the parallel-commands-on-agents command list
# The --agent-count parameter must match the number-of-agents parameter
init-commands: |
pnpm exec nx-cloud start-ci-run --stop-agents-after="e2e" --agent-count=4
# Commands run in parallel on this DTE coordinator
parallel-commands: |
pnpm exec nx-cloud record -- yarn nx format:check
# Commands distributed between DTE agents
# Distribution strategy for 2 vCPUs per hosted runner (GitHub Free):
# lint: 2 tasks assigned at a time, 1 task per vCPU
# test: 1 task assigned at a time with 2 parallel processes, 1 process per vCPU
# build: 2 tasks assigned at a time, 1 task per vCPU
# e2e: 1 task assigned at a time, 1 task total
parallel-commands-on-agents: |
pnpm exec nx run-many --all --target=lint --configuration=report --parallel=2 --max-warnings=0
pnpm exec nx run-many --all --target=test --configuration=coverage --parallel=1 --max-workers=2
pnpm exec nx affected --target=build --parallel=2
pnpm exec nx affected --target=e2e --parallel=1
# Commands run sequentially on this DTE coordinator after parallel jobs
# final-commands: |
# We're using Nx Cloud for Distributed Task Execution
# Reference: https://nx.dev/using-nx/dte
#
# Agents receive tasks to execute in bulk whenever they are ready or have
# finished their previous tasks
dte_agents:
name: DTE Agents
uses: nrwl/ci/.github/workflows/[email protected]
secrets:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
permissions:
contents: read
actions: read
with:
# The Free GitHub plan has a limit of 20 concurrent jobs on Ubuntu images
# Reference: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration
# If we need to, we can optimize for 2 simultaneous workflow runs:
# 2 x 1 main job = 2 concurrent jobs
# 2 x 9 agent jobs = 18 concurrent jobs
# Total = 20 concurrent jobs
#
# However, we don't have many projects or targets in this workspace, so we
# lower the number of agents to reduce spent compute time.
number-of-agents: 4
deploy-docs:
name: '[Merge] Deploy docs to GitHub Pages'
needs: dte_coordinator
if: github.event_name == 'push' && github.ref_name == 'main'
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Check out the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
# Uses the cache generated in the distributed step
- name: Build docs
run: pnpm exec nx build docs-lumberjack-docs-app
- name: Set up GitHub Pages
uses: actions/configure-pages@v4
- name: Upload docs to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: dist/packages/docs/lumberjack-docs-app/
- name: Deploy docs to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
sonarcloud:
name: SonarCloud
needs: dte_coordinator
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 exec configure-sonar-report-paths
- name: SonarCloud Scan
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}