From 1a1f39152d1ec17069b7301e861a2ff635685053 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sat, 3 Jun 2023 09:55:20 +1000 Subject: [PATCH 01/11] Try including build in public inputs --- .github/workflows/ci.yml | 8 ++++++++ nx.json | 12 +++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d89f132b7..81400478f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,3 +55,11 @@ jobs: TAG: ${{ inputs.tag }} - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + - name: Uploading artifacts + uses: actions/upload-artifact@v3 + with: + name: nx-cloud-artifact + path: | + **/build/** + **/coverage/** + !**/node_modules/** diff --git a/nx.json b/nx.json index 669df58257..0cc0f9b52a 100644 --- a/nx.json +++ b/nx.json @@ -29,25 +29,23 @@ } }, "namedInputs": { - "globalBuildAffectingConfig": [ + "sharedGlobals": [ "{workspaceRoot}/.browserslistrc", + "{workspaceRoot}/.eslintrc.cjs", "{workspaceRoot}/babel.config.cjs", "{workspaceRoot}/package.json", "{workspaceRoot}/scripts/getRollupConfig.mjs", "{workspaceRoot}/tsconfig.json" ], - "globalNonBuildAffectingConfig": ["{workspaceRoot}/.eslintrc.cjs"], "default": [ + "sharedGlobals", "{projectRoot}/**/*", - "globalBuildAffectingConfig", - "globalNonBuildAffectingConfig", "!{projectRoot}/**/*.md", - "!{projectRoot}/**/build/**/*" + "!{projectRoot}/build" ], "public": [ "default", - "!{workspaceRoot}/.eslintrc.cjs", - "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", + "{projectRoot}/build", "!{projectRoot}/.eslintrc.cjs", "!{projectRoot}/tsconfig.eslint.json" ] From 322b2a479016a3b40ac325d7243f7f3578554da8 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sat, 3 Jun 2023 09:57:16 +1000 Subject: [PATCH 02/11] Re-enable DTE agents --- .github/workflows/pr.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b5d14ccd1c..4086c74256 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -8,11 +8,12 @@ env: jobs: main: - name: Nx Cloud + name: Nx Cloud - Main Job uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.13.0 with: node-version: 18.16.0 pnpm-version: 8.6.0 + number-of-agents: 3 main-branch-name: alpha artifacts-name: nx-cloud-artifact artifacts-path: | @@ -21,7 +22,15 @@ jobs: !**/node_modules/** parallel-commands: | npx nx test:format + parallel-commands-on-agents: | npx nx affected --targets=test:eslint,test:types,test:build,test:lib + agents: + name: Nx Cloud - Agents + uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.13.0 + with: + node-version: 18.16.0 + pnpm-version: 8.6.0 + number-of-agents: 3 codecov: name: Codecov needs: main From bf98936b85a09531759940d1550355065758f584 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sat, 3 Jun 2023 10:06:10 +1000 Subject: [PATCH 03/11] Remove build from ignore Doesn't actually affect cache --- .github/workflows/pr.yml | 1 - nx.json | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4086c74256..e9b462084e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -41,6 +41,5 @@ jobs: uses: actions/download-artifact@v3 with: name: nx-cloud-artifact - path: . - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 diff --git a/nx.json b/nx.json index 0cc0f9b52a..2191ec24b7 100644 --- a/nx.json +++ b/nx.json @@ -40,8 +40,7 @@ "default": [ "sharedGlobals", "{projectRoot}/**/*", - "!{projectRoot}/**/*.md", - "!{projectRoot}/build" + "!{projectRoot}/**/*.md" ], "public": [ "default", @@ -67,7 +66,7 @@ "build": { "dependsOn": ["^build"], "inputs": ["default", "^public"], - "outputs": ["{projectRoot}/build/**/*"] + "outputs": ["{projectRoot}/build"] }, "test:build": { "dependsOn": ["build"], From 53bfba6b694e528f6cb8227a22042a7928a1b91e Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sat, 3 Jun 2023 10:41:20 +1000 Subject: [PATCH 04/11] Update cacheableOperations --- nx.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nx.json b/nx.json index 2191ec24b7..ffc8f17917 100644 --- a/nx.json +++ b/nx.json @@ -12,10 +12,7 @@ "test:eslint", "test:types", "test:build", - "build", - "build:rollup", - "build:codemods", - "build:types" + "build" ], "parallel": 5, "accessToken": "ZDdkNDA4MGEtYjNmYi00MWI4LWE1N2QtYTdlNmYxMGJlZWM2fHJlYWQ=" From 2aae93715968fe0f8aea2527dd03987d9c26a6a6 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sat, 3 Jun 2023 13:24:52 +1000 Subject: [PATCH 05/11] Set 1 agent --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e9b462084e..1b48e55212 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,7 +13,7 @@ jobs: with: node-version: 18.16.0 pnpm-version: 8.6.0 - number-of-agents: 3 + number-of-agents: 1 main-branch-name: alpha artifacts-name: nx-cloud-artifact artifacts-path: | @@ -30,7 +30,7 @@ jobs: with: node-version: 18.16.0 pnpm-version: 8.6.0 - number-of-agents: 3 + number-of-agents: 1 codecov: name: Codecov needs: main From 780c9877992872c063ec4632530480f34225a56a Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sat, 3 Jun 2023 21:06:23 +1000 Subject: [PATCH 06/11] Increase to 3 agents --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 037e787863..a4cd25fad4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -12,7 +12,7 @@ jobs: with: node-version: 18.16.0 pnpm-version: 8.6.0 - number-of-agents: 1 + number-of-agents: 3 main-branch-name: alpha artifacts-name: nx-cloud-artifact artifacts-path: | @@ -29,7 +29,7 @@ jobs: with: node-version: 18.16.0 pnpm-version: 8.6.0 - number-of-agents: 1 + number-of-agents: 3 codecov: name: Codecov needs: main From 07dcb96a770cbf31bbbd239a7f09088a4894e476 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 12:32:37 +1000 Subject: [PATCH 07/11] Use old custom config --- .github/workflows/pr.yml | 84 ++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ea7bdc089f..edf5d0b255 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -7,42 +7,70 @@ concurrency: cancel-in-progress: true env: + NX_CLOUD_DISTRIBUTED_EXECUTION: true + NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3 NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} jobs: main: name: Nx Cloud - Main Job - uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.13.0 - with: - node-version: 18.16.0 - pnpm-version: 8.6.0 - number-of-agents: 3 - main-branch-name: alpha - artifacts-name: nx-cloud-artifact - artifacts-path: | - **/build/** - **/coverage/** - !**/node_modules/** - parallel-commands: | - npx nx test:format - parallel-commands-on-agents: | - npx nx affected --targets=test:eslint,test:types,test:build,test:lib - agents: - name: Nx Cloud - Agents - uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.13.0 - with: - node-version: 18.16.0 - pnpm-version: 8.6.0 - number-of-agents: 3 - codecov: - name: Codecov - needs: main runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Downloading artifacts - uses: actions/download-artifact@v3 with: - name: nx-cloud-artifact + fetch-depth: 0 + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18.16.0 + cache: 'pnpm' + - name: Install dependencies + run: pnpm --filter "./packages/**" --filter query --prefer-offline install + - name: Get appropriate base and head commits for `nx affected` commands + uses: nrwl/nx-set-shas@v3 + with: + main-branch-name: 'alpha' + - run: | + echo "BASE: ${{ env.NX_BASE }}" + echo "HEAD: ${{ env.NX_HEAD }}" + - name: Start CI Orchestrator + run: npx nx-cloud start-ci-run + - name: Run Tests + uses: nick-fields/retry@v2.8.3 + with: + timeout_minutes: 5 + max_attempts: 3 + command: npx nx affected --targets=test:format,test:eslint,test:lib,test:types,build,test:build + - name: Stop Agents + run: npx nx-cloud stop-all-agents - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + agents: + name: Nx Cloud - Agents + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + agent: [1, 2, 3] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18.16.0 + cache: 'pnpm' + - name: Install dependencies + run: pnpm --filter "./packages/**" --filter query --prefer-offline install + - name: Start Nx Agent ${{ matrix.agent }} + run: npx nx-cloud start-agent From 8021a57b7d2db4aec72e32bd14c27ba61577e86b Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 12:39:34 +1000 Subject: [PATCH 08/11] Add separate prettier job --- .github/workflows/pr.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index edf5d0b255..aa216f9237 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -45,7 +45,7 @@ jobs: with: timeout_minutes: 5 max_attempts: 3 - command: npx nx affected --targets=test:format,test:eslint,test:lib,test:types,build,test:build + command: npx nx affected --targets=test:eslint,test:lib,test:types,build,test:build - name: Stop Agents run: npx nx-cloud stop-all-agents - name: Upload coverage to Codecov @@ -74,3 +74,23 @@ jobs: run: pnpm --filter "./packages/**" --filter query --prefer-offline install - name: Start Nx Agent ${{ matrix.agent }} run: npx nx-cloud start-agent + format: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 8 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18.16.0 + cache: 'pnpm' + - name: Install dependencies + run: pnpm --filter "./packages/**" --filter query --prefer-offline install + - name: Run prettier + run: pnpm run test:format From db0ceecd7314695a9a0a658ff44c5593a242035a Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 12:45:54 +1000 Subject: [PATCH 09/11] Remove build from command --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index aa216f9237..535fda0f24 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -45,7 +45,7 @@ jobs: with: timeout_minutes: 5 max_attempts: 3 - command: npx nx affected --targets=test:eslint,test:lib,test:types,build,test:build + command: npx nx affected --targets=test:eslint,test:lib,test:types,test:build - name: Stop Agents run: npx nx-cloud stop-all-agents - name: Upload coverage to Codecov From f9afa6b8c5dc51e28620a8e86a47b14d65594866 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 12:53:16 +1000 Subject: [PATCH 10/11] Try parallel 3 --- .github/workflows/ci.yml | 20 ++++++++------------ .github/workflows/pr.yml | 2 +- nx.json | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 940894d1af..6b2760e1b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,5 @@ name: ci -concurrency: - group: publish-${{ github.github.base_ref }} - cancel-in-progress: true + on: workflow_dispatch: inputs: @@ -13,9 +11,15 @@ on: - 'main' - 'alpha' - 'beta' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + env: - NX_DAEMON: false NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} + jobs: test-and-publish: if: github.repository == 'TanStack/query' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta') @@ -55,11 +59,3 @@ jobs: TAG: ${{ inputs.tag }} - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 - - name: Uploading artifacts - uses: actions/upload-artifact@v3 - with: - name: nx-cloud-artifact - path: | - **/build/** - **/coverage/** - !**/node_modules/** diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 535fda0f24..6afe8d8551 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -53,7 +53,7 @@ jobs: agents: name: Nx Cloud - Agents runs-on: ubuntu-latest - timeout-minutes: 20 + timeout-minutes: 10 strategy: matrix: agent: [1, 2, 3] diff --git a/nx.json b/nx.json index 605af289e6..8496b3be39 100644 --- a/nx.json +++ b/nx.json @@ -14,7 +14,7 @@ "test:build", "build" ], - "parallel": 5, + "parallel": 3, "accessToken": "ZDdkNDA4MGEtYjNmYi00MWI4LWE1N2QtYTdlNmYxMGJlZWM2fHJlYWQ=" } } From f2fe2d947fe99eaa98ae2d2824fae4ee17f742d0 Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Sun, 4 Jun 2023 12:58:36 +1000 Subject: [PATCH 11/11] Fix dist folder output --- nx.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nx.json b/nx.json index 8496b3be39..339b51dcf2 100644 --- a/nx.json +++ b/nx.json @@ -42,6 +42,7 @@ "public": [ "default", "{projectRoot}/build", + "{projectRoot}/dist", "!{projectRoot}/.eslintrc.cjs", "!{projectRoot}/tsconfig.eslint.json" ] @@ -63,7 +64,7 @@ "build": { "dependsOn": ["^build"], "inputs": ["default", "^public"], - "outputs": ["{projectRoot}/build"] + "outputs": ["{projectRoot}/build", "{projectRoot}/dist"] }, "test:build": { "dependsOn": ["build"],