Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Optimise Nx workflow #7648

Merged
merged 2 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
fetch-depth: 0
- 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: Setup Tools
uses: tanstack/config/.github/setup@main
- name: Run Tests
run: pnpm run test:ci --parallel=3
- name: Stop Nx Agents
Expand All @@ -49,10 +42,8 @@ jobs:
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
pnpm run cipublish
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG: ${{ inputs.tag }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,20 @@ env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
main:
name: Nx Cloud - Main Job
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
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: Setup Tools
uses: tanstack/config/.github/setup@main
- name: Get base and head commits for `nx affected`
uses: nrwl/nx-set-shas@v3
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'main'
- name: Run Tests
Expand Down
6 changes: 3 additions & 3 deletions .nx/workflows/dynamic-changesets.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distribute-on:
small-changeset: 8 linux-medium-js
medium-changeset: 10 linux-medium-js
large-changeset: 12 linux-medium-js
small-changeset: 3 linux-medium-js
medium-changeset: 6 linux-medium-js
large-changeset: 10 linux-medium-js
5 changes: 0 additions & 5 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
"inputs": ["default", "^public"],
"cache": true
},
"test:attw": {
"dependsOn": ["build"],
"inputs": ["default", "^public"],
"cache": true
},
"build": {
"dependsOn": ["^build"],
"inputs": ["default", "^public"],
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...')} else {process.exit(1)}\" || npx -y only-allow pnpm",
"prepare": "husky",
"test": "pnpm run test:ci",
"test:pr": "nx affected --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build,test:attw",
"test:ci": "nx run-many --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build,test:attw",
"test:pr": "nx affected --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build",
"test:ci": "nx run-many --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build",
"test:eslint": "nx affected --target=test:eslint --exclude=examples/**",
"test:format": "pnpm run prettier --check",
"test:sherif": "sherif -p \"./integrations/*\" -p \"./examples/*\"",
"test:lib": "nx affected --target=test:lib --exclude=examples/**",
"test:lib:dev": "pnpm run test:lib && nx watch --all -- pnpm run test:lib",
"test:build": "nx affected --target=test:build --exclude=examples/**",
"test:attw": "nx affected --target=test:attw --exclude=examples/**",
"test:types": "nx affected --target=test:types --exclude=examples/**",
"test:knip": "knip",
"build": "nx affected --target=build --exclude=examples/**",
Expand Down
3 changes: 1 addition & 2 deletions packages/angular-query-devtools-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js",
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js",
"test:types:ts53": "tsc",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./build/package.json"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/angular-query-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./build/package.json && api-extractor run --local"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-plugin-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "vite build"
},
"files": [
Expand Down
3 changes: 1 addition & 2 deletions packages/query-async-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/query-broadcast-client-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js",
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js",
"test:types:ts53": "tsc",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
}
}
3 changes: 1 addition & 2 deletions packages/query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup",
"build:dev": "tsup --watch"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/query-persist-client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/query-sync-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/react-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup",
"build:dev": "tsup --watch"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/react-query-next-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js",
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js",
"test:types:ts53": "tsc",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/react-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest --retry=3",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest --retry=3",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "pnpm build:tsup && pnpm build:codemods",
"build:tsup": "tsup",
"build:codemods": "cpy ../query-codemods/* ./build/codemods"
Expand Down
3 changes: 1 addition & 2 deletions packages/solid-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js",
"test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js",
"test:types:ts53": "tsc",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup",
"build:dev": "tsup --watch"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/solid-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
"test:types:ts53": "tsc",
"test:lib": "vitest --retry=3",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup",
"build:watch": "tsup --watch"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/svelte-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"clean": "rimraf ./dist && rimraf ./coverage",
"test:types": "svelte-check --tsconfig ./tsconfig.json",
"test:eslint": "eslint ./src",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "svelte-package --input ./src --output ./dist"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/svelte-query-persist-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"test:eslint": "eslint ./src",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "svelte-package --input ./src --output ./dist"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/svelte-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"test:eslint": "eslint ./src",
"test:lib": "vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "svelte-package --input ./src --output ./dist"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/vue-query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"clean": "rimraf ./build && rimraf ./coverage",
"test:eslint": "eslint ./src",
"test:types": "vue-tsc",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "vite build"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/vue-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"test:lib:2.7": "vue-demi-switch 2.7 vue2.7 && vitest",
"test:lib:3": "vue-demi-switch 3 && vitest",
"test:lib:dev": "pnpm run test:lib --watch",
"test:build": "publint --strict",
"test:attw": "attw --pack",
"test:build": "publint --strict && attw --pack",
"build": "tsup"
},
"nx": {
Expand Down
Loading