From 18594ade72fe61a8655029c66088a67ed1ce73cc Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Tue, 23 Sep 2025 03:33:52 -0400 Subject: [PATCH] ci: add experimental Nx affected workflow (#16389) * ci: add experimental Nx affected workflow Adds .github/workflows/nx.yml to run \`nx affected\` on pull requests, testing only changed libraries for build, lint, and test targets. This prevents regressions of the library configuration issues discovered in the systematic Nx library audit and ensures proper library builds in CI. Features: - Uses nrwl/nx-set-shas for accurate affected project detection - Tests build, lint, and test targets - Runs on PR open/synchronize events - Helps catch package.json path bugs before merge * review: get node version from .nvmrc --- .github/workflows/nx.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/nx.yml diff --git a/.github/workflows/nx.yml b/.github/workflows/nx.yml new file mode 100644 index 00000000000..13d151225c2 --- /dev/null +++ b/.github/workflows/nx.yml @@ -0,0 +1,41 @@ +name: Experimental Nx CI +on: + pull_request: + types: [opened, synchronize] + +permissions: + contents: read + +jobs: + nx-experiment: + name: Run Nx Affected Tasks + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Get Node Version + id: retrieve-node-version + working-directory: ./ + run: | + NODE_NVMRC=$(cat .nvmrc) + NODE_VERSION=${NODE_NVMRC/v/''} + echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT + + - name: Set up Node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + cache: 'npm' + cache-dependency-path: '**/package-lock.json' + node-version: ${{ env._NODE_VERSION }} + + - name: Install dependencies + run: npm ci + + - name: Set Nx SHAs for affected detection + uses: nrwl/nx-set-shas@826660b82addbef3abff5fa871492ebad618c9e1 # v4.3.3 + + - name: Run Nx affected tasks + run: npx nx affected -t build lint test \ No newline at end of file