Skip to content

ci: parallelize Nx tasks and add remote cache #31

ci: parallelize Nx tasks and add remote cache

ci: parallelize Nx tasks and add remote cache #31

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CI: true
NX_PARALLEL: 100%
jobs:
quality-checks:
name: Quality checks
runs-on: ubuntu-latest
timeout-minutes: 15
environment: ${{ github.ref == 'refs/heads/main' && 'nx-cloud-protected' || 'nx-cloud-read-only' }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets[github.ref == 'refs/heads/main' && 'NX_RW' || 'NX_READONLY'] }}
steps:
- name: Require scoped Nx Cloud token
if: ${{ env.NX_CLOUD_ACCESS_TOKEN == '' }}
run: exit 1
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@f520eceda224fe1a4aed5a2a27a194379a409996 # v6
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run cacheable workspace checks
run: pnpm nx run workspace:verify:prepush
quality-browsers:
name: Quality browser (${{ matrix.browser }})
runs-on: ubuntu-latest
timeout-minutes: 20
environment: ${{ github.ref == 'refs/heads/main' && 'nx-cloud-protected' || 'nx-cloud-read-only' }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets[github.ref == 'refs/heads/main' && 'NX_RW' || 'NX_READONLY'] }}
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
steps:
- name: Require scoped Nx Cloud token
if: ${{ env.NX_CLOUD_ACCESS_TOKEN == '' }}
run: exit 1
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@f520eceda224fe1a4aed5a2a27a194379a409996 # v6
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browser
run: pnpm exec playwright install --with-deps ${{ matrix.browser }}
- name: Test examples and website in ${{ matrix.browser }}
env:
AF_E2E_OUTPUT_DIR: test-results/${{ matrix.browser }}
run: >-
pnpm nx run @af-utils/examples:e2e --
--project=${{ matrix.browser }}
- name: Upload browser report
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.0
with:
name: quality-browser-${{ matrix.browser }}
path: |
playwright-report/
test-results/
if-no-files-found: ignore
retention-days: 7
quality-website:
name: Quality website
runs-on: ubuntu-latest
timeout-minutes: 15
environment: ${{ github.ref == 'refs/heads/main' && 'nx-cloud-protected' || 'nx-cloud-read-only' }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets[github.ref == 'refs/heads/main' && 'NX_RW' || 'NX_READONLY'] }}
steps:
- name: Require scoped Nx Cloud token
if: ${{ env.NX_CLOUD_ACCESS_TOKEN == '' }}
run: exit 1
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@f520eceda224fe1a4aed5a2a27a194379a409996 # v6
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Chromium
run: pnpm exec playwright install --with-deps chromium
- name: Check minimum framework versions
run: pnpm nx run @af-utils/virtual-compatibility:compat
- name: Check generated website files and performance budgets
run: pnpm nx run workspace:verify:website
- name: Check internal website links
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0
with:
args: >-
--offline
--root-dir '${{ github.workspace }}/website/dist'
'${{ github.workspace }}/website/dist/**/*.html'
fail: true
- name: Upload website reports
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.0
with:
name: quality-website
path: .lighthouseci/
if-no-files-found: ignore
retention-days: 7
quality:
name: quality / Quality
if: ${{ always() }}
needs: [quality-checks, quality-browsers, quality-website]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Confirm every quality job succeeded
env:
CHECKS_RESULT: ${{ needs.quality-checks.result }}
BROWSERS_RESULT: ${{ needs.quality-browsers.result }}
WEBSITE_RESULT: ${{ needs.quality-website.result }}
run: |
test "$CHECKS_RESULT" = success
test "$BROWSERS_RESULT" = success
test "$WEBSITE_RESULT" = success
check-hot-node-lts:
name: check-hot Node 24.19 LTS controls
runs-on: ubuntu-latest
timeout-minutes: 30
environment: ${{ github.ref == 'refs/heads/main' && 'nx-cloud-protected' || 'nx-cloud-read-only' }}
env:
CHECK_HOT_REQUIRE_RUNTIMES: node
NX_CLOUD_ACCESS_TOKEN: ${{ secrets[github.ref == 'refs/heads/main' && 'NX_RW' || 'NX_READONLY'] }}
steps:
- name: Require scoped Nx Cloud token
if: ${{ env.NX_CLOUD_ACCESS_TOKEN == '' }}
run: exit 1
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@f520eceda224fe1a4aed5a2a27a194379a409996 # v6
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Node LTS oracle and ecosystem controls
run: pnpm nx run-many -t test --projects=@af-utils/check-hot,@af-utils/check-hot-test-runners
- name: Enforce check-hot mutation-test ratchet
run: pnpm nx run @af-utils/check-hot:test:mutation
check-hot-windows-process-tree:
name: check-hot Windows process-tree cleanup
runs-on: windows-latest
timeout-minutes: 15
environment: ${{ github.ref == 'refs/heads/main' && 'nx-cloud-protected' || 'nx-cloud-read-only' }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets[github.ref == 'refs/heads/main' && 'NX_RW' || 'NX_READONLY'] }}
steps:
- name: Require scoped Nx Cloud token
if: ${{ env.NX_CLOUD_ACCESS_TOKEN == '' }}
run: exit 1
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@f520eceda224fe1a4aed5a2a27a194379a409996 # v6
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Test bounded process-tree cleanup
run: pnpm nx run @af-utils/check-hot:test:process
check-hot-runtimes:
name: check-hot Node/Deno/Bun oracles
runs-on: ubuntu-latest
timeout-minutes: 15
environment: ${{ github.ref == 'refs/heads/main' && 'nx-cloud-protected' || 'nx-cloud-read-only' }}
env:
CHECK_HOT_REQUIRE_RUNTIMES: node,deno,bun
NX_CLOUD_ACCESS_TOKEN: ${{ secrets[github.ref == 'refs/heads/main' && 'NX_RW' || 'NX_READONLY'] }}
steps:
- name: Require scoped Nx Cloud token
if: ${{ env.NX_CLOUD_ACCESS_TOKEN == '' }}
run: exit 1
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.0
- name: Install pnpm
uses: pnpm/action-setup@f520eceda224fe1a4aed5a2a27a194379a409996 # v6
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: pnpm
- name: Set up Deno 2.9.5
uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3
with:
deno-version: "v2.9.5"
- name: Set up Bun 1.3.14
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run real runtime and ecosystem controls
run: pnpm nx run-many -t test --projects=@af-utils/check-hot,@af-utils/check-hot-test-runners