diff --git a/packages/workspace/src/generators/ci-workflow/__snapshots__/ci-workflow.spec.ts.snap b/packages/workspace/src/generators/ci-workflow/__snapshots__/ci-workflow.spec.ts.snap index 4549aab62cb1f..320446ca304a0 100644 --- a/packages/workspace/src/generators/ci-workflow/__snapshots__/ci-workflow.spec.ts.snap +++ b/packages/workspace/src/generators/ci-workflow/__snapshots__/ci-workflow.spec.ts.snap @@ -24,11 +24,11 @@ jobs: pool: vmImage: 'ubuntu-latest' steps: - - script: npm ci - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested # - script: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - script: npm ci + - script: npx nx-cloud record -- nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA) - script: npx nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) -t=lint,test,build " @@ -49,11 +49,11 @@ pipelines: script: - export NX_BRANCH=$BITBUCKET_PR_ID - - npm ci - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested # - npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - npm ci + - npx nx-cloud record -- nx format:check - npx nx affected -t=lint,test,build " @@ -71,13 +71,14 @@ jobs: - image: cimg/node:lts-browsers steps: - checkout - - run: npm ci - - nx/set-shas: - main-branch-name: 'main' # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested # - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - run: npm ci + - nx/set-shas: + main-branch-name: 'main' + - run: npx nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD - run: npx nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build @@ -110,6 +111,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + # Cache node_modules - uses: actions/setup-node@v3 with: @@ -118,9 +123,6 @@ jobs: - run: npm ci - uses: nrwl/nx-set-shas@v4 - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: npx nx-cloud record -- nx format:check - run: npx nx affected -t=lint,test,build " @@ -146,6 +148,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + # Cache node_modules - uses: actions/setup-node@v3 with: @@ -154,9 +160,6 @@ jobs: - run: npm ci - uses: nrwl/nx-set-shas@v4 - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: npx nx-cloud record -- nx format:check - run: npx nx affected -t=lint,test,build " @@ -174,13 +177,13 @@ CI: - main - merge_requests script: + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - npm ci - NX_HEAD=$CI_COMMIT_SHA - NX_BASE=\${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA} - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - npx nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD - npx nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build " @@ -212,13 +215,13 @@ jobs: pool: vmImage: 'ubuntu-latest' steps: + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - script: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - script: npm install --prefix=$HOME/.local -g pnpm@8 displayName: Install PNPM - script: pnpm install --frozen-lockfile - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - script: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - script: pnpm exec nx-cloud record -- nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA) - script: pnpm exec nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) -t=lint,test,build " @@ -239,13 +242,13 @@ pipelines: script: - export NX_BRANCH=$BITBUCKET_PR_ID + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - npm install --prefix=$HOME/.local -g pnpm@8 - pnpm install --frozen-lockfile - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - pnpm exec nx-cloud record -- nx format:check - pnpm exec nx affected -t=lint,test,build " @@ -264,6 +267,9 @@ jobs: steps: - checkout + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - run: name: Install PNPM command: npm install --prefix=$HOME/.local -g pnpm@8 @@ -271,9 +277,6 @@ jobs: - nx/set-shas: main-branch-name: 'main' - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: pnpm exec nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD - run: pnpm exec nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build @@ -307,6 +310,9 @@ jobs: with: fetch-depth: 0 + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - uses: pnpm/action-setup@v2 with: version: 8 @@ -318,9 +324,6 @@ jobs: - run: pnpm install --frozen-lockfile - uses: nrwl/nx-set-shas@v4 - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: pnpm exec nx-cloud record -- nx format:check - run: pnpm exec nx affected -t=lint,test,build " @@ -347,6 +350,9 @@ jobs: with: fetch-depth: 0 + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - uses: pnpm/action-setup@v2 with: version: 8 @@ -358,9 +364,6 @@ jobs: - run: pnpm install --frozen-lockfile - uses: nrwl/nx-set-shas@v4 - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: pnpm exec nx-cloud record -- nx format:check - run: pnpm exec nx affected -t=lint,test,build " @@ -378,15 +381,15 @@ CI: - main - merge_requests script: + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - npm install --prefix=$HOME/.local -g pnpm@8 - pnpm install --frozen-lockfile - NX_HEAD=$CI_COMMIT_SHA - NX_BASE=\${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA} - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - pnpm exec nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD - pnpm exec nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build " @@ -418,11 +421,11 @@ jobs: pool: vmImage: 'ubuntu-latest' steps: - - script: yarn install --frozen-lockfile - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested # - script: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - script: yarn install --frozen-lockfile + - script: yarn nx-cloud record -- nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA) - script: yarn nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) -t=lint,test,build " @@ -443,11 +446,11 @@ pipelines: script: - export NX_BRANCH=$BITBUCKET_PR_ID - - yarn install --frozen-lockfile - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested # - yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - yarn install --frozen-lockfile + - yarn nx-cloud record -- nx format:check - yarn nx affected -t=lint,test,build " @@ -465,13 +468,14 @@ jobs: - image: cimg/node:lts-browsers steps: - checkout - - run: yarn install --frozen-lockfile - - nx/set-shas: - main-branch-name: 'main' # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested # - run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - run: yarn install --frozen-lockfile + - nx/set-shas: + main-branch-name: 'main' + - run: yarn nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD - run: yarn nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build @@ -504,6 +508,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + # Cache node_modules - uses: actions/setup-node@v3 with: @@ -512,9 +520,6 @@ jobs: - run: yarn install --frozen-lockfile - uses: nrwl/nx-set-shas@v4 - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: yarn nx-cloud record -- nx format:check - run: yarn nx affected -t=lint,test,build " @@ -540,6 +545,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + # Cache node_modules - uses: actions/setup-node@v3 with: @@ -548,9 +557,6 @@ jobs: - run: yarn install --frozen-lockfile - uses: nrwl/nx-set-shas@v4 - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: yarn nx-cloud record -- nx format:check - run: yarn nx affected -t=lint,test,build " @@ -568,13 +574,13 @@ CI: - main - merge_requests script: + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + - yarn install --frozen-lockfile - NX_HEAD=$CI_COMMIT_SHA - NX_BASE=\${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA} - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - yarn nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD - yarn nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build " diff --git a/packages/workspace/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ b/packages/workspace/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ index cb2b10061ac0b..cb273b71acfec 100644 --- a/packages/workspace/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +++ b/packages/workspace/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ @@ -21,13 +21,13 @@ jobs: pool: vmImage: 'ubuntu-latest' steps: + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - script: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + <% if(packageManager == 'pnpm'){ %> - script: npm install --prefix=$HOME/.local -g pnpm@8 displayName: Install PNPM <% } %>- script: <%= packageManagerInstall %> - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - script: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - script: <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA) - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) -t=lint,test,build diff --git a/packages/workspace/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ b/packages/workspace/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ index 19cabe434b4e3..a8f245c626b96 100644 --- a/packages/workspace/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +++ b/packages/workspace/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ @@ -11,13 +11,14 @@ pipelines: name: <%= workflowName %> script: - export NX_BRANCH=$BITBUCKET_PR_ID + + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + <% if(packageManager == 'pnpm'){ %> - npm install --prefix=$HOME/.local -g pnpm@8 <% } %> - <%= packageManagerInstall %> - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - <%= packageManagerPrefix %> nx-cloud record -- nx format:check - <%= packageManagerPrefix %> nx affected -t=lint,test,build diff --git a/packages/workspace/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ b/packages/workspace/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ index e647d901a1673..84177b1334b33 100644 --- a/packages/workspace/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +++ b/packages/workspace/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ @@ -9,6 +9,10 @@ jobs: - image: cimg/node:lts-browsers steps: - checkout + + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + <% if(packageManager == 'pnpm'){ %> - run: name: Install PNPM @@ -17,9 +21,6 @@ jobs: - nx/set-shas: main-branch-name: '<%= mainBranch %>' - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD - run: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build diff --git a/packages/workspace/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ b/packages/workspace/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ index 9d6b478bf73fc..ff533ed094dfb 100644 --- a/packages/workspace/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +++ b/packages/workspace/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ @@ -17,6 +17,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + <% if(packageManager == 'pnpm'){ %> - uses: pnpm/action-setup@v2 with: @@ -29,8 +33,5 @@ jobs: - run: <%= packageManagerInstall %> - uses: nrwl/nx-set-shas@v4 - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - run: <%= packageManagerPrefix %> nx-cloud record -- nx format:check - run: <%= packageManagerPrefix %> nx affected -t=lint,test,build diff --git a/packages/workspace/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ b/packages/workspace/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ index 6ea413f71bc17..edb3787f27146 100644 --- a/packages/workspace/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +++ b/packages/workspace/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ @@ -9,6 +9,9 @@ variables: - main - merge_requests script: + # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested + # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" + <% if(packageManager == 'pnpm'){ %> - npm install --prefix=$HOME/.local -g pnpm@8 <% } %> @@ -16,8 +19,5 @@ variables: - NX_HEAD=$CI_COMMIT_SHA - NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA} - # Uncomment to enable task distribution. --stop-agents-after is optional, but allows idle agents to shut down once the "build" targets have been requested - # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - - <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD - <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t=lint,test,build