@nx/workspace 17.3.0-canary.20240118-8ccf327 → 17.3.0-canary.20240119-b5ffb85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/generators/ci-workflow/ci-workflow.js +3 -1
- package/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +6 -33
- package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +7 -22
- package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +9 -53
- package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +21 -19
- package/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +10 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/workspace",
|
|
3
|
-
"version": "17.3.0-canary.
|
|
3
|
+
"version": "17.3.0-canary.20240119-b5ffb85",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
|
|
6
6
|
"repository": {
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@nx/devkit": "17.3.0-canary.
|
|
64
|
+
"@nx/devkit": "17.3.0-canary.20240119-b5ffb85",
|
|
65
65
|
"chalk": "^4.1.0",
|
|
66
66
|
"enquirer": "~2.3.6",
|
|
67
67
|
"tslib": "^2.3.0",
|
|
68
68
|
"yargs-parser": "21.1.1",
|
|
69
|
-
"nx": "17.3.0-canary.
|
|
70
|
-
"@nrwl/workspace": "17.3.0-canary.
|
|
69
|
+
"nx": "17.3.0-canary.20240119-b5ffb85",
|
|
70
|
+
"@nrwl/workspace": "17.3.0-canary.20240119-b5ffb85"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
@@ -22,10 +22,12 @@ async function ciWorkflowGenerator(host, schema) {
|
|
|
22
22
|
exports.ciWorkflowGenerator = ciWorkflowGenerator;
|
|
23
23
|
function normalizeOptions(options) {
|
|
24
24
|
const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name);
|
|
25
|
-
const
|
|
25
|
+
const packageManager = (0, devkit_1.detectPackageManager)();
|
|
26
|
+
const { exec: packageManagerPrefix, ciInstall: packageManagerInstall } = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
26
27
|
return {
|
|
27
28
|
workflowName,
|
|
28
29
|
workflowFileName,
|
|
30
|
+
packageManager,
|
|
29
31
|
packageManagerInstall,
|
|
30
32
|
packageManagerPrefix,
|
|
31
33
|
mainBranch: (0, default_base_1.deduceDefaultBase)(),
|
|
@@ -7,7 +7,6 @@ pr:
|
|
|
7
7
|
|
|
8
8
|
variables:
|
|
9
9
|
CI: 'true'
|
|
10
|
-
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
|
|
11
10
|
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
|
|
12
11
|
NX_BRANCH: $(System.PullRequest.PullRequestNumber)
|
|
13
12
|
TARGET_BRANCH: $[replace(variables['System.PullRequest.TargetBranch'],'refs/heads/','origin/')]
|
|
@@ -18,41 +17,15 @@ variables:
|
|
|
18
17
|
HEAD_SHA: $(git rev-parse HEAD)
|
|
19
18
|
|
|
20
19
|
jobs:
|
|
21
|
-
- job: agents
|
|
22
|
-
strategy:
|
|
23
|
-
parallel: 3
|
|
24
|
-
displayName: Nx Cloud Agent
|
|
25
|
-
pool:
|
|
26
|
-
vmImage: 'ubuntu-latest'
|
|
27
|
-
steps:
|
|
28
|
-
<% if(packageManagerPrefix == 'pnpm exec'){ %>
|
|
29
|
-
- script: npm install --prefix=$HOME/.local -g pnpm@8.2.0
|
|
30
|
-
displayName: Install PNPM
|
|
31
|
-
<% } %>- script: <%= packageManagerInstall %>
|
|
32
|
-
displayName: NPM Install Dependencies
|
|
33
|
-
- script: npx nx-cloud start-agent
|
|
34
|
-
displayName: Start Nx-Cloud agent
|
|
35
|
-
|
|
36
20
|
- job: main
|
|
37
|
-
displayName: Nx Cloud Main
|
|
38
21
|
pool:
|
|
39
22
|
vmImage: 'ubuntu-latest'
|
|
40
23
|
steps:
|
|
41
|
-
<% if(
|
|
42
|
-
- script: npm install --prefix=$HOME/.local -g pnpm@8
|
|
24
|
+
<% if(packageManager == 'pnpm'){ %>
|
|
25
|
+
- script: npm install --prefix=$HOME/.local -g pnpm@8
|
|
43
26
|
displayName: Install PNPM
|
|
44
27
|
<% } %>- script: <%= packageManagerInstall %>
|
|
45
|
-
|
|
46
|
-
- script: <%= packageManagerPrefix %> nx-cloud start-ci-run --
|
|
47
|
-
|
|
48
|
-
- script: <%= packageManagerPrefix %> nx
|
|
49
|
-
displayName: Check format
|
|
50
|
-
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=lint --parallel=3
|
|
51
|
-
displayName: Run lint
|
|
52
|
-
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=test --parallel=3 --ci --code-coverage
|
|
53
|
-
displayName: Run test
|
|
54
|
-
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=build --parallel=3
|
|
55
|
-
displayName: Run build
|
|
56
|
-
- script: <%= packageManagerPrefix %> nx-cloud stop-all-agents
|
|
57
|
-
condition: always()
|
|
58
|
-
displayName: Stop all Nx-Cloud agents
|
|
28
|
+
# uncomment to enable task distribution
|
|
29
|
+
# - script: <%= packageManagerPrefix %> nx-cloud start-ci-run --distributes-on="5 linux-medium"
|
|
30
|
+
- script: <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA)
|
|
31
|
+
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) -t=lint,test,build --parallel=3
|
package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
image: node:
|
|
1
|
+
image: node:20
|
|
2
2
|
|
|
3
3
|
clone:
|
|
4
4
|
depth: full
|
|
5
5
|
|
|
6
|
-
definitions:
|
|
7
|
-
steps:
|
|
8
|
-
- step: &agent
|
|
9
|
-
name: Agent
|
|
10
|
-
script:
|
|
11
|
-
- export NX_BRANCH=$BITBUCKET_PR_ID
|
|
12
|
-
<% if(packageManagerPrefix == 'pnpm exec'){ %>
|
|
13
|
-
- npm install --prefix=$HOME/.local -g pnpm@8.2.0
|
|
14
|
-
<% } %>
|
|
15
|
-
- <%= packageManagerInstall %>
|
|
16
|
-
- <%= packageManagerPrefix %> nx-cloud start-agent
|
|
17
|
-
|
|
18
6
|
pipelines:
|
|
19
7
|
pull-requests:
|
|
20
8
|
'**':
|
|
@@ -23,14 +11,11 @@ pipelines:
|
|
|
23
11
|
name: <%= workflowName %>
|
|
24
12
|
script:
|
|
25
13
|
- export NX_BRANCH=$BITBUCKET_PR_ID
|
|
26
|
-
<% if(
|
|
27
|
-
- npm install --prefix=$HOME/.local -g pnpm@8
|
|
14
|
+
<% if(packageManager == 'pnpm'){ %>
|
|
15
|
+
- npm install --prefix=$HOME/.local -g pnpm@8
|
|
28
16
|
<% } %>
|
|
29
17
|
- <%= packageManagerInstall %>
|
|
30
|
-
|
|
31
|
-
- <%= packageManagerPrefix %> nx-cloud
|
|
32
|
-
- <%= packageManagerPrefix %> nx
|
|
33
|
-
- <%= packageManagerPrefix %> nx-
|
|
34
|
-
- step: *agent
|
|
35
|
-
- step: *agent
|
|
36
|
-
- step: *agent
|
|
18
|
+
# uncomment to enable task distribution
|
|
19
|
+
# - <%= packageManagerPrefix %> nx-cloud start-ci-run --distributes-on="5 linux-medium"
|
|
20
|
+
- <%= packageManagerPrefix %> nx-cloud record -- nx format:check
|
|
21
|
+
- <%= packageManagerPrefix %> nx affected -t=lint,test,build --parallel=3
|
|
@@ -1,73 +1,29 @@
|
|
|
1
1
|
version: 2.1
|
|
2
2
|
|
|
3
3
|
orbs:
|
|
4
|
-
nx: nrwl/nx@1.6.
|
|
4
|
+
nx: nrwl/nx@1.6.2
|
|
5
5
|
|
|
6
6
|
jobs:
|
|
7
|
-
agent:
|
|
8
|
-
docker:
|
|
9
|
-
- image: cimg/node:lts-browsers
|
|
10
|
-
parameters:
|
|
11
|
-
ordinal:
|
|
12
|
-
type: integer
|
|
13
|
-
steps:
|
|
14
|
-
- checkout
|
|
15
|
-
<% if(packageManagerPrefix == 'pnpm exec'){ %>
|
|
16
|
-
- run:
|
|
17
|
-
name: Install PNPM
|
|
18
|
-
command: npm install --prefix=$HOME/.local -g pnpm@8.2.0
|
|
19
|
-
<% } %>- run:
|
|
20
|
-
name: Install dependencies
|
|
21
|
-
command: <%= packageManagerInstall %>
|
|
22
|
-
- run:
|
|
23
|
-
name: Start the agent << parameters.ordinal >>
|
|
24
|
-
command: <%= packageManagerPrefix %> nx-cloud start-agent
|
|
25
|
-
no_output_timeout: 60m
|
|
26
7
|
main:
|
|
27
8
|
docker:
|
|
28
9
|
- image: cimg/node:lts-browsers
|
|
29
|
-
environment:
|
|
30
|
-
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
|
|
31
10
|
steps:
|
|
32
11
|
- checkout
|
|
33
|
-
<% if(
|
|
12
|
+
<% if(packageManager == 'pnpm'){ %>
|
|
34
13
|
- run:
|
|
35
14
|
name: Install PNPM
|
|
36
|
-
command: npm install --prefix=$HOME/.local -g pnpm@8
|
|
37
|
-
<% } %>- run:
|
|
38
|
-
name: Install dependencies
|
|
39
|
-
command: <%= packageManagerInstall %>
|
|
15
|
+
command: npm install --prefix=$HOME/.local -g pnpm@8
|
|
16
|
+
<% } %>- run: <%= packageManagerInstall %>
|
|
40
17
|
- nx/set-shas:
|
|
41
18
|
main-branch-name: '<%= mainBranch %>'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- run:
|
|
46
|
-
name: Check format
|
|
47
|
-
command: <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check --base=$NX_BASE --head=$NX_HEAD
|
|
48
|
-
- run:
|
|
49
|
-
name: Run lint
|
|
50
|
-
command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=lint --parallel=3
|
|
51
|
-
- run:
|
|
52
|
-
name: Run test
|
|
53
|
-
command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=test --parallel=3 --ci --code-coverage
|
|
54
|
-
- run:
|
|
55
|
-
name: Run build
|
|
56
|
-
command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=build --parallel=3
|
|
57
|
-
- run:
|
|
58
|
-
name: Stop all agents
|
|
59
|
-
command: <%= packageManagerPrefix %> nx-cloud stop-all-agents
|
|
60
|
-
when: always
|
|
19
|
+
# uncomment to enable task distribution
|
|
20
|
+
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distributes-on="5 linux-medium"
|
|
21
|
+
- run: <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD
|
|
22
|
+
- run: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build --parallel=3
|
|
61
23
|
|
|
62
24
|
workflows:
|
|
63
25
|
version: 2
|
|
64
26
|
|
|
65
27
|
<%= workflowFileName %>:
|
|
66
28
|
jobs:
|
|
67
|
-
-
|
|
68
|
-
name: Nx Cloud Agent << matrix.ordinal >>
|
|
69
|
-
matrix:
|
|
70
|
-
parameters:
|
|
71
|
-
ordinal: [1, 2, 3]
|
|
72
|
-
- main:
|
|
73
|
-
name: Nx Cloud Main
|
|
29
|
+
- main
|
package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__
CHANGED
|
@@ -6,29 +6,31 @@ on:
|
|
|
6
6
|
- <%= mainBranch %>
|
|
7
7
|
pull_request:
|
|
8
8
|
|
|
9
|
-
# Needed for nx-set-shas within nx-cloud-main.yml, when run on the <%= mainBranch %> branch
|
|
10
9
|
permissions:
|
|
11
10
|
actions: read
|
|
12
11
|
contents: read
|
|
13
12
|
|
|
14
13
|
jobs:
|
|
15
14
|
main:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
<% if(packageManager == 'pnpm'){ %>
|
|
21
|
+
- uses: pnpm/action-setup@v2
|
|
22
|
+
with:
|
|
23
|
+
version: 8
|
|
24
|
+
<% } %># Cache node_modules
|
|
25
|
+
- uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version: 20
|
|
28
|
+
cache: '<%= packageManager %>'
|
|
29
|
+
- run: <%= packageManagerInstall %>
|
|
30
|
+
- uses: nrwl/nx-set-shas@v4
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
# uncomment to enable task distribution
|
|
33
|
+
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distributes-on="5 linux-medium"
|
|
34
|
+
|
|
35
|
+
- run: <%= packageManagerPrefix %> nx-cloud record -- nx format:check
|
|
36
|
+
- run: <%= packageManagerPrefix %> nx affected -t=lint,test,build --parallel=3
|
|
@@ -1,47 +1,21 @@
|
|
|
1
|
-
image: node:
|
|
1
|
+
image: node:20
|
|
2
2
|
variables:
|
|
3
3
|
CI: 'true'
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
interruptible: true
|
|
8
|
-
script:
|
|
9
|
-
<% if(packageManagerPrefix == 'pnpm exec'){ %>
|
|
10
|
-
- npm install --prefix=$HOME/.local -g pnpm@8.2.0
|
|
11
|
-
<% } %>
|
|
12
|
-
- <%= packageManagerInstall %>
|
|
13
|
-
- <%= packageManagerPrefix %> nx-cloud start-agent
|
|
14
|
-
|
|
15
|
-
# Creating template for a job running DTE (orchestrator)
|
|
16
|
-
.base-pipeline:
|
|
5
|
+
# Main job
|
|
6
|
+
<%= workflowName %>:
|
|
17
7
|
interruptible: true
|
|
18
8
|
only:
|
|
19
9
|
- main
|
|
20
10
|
- merge_requests
|
|
21
|
-
|
|
22
|
-
<% if(
|
|
23
|
-
- npm install --prefix=$HOME/.local -g pnpm@8
|
|
11
|
+
script:
|
|
12
|
+
<% if(packageManager == 'pnpm'){ %>
|
|
13
|
+
- npm install --prefix=$HOME/.local -g pnpm@8
|
|
24
14
|
<% } %>
|
|
25
15
|
- <%= packageManagerInstall %>
|
|
26
16
|
- NX_HEAD=$CI_COMMIT_SHA
|
|
27
17
|
- NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
<%=
|
|
31
|
-
|
|
32
|
-
extends: .base-pipeline
|
|
33
|
-
script:
|
|
34
|
-
- <%= packageManagerPrefix %> nx-cloud start-ci-run --stop-agents-after="build"
|
|
35
|
-
- <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check --base=$NX_BASE --head=$NX_HEAD
|
|
36
|
-
- <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=lint --parallel=3 & <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=test --parallel=3 --ci --code-coverage & <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=e2e --parallel=3 --ci --code-coverage & <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=build --parallel=3
|
|
37
|
-
|
|
38
|
-
# Create as many agents as you want
|
|
39
|
-
nx-dte-agent1:
|
|
40
|
-
extends: .dte-agent
|
|
41
|
-
stage: affected
|
|
42
|
-
nx-dte-agent2:
|
|
43
|
-
extends: .dte-agent
|
|
44
|
-
stage: affected
|
|
45
|
-
nx-dte-agent3:
|
|
46
|
-
extends: .dte-agent
|
|
47
|
-
stage: affected
|
|
18
|
+
# uncomment to enable task distribution
|
|
19
|
+
# - <%= packageManagerPrefix %> nx-cloud start-ci-run --distributes-on="5 linux-medium"
|
|
20
|
+
- <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD
|
|
21
|
+
- <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build --parallel=3
|