Skip to content

Commit a80cea3

Browse files
ci: Optimise Nx workflow (#7648)
* ci: Optimise Nx workflow * Merge test:build and test:attw
1 parent b5272df commit a80cea3

File tree

26 files changed

+34
-77
lines changed

26 files changed

+34
-77
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,11 @@ jobs:
2525
- name: Checkout
2626
uses: actions/checkout@v4
2727
with:
28-
fetch-depth: '0'
29-
- name: Setup pnpm
30-
uses: pnpm/action-setup@v4
31-
- name: Setup Node
32-
uses: actions/setup-node@v4
33-
with:
34-
node-version-file: .nvmrc
35-
cache: pnpm
28+
fetch-depth: 0
3629
- name: Start Nx Agents
3730
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
38-
- name: Install dependencies
39-
run: pnpm install --frozen-lockfile --prefer-offline
31+
- name: Setup Tools
32+
uses: tanstack/config/.github/setup@main
4033
- name: Run Tests
4134
run: pnpm run test:ci --parallel=3
4235
- name: Stop Nx Agents
@@ -49,10 +42,8 @@ jobs:
4942
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
5043
pnpm run cipublish
5144
env:
52-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
5345
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5446
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
55-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5647
TAG: ${{ inputs.tag }}
5748
- name: Upload coverage to Codecov
5849
uses: codecov/codecov-action@v4

.github/workflows/pr.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,20 @@ env:
1313
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1414

1515
jobs:
16-
main:
17-
name: Nx Cloud - Main Job
16+
test:
17+
name: Test
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
2222
with:
2323
fetch-depth: 0
24-
- name: Setup pnpm
25-
uses: pnpm/action-setup@v4
26-
- name: Setup Node
27-
uses: actions/setup-node@v4
28-
with:
29-
node-version-file: .nvmrc
30-
cache: pnpm
3124
- name: Start Nx Agents
3225
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
33-
- name: Install dependencies
34-
run: pnpm install --frozen-lockfile --prefer-offline
26+
- name: Setup Tools
27+
uses: tanstack/config/.github/setup@main
3528
- name: Get base and head commits for `nx affected`
36-
uses: nrwl/nx-set-shas@v3
29+
uses: nrwl/nx-set-shas@v4
3730
with:
3831
main-branch-name: 'main'
3932
- name: Run Tests
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
distribute-on:
2-
small-changeset: 8 linux-medium-js
3-
medium-changeset: 10 linux-medium-js
4-
large-changeset: 12 linux-medium-js
2+
small-changeset: 3 linux-medium-js
3+
medium-changeset: 6 linux-medium-js
4+
large-changeset: 10 linux-medium-js

nx.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@
4646
"inputs": ["default", "^public"],
4747
"cache": true
4848
},
49-
"test:attw": {
50-
"dependsOn": ["build"],
51-
"inputs": ["default", "^public"],
52-
"cache": true
53-
},
5449
"build": {
5550
"dependsOn": ["^build"],
5651
"inputs": ["default", "^public"],

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...')} else {process.exit(1)}\" || npx -y only-allow pnpm",
1313
"prepare": "husky",
1414
"test": "pnpm run test:ci",
15-
"test:pr": "nx affected --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build,test:attw",
16-
"test:ci": "nx run-many --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build,test:attw",
15+
"test:pr": "nx affected --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build",
16+
"test:ci": "nx run-many --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build",
1717
"test:eslint": "nx affected --target=test:eslint --exclude=examples/**",
1818
"test:format": "pnpm run prettier --check",
1919
"test:sherif": "sherif -p \"./integrations/*\" -p \"./examples/*\"",
2020
"test:lib": "nx affected --target=test:lib --exclude=examples/**",
2121
"test:lib:dev": "pnpm run test:lib && nx watch --all -- pnpm run test:lib",
2222
"test:build": "nx affected --target=test:build --exclude=examples/**",
23-
"test:attw": "nx affected --target=test:attw --exclude=examples/**",
2423
"test:types": "nx affected --target=test:types --exclude=examples/**",
2524
"test:knip": "knip",
2625
"build": "nx affected --target=build --exclude=examples/**",

packages/angular-query-devtools-experimental/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js",
2727
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js",
2828
"test:types:ts53": "tsc",
29-
"test:build": "publint --strict",
30-
"test:attw": "attw --pack",
29+
"test:build": "publint --strict && attw --pack",
3130
"build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./build/package.json"
3231
},
3332
"dependencies": {

packages/angular-query-experimental/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
"test:types:ts53": "tsc",
4545
"test:lib": "vitest",
4646
"test:lib:dev": "pnpm run test:lib --watch",
47-
"test:build": "publint --strict",
48-
"test:attw": "attw --pack",
47+
"test:build": "publint --strict && attw --pack",
4948
"build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./build/package.json && api-extractor run --local"
5049
},
5150
"dependencies": {

packages/eslint-plugin-query/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
"test:types:ts53": "tsc",
4242
"test:lib": "vitest",
4343
"test:lib:dev": "pnpm run test:lib --watch",
44-
"test:build": "publint --strict",
45-
"test:attw": "attw --pack",
44+
"test:build": "publint --strict && attw --pack",
4645
"build": "vite build"
4746
},
4847
"files": [

packages/query-async-storage-persister/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
"test:types:ts53": "tsc",
4747
"test:lib": "vitest",
4848
"test:lib:dev": "pnpm run test:lib --watch",
49-
"test:build": "publint --strict",
50-
"test:attw": "attw --pack",
49+
"test:build": "publint --strict && attw --pack",
5150
"build": "tsup"
5251
},
5352
"dependencies": {

packages/query-broadcast-client-experimental/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
"test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js",
4545
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js",
4646
"test:types:ts53": "tsc",
47-
"test:build": "publint --strict",
48-
"test:attw": "attw --pack",
47+
"test:build": "publint --strict && attw --pack",
4948
"build": "tsup"
5049
},
5150
"dependencies": {

0 commit comments

Comments
 (0)