Skip to content

Commit 97e1a83

Browse files
chore: Re-enable Nx Distributed Task Execution (#5518)
1 parent b50eb36 commit 97e1a83

File tree

3 files changed

+94
-39
lines changed

3 files changed

+94
-39
lines changed

.github/workflows/ci.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: ci
2-
concurrency:
3-
group: publish-${{ github.github.base_ref }}
4-
cancel-in-progress: true
2+
53
on:
64
workflow_dispatch:
75
inputs:
@@ -13,9 +11,15 @@ on:
1311
- 'main'
1412
- 'alpha'
1513
- 'beta'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
17+
cancel-in-progress: true
18+
1619
env:
17-
NX_DAEMON: false
1820
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
21+
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
22+
1923
jobs:
2024
test-and-publish:
2125
if: github.repository == 'TanStack/query' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta')

.github/workflows/pr.yml

+77-21
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,90 @@ concurrency:
77
cancel-in-progress: true
88

99
env:
10+
NX_CLOUD_DISTRIBUTED_EXECUTION: true
11+
NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3
1012
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
13+
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
1114

1215
jobs:
1316
main:
14-
name: Nx Cloud
15-
uses: nrwl/ci/.github/workflows/[email protected]
16-
with:
17-
node-version: 18.16.0
18-
pnpm-version: 8.6.0
19-
main-branch-name: alpha
20-
artifacts-name: nx-cloud-artifact
21-
artifacts-path: |
22-
**/build/**
23-
**/coverage/**
24-
!**/node_modules/**
25-
parallel-commands: |
26-
npx nx test:format
27-
npx nx affected --targets=test:eslint,test:types,test:build,test:lib
28-
codecov:
29-
name: Codecov
30-
needs: main
17+
name: Nx Cloud - Main Job
3118
runs-on: ubuntu-latest
3219
steps:
3320
- uses: actions/checkout@v3
34-
- name: Downloading artifacts
35-
uses: actions/download-artifact@v3
3621
with:
37-
name: nx-cloud-artifact
38-
path: .
22+
fetch-depth: 0
23+
- name: Setup pnpm
24+
uses: pnpm/[email protected]
25+
with:
26+
version: 8
27+
- name: Setup Node
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: 18.16.0
31+
cache: 'pnpm'
32+
- name: Install dependencies
33+
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
34+
- name: Get appropriate base and head commits for `nx affected` commands
35+
uses: nrwl/nx-set-shas@v3
36+
with:
37+
main-branch-name: 'alpha'
38+
- run: |
39+
echo "BASE: ${{ env.NX_BASE }}"
40+
echo "HEAD: ${{ env.NX_HEAD }}"
41+
- name: Start CI Orchestrator
42+
run: npx nx-cloud start-ci-run
43+
- name: Run Tests
44+
uses: nick-fields/[email protected]
45+
with:
46+
timeout_minutes: 5
47+
max_attempts: 3
48+
command: npx nx affected --targets=test:eslint,test:lib,test:types,test:build
49+
- name: Stop Agents
50+
run: npx nx-cloud stop-all-agents
3951
- name: Upload coverage to Codecov
4052
uses: codecov/codecov-action@v3
53+
agents:
54+
name: Nx Cloud - Agents
55+
runs-on: ubuntu-latest
56+
timeout-minutes: 10
57+
strategy:
58+
matrix:
59+
agent: [1, 2, 3]
60+
steps:
61+
- uses: actions/checkout@v3
62+
with:
63+
fetch-depth: 0
64+
- name: Setup pnpm
65+
uses: pnpm/[email protected]
66+
with:
67+
version: 8
68+
- name: Setup Node
69+
uses: actions/setup-node@v3
70+
with:
71+
node-version: 18.16.0
72+
cache: 'pnpm'
73+
- name: Install dependencies
74+
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
75+
- name: Start Nx Agent ${{ matrix.agent }}
76+
run: npx nx-cloud start-agent
77+
format:
78+
name: Format
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v3
82+
with:
83+
fetch-depth: 0
84+
- name: Setup pnpm
85+
uses: pnpm/[email protected]
86+
with:
87+
version: 8
88+
- name: Setup Node
89+
uses: actions/setup-node@v3
90+
with:
91+
node-version: 18.16.0
92+
cache: 'pnpm'
93+
- name: Install dependencies
94+
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
95+
- name: Run prettier
96+
run: pnpm run test:format

nx.json

+9-14
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@
1212
"test:eslint",
1313
"test:types",
1414
"test:build",
15-
"build",
16-
"build:rollup",
17-
"build:codemods",
18-
"build:types"
15+
"build"
1916
],
20-
"parallel": 5,
17+
"parallel": 3,
2118
"accessToken": "ZDdkNDA4MGEtYjNmYi00MWI4LWE1N2QtYTdlNmYxMGJlZWM2fHJlYWQ="
2219
}
2320
}
@@ -29,25 +26,23 @@
2926
}
3027
},
3128
"namedInputs": {
32-
"globalBuildAffectingConfig": [
29+
"sharedGlobals": [
3330
"{workspaceRoot}/.browserslistrc",
31+
"{workspaceRoot}/.eslintrc.cjs",
3432
"{workspaceRoot}/babel.config.cjs",
3533
"{workspaceRoot}/package.json",
3634
"{workspaceRoot}/scripts/getRollupConfig.js",
3735
"{workspaceRoot}/tsconfig.json"
3836
],
39-
"globalNonBuildAffectingConfig": ["{workspaceRoot}/.eslintrc.cjs"],
4037
"default": [
38+
"sharedGlobals",
4139
"{projectRoot}/**/*",
42-
"globalBuildAffectingConfig",
43-
"globalNonBuildAffectingConfig",
44-
"!{projectRoot}/**/*.md",
45-
"!{projectRoot}/**/build/**/*"
40+
"!{projectRoot}/**/*.md"
4641
],
4742
"public": [
4843
"default",
49-
"!{workspaceRoot}/.eslintrc.cjs",
50-
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
44+
"{projectRoot}/build",
45+
"{projectRoot}/dist",
5146
"!{projectRoot}/.eslintrc.cjs",
5247
"!{projectRoot}/tsconfig.eslint.json"
5348
]
@@ -69,7 +64,7 @@
6964
"build": {
7065
"dependsOn": ["^build"],
7166
"inputs": ["default", "^public"],
72-
"outputs": ["{projectRoot}/build/**/*"]
67+
"outputs": ["{projectRoot}/build", "{projectRoot}/dist"]
7368
},
7469
"test:build": {
7570
"dependsOn": ["build"],

0 commit comments

Comments
 (0)