From 163c8e569c314d50d9e286f2fd40801b92543b92 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sat, 17 Feb 2024 12:02:42 +1100 Subject: [PATCH] ci: Use Nx Agents --- .github/workflows/ci.yml | 7 ++++++- .github/workflows/pr.yml | 7 ++++++- .gitignore | 5 +++-- .nx/workflows/dynamic-changesets.yaml | 4 ++++ nx.json | 4 ++++ 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .nx/workflows/dynamic-changesets.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41f3e35af9..3681e39fb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,10 +35,15 @@ jobs: with: node-version-file: .nvmrc cache: pnpm + - name: Start Nx Agents + run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" - name: Install dependencies run: pnpm install --frozen-lockfile --prefer-offline - name: Run Tests - run: pnpm run test:ci + run: pnpm run test:ci --parallel=3 + - name: Stop Nx Agents + if: ${{ always() }} + run: npx nx-cloud stop-all-agents - name: Publish run: | git config --global user.name 'Tanner Linsley' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 70a0723ad9..569e24df61 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -32,6 +32,8 @@ jobs: with: node-version-file: .nvmrc cache: pnpm + - name: Start Nx Agents + run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" - name: Install dependencies run: pnpm install --frozen-lockfile --prefer-offline - name: Get base and head commits for `nx affected` @@ -39,4 +41,7 @@ jobs: with: main-branch-name: 'main' - name: Run Checks - run: pnpm run test:pr + run: pnpm run test:pr --parallel=3 + - name: Stop Nx Agents + if: ${{ always() }} + run: npx nx-cloud stop-all-agents diff --git a/.gitignore b/.gitignore index 9705b85efa..1ef516313f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ # dependencies node_modules +package-lock.json +yarn.lock # builds types @@ -36,9 +38,8 @@ stats.html *.log .DS_Store -node_modules .cache -dist +.pnpm-store package-lock.json yarn.lock diff --git a/.nx/workflows/dynamic-changesets.yaml b/.nx/workflows/dynamic-changesets.yaml new file mode 100644 index 0000000000..29c58231b2 --- /dev/null +++ b/.nx/workflows/dynamic-changesets.yaml @@ -0,0 +1,4 @@ +distribute-on: + small-changeset: 8 linux-medium-js + medium-changeset: 10 linux-medium-js + large-changeset: 12 linux-medium-js diff --git a/nx.json b/nx.json index d1b1d77802..906acf9f5a 100644 --- a/nx.json +++ b/nx.json @@ -43,6 +43,10 @@ "inputs": ["default", "^public"], "outputs": ["{projectRoot}/build", "{projectRoot}/dist"], "cache": true + }, + "test:format": { + "cache": true, + "inputs": ["{workspaceRoot}/**/*"] } } }