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 4955da2ff4a3a..cbd08ccb09841 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 @@ -503,12 +503,13 @@ jobs: echo "##vso[task.setvariable variable=BASE_SHA]$LAST_SHA" fi + - script: npm install --prefix=$HOME/.local -g pnpm@8 + displayName: Install PNPM + # Connect your workspace on my.nx.app and uncomment this to enable task distribution. # The "--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 - script: git branch --track main origin/main condition: eq(variables['Build.Reason'], 'PullRequest') @@ -532,12 +533,12 @@ pipelines: script: - export NX_BRANCH=$BITBUCKET_PR_ID + - npm install --prefix=$HOME/.local -g pnpm@8 + # Connect your workspace on my.nx.app and uncomment this to enable task distribution. # The "--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 - pnpm exec nx-cloud record -- nx format:check @@ -575,13 +576,14 @@ jobs: steps: - checkout + - run: + name: Install PNPM + command: npm install --prefix=$HOME/.local -g pnpm@8 + # Connect your workspace on my.nx.app and uncomment this to enable task distribution. # The "--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 - run: pnpm install --frozen-lockfile - nx/set-shas: main-branch-name: 'main' @@ -623,13 +625,14 @@ jobs: with: fetch-depth: 0 + - uses: pnpm/action-setup@v2 + with: + version: 8 + # Connect your workspace on my.nx.app and uncomment this to enable task distribution. # The "--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 # Cache node_modules - uses: actions/setup-node@v3 with: @@ -667,13 +670,14 @@ jobs: with: fetch-depth: 0 + - uses: pnpm/action-setup@v2 + with: + version: 8 + # Connect your workspace on my.nx.app and uncomment this to enable task distribution. # The "--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 # Cache node_modules - uses: actions/setup-node@v3 with: @@ -702,12 +706,12 @@ CI: - main - merge_requests script: + - npm install --prefix=$HOME/.local -g pnpm@8 + # Connect your workspace on my.nx.app and uncomment this to enable task distribution. # The "--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} 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 0731b4e238496..a198599c570bc 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__ @@ -41,14 +41,16 @@ jobs: echo "##vso[task.setvariable variable=BASE_SHA]$LAST_SHA" fi + <% if(packageManager == 'pnpm'){ %> + - script: npm install --prefix=$HOME/.local -g pnpm@8 + displayName: Install PNPM + + <% } %> # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution. # The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested # - script: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" - <% if(packageManager == 'pnpm'){ %> - - script: npm install --prefix=$HOME/.local -g pnpm@8 - displayName: Install PNPM - <% } %>- script: <%= packageManagerInstall %> + - script: <%= packageManagerInstall %> - script: git branch --track main origin/main condition: eq(variables['Build.Reason'], 'PullRequest') 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 32e9449d79156..0fb2e3a6e31f9 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: script: - export NX_BRANCH=$BITBUCKET_PR_ID + <% if(packageManager == 'pnpm'){ %> + - npm install --prefix=$HOME/.local -g pnpm@8 + + <% } %> # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution. # The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" - <% if(packageManager == 'pnpm'){ %> - - npm install --prefix=$HOME/.local -g pnpm@8 - <% } %> - <%= packageManagerInstall %> - <%= packageManagerPrefix %> nx-cloud record -- nx format:check 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 b93b5c1c31c60..d298e41a69682 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,16 +9,17 @@ jobs: - image: cimg/node:lts-browsers steps: - checkout + <% if(packageManager == 'pnpm'){ %> + - run: + name: Install PNPM + command: npm install --prefix=$HOME/.local -g pnpm@8 + <% } %> # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution. # The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" - <% if(packageManager == 'pnpm'){ %> - - run: - name: Install PNPM - command: npm install --prefix=$HOME/.local -g pnpm@8 - <% } %>- run: <%= packageManagerInstall %> + - run: <%= packageManagerInstall %> - nx/set-shas: main-branch-name: '<%= mainBranch %>' 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 2a278defd8641..b7ae0118de5a3 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,16 +17,17 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + <% if(packageManager == 'pnpm'){ %> + - uses: pnpm/action-setup@v2 + with: + version: 8 + <% } %> # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution. # The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" - <% if(packageManager == 'pnpm'){ %> - - uses: pnpm/action-setup@v2 - with: - version: 8 - <% } %># Cache node_modules + # Cache node_modules - uses: actions/setup-node@v3 with: node-version: 20 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 bedc0d0e53a47..e8f3f886ac050 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,13 +9,13 @@ variables: - main - merge_requests script: + <% if(packageManager == 'pnpm'){ %> + - npm install --prefix=$HOME/.local -g pnpm@8 + <% } %> # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution. # The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" - <% if(packageManager == 'pnpm'){ %> - - npm install --prefix=$HOME/.local -g pnpm@8 - <% } %> - <%= packageManagerInstall %> - NX_HEAD=$CI_COMMIT_SHA - NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}