Skip to content

Commit 61a83a6

Browse files
authored
feat(nx-cloud): organize workspace caching with improved input/outputs (#10734)
1 parent 2ad5daf commit 61a83a6

27 files changed

+2277
-148
lines changed

.github/workflows/apps_automated_android.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
workflow_dispatch:
1010

11+
env:
12+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
13+
1114
concurrency:
1215
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1316
cancel-in-progress: true
@@ -19,10 +22,16 @@ jobs:
1922
steps:
2023
- uses: actions/checkout@v4
2124

25+
2226
- uses: actions/setup-node@v4
2327
with:
2428
node-version: 23.5.0
2529

30+
- name: Derive appropriate SHAs for base and head for `nx affected` commands
31+
uses: nrwl/nx-set-shas@v4
32+
with:
33+
main-branch-name: 'main'
34+
2635
- uses: actions/setup-java@v4
2736
with:
2837
distribution: 'temurin'
@@ -36,7 +45,7 @@ jobs:
3645
- name: Install NativeScript
3746
run: |
3847
python3 -m pip install --upgrade pip six
39-
npm i -g nativescript --ignore-scripts --legacy-peer-deps
48+
npm i -g nativescript --ignore-scripts
4049
ns usage-reporting disable
4150
ns error-reporting disable
4251
@@ -57,4 +66,4 @@ jobs:
5766
with:
5867
api-level: 34
5968
arch: x86_64
60-
script: node tools/scripts/run-automated.js android
69+
script: npx nx test apps-automated -c=android

.github/workflows/apps_automated_ios.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
workflow_dispatch:
1010

11+
env:
12+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
13+
1114
concurrency:
1215
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1316
cancel-in-progress: true
@@ -27,9 +30,14 @@ jobs:
2730
with:
2831
node-version: 23.5.0
2932

33+
- name: Derive appropriate SHAs for base and head for `nx affected` commands
34+
uses: nrwl/nx-set-shas@v4
35+
with:
36+
main-branch-name: 'main'
37+
3038
- name: Install NativeScript
3139
run: |
32-
npm i -g nativescript --ignore-scripts --legacy-peer-deps
40+
npm i -g nativescript --ignore-scripts
3341
ns usage-reporting disable
3442
ns error-reporting disable
3543
# ns doctor
@@ -47,4 +55,4 @@ jobs:
4755
os_version: '17.5'
4856

4957
- name: Run tests on iOS Simulator
50-
run: node tools/scripts/run-automated.js ios
58+
run: npx nx test apps-automated -c=ios

.github/workflows/npm_release_core.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
env:
1111
NPM_TAG: 'next'
12+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1213

1314
jobs:
1415
release:
@@ -20,6 +21,11 @@ jobs:
2021
- name: Setup
2122
run: npm run setup
2223

24+
- name: Derive appropriate SHAs for base and head for `nx affected` commands
25+
uses: nrwl/nx-set-shas@v4
26+
with:
27+
main-branch-name: 'main'
28+
2329
- name: Generate Version
2430
working-directory: packages/core
2531
run: |

.github/workflows/npm_release_tns_core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v2
1919

2020
- name: Setup
21-
run: npm install --legacy-peer-deps
21+
run: npm install
2222

2323
- name: Generate Version
2424
run: |

.github/workflows/npm_release_webpack.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v2
1818

1919
- name: Setup
20-
run: npm install --legacy-peer-deps
20+
run: npm install
2121

2222
- name: Generate Version
2323
working-directory: packages/webpack
@@ -32,10 +32,10 @@ jobs:
3232
run: npx nx run webpack:build
3333

3434
- name: Publish @nativescript/webpack
35-
working-directory: dist/packages
35+
working-directory: dist/packages/webpack5
3636
env:
3737
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
3838
run: |
3939
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ../../.npmrc
4040
echo "Publishing @nativescript/webpack@$NPM_VERSION to NPM with tag $NPM_TAG..."
41-
npm publish nativescript-webpack.tgz --tag $NPM_TAG --dry-run
41+
npm publish --tag $NPM_TAG --dry-run

apps/automated/.npmrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

apps/automated/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@nativescript/android": "~8.8.0",
1515
"@nativescript/ios": "~8.8.0",
1616
"@nativescript/visionos": "~8.8.0",
17-
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
17+
"@nativescript/webpack": "file:../../dist/packages/webpack5",
1818
"circular-dependency-plugin": "^5.2.2",
1919
"typescript": "~5.6.0"
2020
},

apps/automated/project.json

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,20 @@
1111
"targets": {
1212
"build": {
1313
"executor": "@nativescript/nx:build",
14+
"inputs": ["default", "^production"],
1415
"options": {
1516
"noHmr": true,
1617
"production": true,
1718
"uglify": true,
1819
"release": true,
1920
"forDevice": true
2021
},
21-
"configurations": {}
22+
"configurations": {},
23+
"dependsOn": ["^build"]
2224
},
2325
"debug": {
2426
"executor": "@nativescript/nx:debug",
27+
"inputs": ["default", "^production"],
2528
"options": {
2629
"noHmr": true,
2730
"debug": false,
@@ -30,10 +33,12 @@
3033
"forDevice": false,
3134
"prepare": false
3235
},
33-
"configurations": {}
36+
"configurations": {},
37+
"dependsOn": ["^build"]
3438
},
3539
"prepare": {
3640
"executor": "@nativescript/nx:prepare",
41+
"inputs": ["default", "^production"],
3742
"options": {
3843
"noHmr": true,
3944
"production": true,
@@ -42,7 +47,21 @@
4247
"forDevice": true,
4348
"prepare": true
4449
},
45-
"configurations": {}
50+
"configurations": {},
51+
"dependsOn": ["^build"]
52+
},
53+
"test": {
54+
"executor": "nx:run-commands",
55+
"defaultConfiguration": "ios",
56+
"configurations": {
57+
"ios": {
58+
"commands": ["node tools/scripts/run-automated.js ios"]
59+
},
60+
"android": {
61+
"commands": ["node tools/scripts/run-automated.js android"]
62+
}
63+
},
64+
"dependsOn": ["^build"]
4665
},
4766
"clean": {
4867
"executor": "@nativescript/nx:clean",
@@ -54,5 +73,6 @@
5473
"lintFilePatterns": ["apps/automated/**/*.ts", "apps/automated/src/**/*.html"]
5574
}
5675
}
57-
}
76+
},
77+
"implicitDependencies": ["webpack5"]
5878
}

apps/toolbox/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/toolbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@nativescript/android": "~8.8.0",
1616
"@nativescript/ios": "~8.8.0",
1717
"@nativescript/visionos": "~8.8.0",
18-
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
18+
"@nativescript/webpack": "file:../../dist/packages/webpack5",
1919
"typescript": "~5.6.0"
2020
}
2121
}

apps/toolbox/project.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"release": true,
1919
"forDevice": true
2020
},
21-
"configurations": {}
21+
"configurations": {},
22+
"dependsOn": ["^build"]
2223
},
2324
"debug": {
2425
"executor": "@nativescript/nx:debug",
@@ -29,7 +30,8 @@
2930
"forDevice": false,
3031
"prepare": false
3132
},
32-
"configurations": {}
33+
"configurations": {},
34+
"dependsOn": ["^build"]
3335
},
3436
"prepare": {
3537
"executor": "@nativescript/nx:prepare",
@@ -41,7 +43,8 @@
4143
"forDevice": true,
4244
"prepare": true
4345
},
44-
"configurations": {}
46+
"configurations": {},
47+
"dependsOn": ["^build"]
4548
},
4649
"clean": {
4750
"executor": "@nativescript/nx:clean",
@@ -53,5 +56,6 @@
5356
"lintFilePatterns": ["apps/toolbox/**/*.ts", "apps/toolbox/src/**/*.html"]
5457
}
5558
}
56-
}
59+
},
60+
"implicitDependencies": ["webpack5"]
5761
}

apps/ui/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@nativescript/android": "~8.8.0",
1515
"@nativescript/ios": "~8.8.0",
1616
"@nativescript/visionos": "~8.8.0",
17-
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
17+
"@nativescript/webpack": "file:../../dist/packages/webpack5",
1818
"typescript": "~5.6.0"
1919
},
2020
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",

apps/ui/project.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"release": true,
1919
"forDevice": true
2020
},
21-
"configurations": {}
21+
"configurations": {},
22+
"dependsOn": ["^build"]
2223
},
2324
"debug": {
2425
"executor": "@nativescript/nx:debug",
@@ -29,7 +30,8 @@
2930
"forDevice": false,
3031
"prepare": false
3132
},
32-
"configurations": {}
33+
"configurations": {},
34+
"dependsOn": ["^build"]
3335
},
3436
"prepare": {
3537
"executor": "@nativescript/nx:prepare",
@@ -41,7 +43,8 @@
4143
"forDevice": true,
4244
"prepare": true
4345
},
44-
"configurations": {}
46+
"configurations": {},
47+
"dependsOn": ["^build"]
4548
},
4649
"clean": {
4750
"executor": "@nativescript/nx:clean",
@@ -53,5 +56,6 @@
5356
"lintFilePatterns": ["apps/ui/**/*.ts", "apps/ui/src/**/*.html"]
5457
}
5558
}
56-
}
59+
},
60+
"implicitDependencies": ["webpack5"]
5761
}

nx.json

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,37 @@
6969
},
7070
"$schema": "./node_modules/nx/schemas/nx-schema.json",
7171
"namedInputs": {
72-
"default": ["{projectRoot}/**/*", "sharedGlobals"],
73-
"sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.json", "{workspaceRoot}/nx.json"],
74-
"production": ["default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json", "!{projectRoot}/jest.config.[jt]s", "!{projectRoot}/src/test-setup.[jt]s"]
72+
"default": [
73+
"{projectRoot}/**/*",
74+
"sharedGlobals"
75+
],
76+
"sharedGlobals": [
77+
"{workspaceRoot}/workspace.json",
78+
"{workspaceRoot}/tsconfig.json",
79+
"{workspaceRoot}/nx.json"
80+
],
81+
"production": [
82+
"default",
83+
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
84+
"!{projectRoot}/tsconfig.spec.json",
85+
"!{projectRoot}/jest.config.[jt]s",
86+
"!{projectRoot}/src/test-setup.[jt]s"
87+
]
7588
},
7689
"targetDefaults": {
7790
"build": {
78-
"inputs": ["production", "^production"],
91+
"inputs": [
92+
"production",
93+
"^production"
94+
],
7995
"cache": true
8096
},
8197
"test": {
82-
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
98+
"inputs": [
99+
"default",
100+
"^production",
101+
"{workspaceRoot}/jest.preset.js"
102+
],
83103
"cache": true
84104
},
85105
"lint": {
@@ -95,7 +115,11 @@
95115
"cache": true
96116
},
97117
"@nx/jest:jest": {
98-
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
118+
"inputs": [
119+
"default",
120+
"^production",
121+
"{workspaceRoot}/jest.preset.js"
122+
],
99123
"cache": true,
100124
"options": {
101125
"passWithNoTests": true
@@ -109,7 +133,10 @@
109133
},
110134
"@nx/vite:test": {
111135
"cache": true,
112-
"inputs": ["default", "^production"]
136+
"inputs": [
137+
"default",
138+
"^production"
139+
]
113140
}
114141
},
115142
"useDaemonProcess": false,
@@ -119,7 +146,12 @@
119146
"useLegacyCache": true,
120147
"release": {
121148
"releaseTagPattern": "{version}-{projectName}",
122-
"projects": ["packages/*", "!packages/ui-mobile-base", "!packages/types-minimal", "!packages/winter-tc"],
149+
"projects": [
150+
"packages/*",
151+
"!packages/ui-mobile-base",
152+
"!packages/types-minimal",
153+
"!packages/winter-tc"
154+
],
123155
"projectsRelationship": "independent",
124156
"changelog": {
125157
"workspaceChangelog": false,
@@ -131,5 +163,6 @@
131163
}
132164
}
133165
}
134-
}
135-
}
166+
},
167+
"nxCloudId": "680a89d49c76d63ce41eb397"
168+
}

0 commit comments

Comments
 (0)