feat(core): uncomment start-ci-run (#26645)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
8fd38cba9a
commit
2b7b5231fb
@ -17,9 +17,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
||||||
|
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
main-branch-name: 'main'
|
main-branch-name: 'main'
|
||||||
@ -56,9 +57,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
||||||
|
|
||||||
- name: Set up JDK 17 for x64
|
- name: Set up JDK 17 for x64
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
|
|||||||
@ -14,10 +14,13 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
|
||||||
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
<% if (connectedToCloud) { %>- run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
||||||
|
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
||||||
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
||||||
|
<% } %>
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
main-branch-name: '<%= mainBranch %>'
|
main-branch-name: '<%= mainBranch %>'
|
||||||
|
|
||||||
|
|||||||
@ -18,9 +18,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
<% if (connectedToCloud) { %>- run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
||||||
|
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
||||||
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
# - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-jvm" --stop-agents-after="build"
|
||||||
|
<% } %>
|
||||||
|
|
||||||
- name: Set up JDK 17 for x64
|
- name: Set up JDK 17 for x64
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
import { Tree } from '@nx/devkit';
|
import { readNxJson, Tree, updateNxJson } from '@nx/devkit';
|
||||||
|
|
||||||
import { ciWorkflowGenerator } from './generator';
|
import { ciWorkflowGenerator } from './generator';
|
||||||
|
|
||||||
@ -8,6 +8,9 @@ describe('ci-workflow generator', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
tree = createTreeWithEmptyWorkspace();
|
tree = createTreeWithEmptyWorkspace();
|
||||||
|
const nxJson = readNxJson(tree);
|
||||||
|
nxJson.nxCloudAccessToken = 'test';
|
||||||
|
updateNxJson(tree, nxJson);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.each([
|
describe.each([
|
||||||
|
|||||||
@ -3,11 +3,9 @@ import {
|
|||||||
names,
|
names,
|
||||||
generateFiles,
|
generateFiles,
|
||||||
getPackageManagerCommand,
|
getPackageManagerCommand,
|
||||||
NxJsonConfiguration,
|
|
||||||
formatFiles,
|
formatFiles,
|
||||||
detectPackageManager,
|
detectPackageManager,
|
||||||
readNxJson,
|
readNxJson,
|
||||||
readJson,
|
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { getNxCloudUrl, isNxCloudUsed } from 'nx/src/utils/nx-cloud-utils';
|
import { getNxCloudUrl, isNxCloudUsed } from 'nx/src/utils/nx-cloud-utils';
|
||||||
@ -47,6 +45,7 @@ interface Substitutes {
|
|||||||
packageManagerPrefix: string;
|
packageManagerPrefix: string;
|
||||||
commands: string[];
|
commands: string[];
|
||||||
nxCloudHost: string;
|
nxCloudHost: string;
|
||||||
|
connectedToCloud: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTemplateData(tree: Tree, options: Schema): Substitutes {
|
function getTemplateData(tree: Tree, options: Schema): Substitutes {
|
||||||
@ -59,7 +58,7 @@ function getTemplateData(tree: Tree, options: Schema): Substitutes {
|
|||||||
|
|
||||||
let nxCloudHost: string = 'nx.app';
|
let nxCloudHost: string = 'nx.app';
|
||||||
try {
|
try {
|
||||||
const nxCloudUrl = getNxCloudUrl(readJson(tree, 'nx.json'));
|
const nxCloudUrl = getNxCloudUrl(readNxJson(tree));
|
||||||
nxCloudHost = new URL(nxCloudUrl).host;
|
nxCloudHost = new URL(nxCloudUrl).host;
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
@ -67,6 +66,8 @@ function getTemplateData(tree: Tree, options: Schema): Substitutes {
|
|||||||
|
|
||||||
const commands = options.commands ?? getCiCommands(options.ci, mainBranch);
|
const commands = options.commands ?? getCiCommands(options.ci, mainBranch);
|
||||||
|
|
||||||
|
const connectedToCloud = isNxCloudUsed(readNxJson(tree));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
workflowName,
|
workflowName,
|
||||||
workflowFileName,
|
workflowFileName,
|
||||||
@ -75,6 +76,7 @@ function getTemplateData(tree: Tree, options: Schema): Substitutes {
|
|||||||
commands,
|
commands,
|
||||||
mainBranch,
|
mainBranch,
|
||||||
nxCloudHost,
|
nxCloudHost,
|
||||||
|
connectedToCloud,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { NxJsonConfiguration, readNxJson } from '../config/nx-json';
|
import { NxJsonConfiguration } from '../config/nx-json';
|
||||||
|
|
||||||
export function isNxCloudUsed(nxJson: NxJsonConfiguration): boolean {
|
export function isNxCloudUsed(nxJson: NxJsonConfiguration): boolean {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -44,9 +44,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
|
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - script: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- script: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
||||||
|
|
||||||
- script: npm ci
|
- script: npm ci
|
||||||
- script: git branch --track main origin/main
|
- script: git branch --track main origin/main
|
||||||
@ -73,9 +74,10 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_PR_ID
|
- export NX_BRANCH=$BITBUCKET_PR_ID
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
||||||
|
|
||||||
- npm ci
|
- npm ci
|
||||||
|
|
||||||
@ -89,9 +91,10 @@ pipelines:
|
|||||||
name: 'Build and test affected apps on "main" branch changes'
|
name: 'Build and test affected apps on "main" branch changes'
|
||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_BRANCH
|
- export NX_BRANCH=$BITBUCKET_BRANCH
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
||||||
|
|
||||||
- npm ci
|
- npm ci
|
||||||
|
|
||||||
@ -114,9 +117,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
@ -157,9 +161,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
||||||
|
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -198,9 +203,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
|
||||||
|
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -265,9 +271,10 @@ jobs:
|
|||||||
- script: npm install --prefix=$HOME/.local -g Bun
|
- script: npm install --prefix=$HOME/.local -g Bun
|
||||||
displayName: Install Bun
|
displayName: Install Bun
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - script: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- script: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- script: bun install --no-cache
|
- script: bun install --no-cache
|
||||||
- script: git branch --track main origin/main
|
- script: git branch --track main origin/main
|
||||||
@ -295,9 +302,10 @@ pipelines:
|
|||||||
|
|
||||||
- npm install --prefix=$HOME/.local -g bun
|
- npm install --prefix=$HOME/.local -g bun
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- bun install --no-cache
|
- bun install --no-cache
|
||||||
|
|
||||||
@ -310,9 +318,10 @@ pipelines:
|
|||||||
name: 'Build and test affected apps on "main" branch changes'
|
name: 'Build and test affected apps on "main" branch changes'
|
||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_BRANCH
|
- export NX_BRANCH=$BITBUCKET_BRANCH
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- npm install --prefix=$HOME/.local -g bun
|
- npm install --prefix=$HOME/.local -g bun
|
||||||
|
|
||||||
@ -341,9 +350,10 @@ jobs:
|
|||||||
name: Install Bun
|
name: Install Bun
|
||||||
command: npm install --prefix=$HOME/.local -g bun
|
command: npm install --prefix=$HOME/.local -g bun
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- run: bun install --no-cache
|
- run: bun install --no-cache
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
@ -387,9 +397,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- run: bun install --no-cache
|
- run: bun install --no-cache
|
||||||
- uses: nrwl/nx-set-shas@v4
|
- uses: nrwl/nx-set-shas@v4
|
||||||
@ -425,9 +436,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- run: bun install --no-cache
|
- run: bun install --no-cache
|
||||||
- uses: nrwl/nx-set-shas@v4
|
- uses: nrwl/nx-set-shas@v4
|
||||||
@ -452,9 +464,10 @@ CI:
|
|||||||
script:
|
script:
|
||||||
- npm install --prefix=$HOME/.local -g bun
|
- npm install --prefix=$HOME/.local -g bun
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- bunx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- bun install --no-cache
|
- bun install --no-cache
|
||||||
- NX_HEAD=$CI_COMMIT_SHA
|
- NX_HEAD=$CI_COMMIT_SHA
|
||||||
@ -510,9 +523,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
|
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - script: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- script: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- script: npm ci
|
- script: npm ci
|
||||||
- script: git branch --track main origin/main
|
- script: git branch --track main origin/main
|
||||||
@ -538,9 +552,10 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_PR_ID
|
- export NX_BRANCH=$BITBUCKET_PR_ID
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- npm ci
|
- npm ci
|
||||||
|
|
||||||
@ -553,9 +568,10 @@ pipelines:
|
|||||||
name: 'Build and test affected apps on "main" branch changes'
|
name: 'Build and test affected apps on "main" branch changes'
|
||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_BRANCH
|
- export NX_BRANCH=$BITBUCKET_BRANCH
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- npm ci
|
- npm ci
|
||||||
|
|
||||||
@ -578,9 +594,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
@ -620,9 +637,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -660,9 +678,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -691,9 +710,10 @@ CI:
|
|||||||
- main
|
- main
|
||||||
- merge_requests
|
- merge_requests
|
||||||
script:
|
script:
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- npm ci
|
- npm ci
|
||||||
- NX_HEAD=$CI_COMMIT_SHA
|
- NX_HEAD=$CI_COMMIT_SHA
|
||||||
@ -752,9 +772,10 @@ jobs:
|
|||||||
- script: npm install --prefix=$HOME/.local -g pnpm@8
|
- script: npm install --prefix=$HOME/.local -g pnpm@8
|
||||||
displayName: Install PNPM
|
displayName: Install PNPM
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - script: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- script: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- script: pnpm install --frozen-lockfile
|
- script: pnpm install --frozen-lockfile
|
||||||
- script: git branch --track main origin/main
|
- script: git branch --track main origin/main
|
||||||
@ -782,9 +803,10 @@ pipelines:
|
|||||||
|
|
||||||
- npm install --prefix=$HOME/.local -g pnpm@8
|
- npm install --prefix=$HOME/.local -g pnpm@8
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- pnpm install --frozen-lockfile
|
- pnpm install --frozen-lockfile
|
||||||
|
|
||||||
@ -797,9 +819,10 @@ pipelines:
|
|||||||
name: 'Build and test affected apps on "main" branch changes'
|
name: 'Build and test affected apps on "main" branch changes'
|
||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_BRANCH
|
- export NX_BRANCH=$BITBUCKET_BRANCH
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- npm install --prefix=$HOME/.local -g pnpm@8
|
- npm install --prefix=$HOME/.local -g pnpm@8
|
||||||
|
|
||||||
@ -828,9 +851,10 @@ jobs:
|
|||||||
name: Install PNPM
|
name: Install PNPM
|
||||||
command: npm install --prefix=$HOME/.local -g pnpm@8
|
command: npm install --prefix=$HOME/.local -g pnpm@8
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
@ -874,9 +898,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: 8
|
version: 8
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -918,9 +943,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: 8
|
version: 8
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -951,9 +977,10 @@ CI:
|
|||||||
script:
|
script:
|
||||||
- npm install --prefix=$HOME/.local -g pnpm@8
|
- npm install --prefix=$HOME/.local -g pnpm@8
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- pnpm install --frozen-lockfile
|
- pnpm install --frozen-lockfile
|
||||||
- NX_HEAD=$CI_COMMIT_SHA
|
- NX_HEAD=$CI_COMMIT_SHA
|
||||||
@ -1009,9 +1036,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
|
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - script: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- script: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- script: yarn install --frozen-lockfile
|
- script: yarn install --frozen-lockfile
|
||||||
- script: git branch --track main origin/main
|
- script: git branch --track main origin/main
|
||||||
@ -1037,9 +1065,10 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_PR_ID
|
- export NX_BRANCH=$BITBUCKET_PR_ID
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- yarn install --frozen-lockfile
|
- yarn install --frozen-lockfile
|
||||||
|
|
||||||
@ -1052,9 +1081,10 @@ pipelines:
|
|||||||
name: 'Build and test affected apps on "main" branch changes'
|
name: 'Build and test affected apps on "main" branch changes'
|
||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_BRANCH
|
- export NX_BRANCH=$BITBUCKET_BRANCH
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- yarn install --frozen-lockfile
|
- yarn install --frozen-lockfile
|
||||||
|
|
||||||
@ -1077,9 +1107,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
@ -1119,9 +1150,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -1159,9 +1191,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- run: yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -1190,9 +1223,10 @@ CI:
|
|||||||
- main
|
- main
|
||||||
- merge_requests
|
- merge_requests
|
||||||
script:
|
script:
|
||||||
# Connect your workspace on nx.app and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
|
# Run this command as early as possible, before dependencies are installed
|
||||||
# - yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
- yarn nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"
|
||||||
|
|
||||||
- yarn install --frozen-lockfile
|
- yarn install --frozen-lockfile
|
||||||
- NX_HEAD=$CI_COMMIT_SHA
|
- NX_HEAD=$CI_COMMIT_SHA
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import {
|
|||||||
readNxJson,
|
readNxJson,
|
||||||
Tree,
|
Tree,
|
||||||
updateJson,
|
updateJson,
|
||||||
|
updateNxJson,
|
||||||
writeJson,
|
writeJson,
|
||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||||
@ -34,6 +35,9 @@ describe('CI Workflow generator', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
|
const nxJson = readNxJson(tree);
|
||||||
|
nxJson.nxCloudAccessToken = 'test';
|
||||||
|
updateNxJson(tree, nxJson);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import {
|
|||||||
} from '@nx/devkit';
|
} from '@nx/devkit';
|
||||||
import { deduceDefaultBase } from '../../utilities/default-base';
|
import { deduceDefaultBase } from '../../utilities/default-base';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { getNxCloudUrl } from 'nx/src/utils/nx-cloud-utils';
|
import { getNxCloudUrl, isNxCloudUsed } from 'nx/src/utils/nx-cloud-utils';
|
||||||
|
|
||||||
export interface Schema {
|
export interface Schema {
|
||||||
name: string;
|
name: string;
|
||||||
@ -42,6 +42,7 @@ interface Substitutes {
|
|||||||
nxCloudHost: string;
|
nxCloudHost: string;
|
||||||
hasE2E: boolean;
|
hasE2E: boolean;
|
||||||
tmpl: '';
|
tmpl: '';
|
||||||
|
connectedToCloud: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeOptions(options: Schema, tree: Tree): Substitutes {
|
function normalizeOptions(options: Schema, tree: Tree): Substitutes {
|
||||||
@ -70,6 +71,8 @@ function normalizeOptions(options: Schema, tree: Tree): Substitutes {
|
|||||||
const hasE2E =
|
const hasE2E =
|
||||||
allDependencies['@nx/cypress'] || allDependencies['@nx/playwright'];
|
allDependencies['@nx/cypress'] || allDependencies['@nx/playwright'];
|
||||||
|
|
||||||
|
const connectedToCloud = isNxCloudUsed(readJson(tree, 'nx.json'));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
workflowName,
|
workflowName,
|
||||||
workflowFileName,
|
workflowFileName,
|
||||||
@ -81,6 +84,7 @@ function normalizeOptions(options: Schema, tree: Tree): Substitutes {
|
|||||||
hasE2E,
|
hasE2E,
|
||||||
nxCloudHost,
|
nxCloudHost,
|
||||||
tmpl: '',
|
tmpl: '',
|
||||||
|
connectedToCloud,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,10 +51,14 @@ jobs:
|
|||||||
displayName: Install Bun
|
displayName: Install Bun
|
||||||
|
|
||||||
<% } %>
|
<% } %>
|
||||||
# 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: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
||||||
|
|
||||||
|
# This enables task distribution via Nx Cloud
|
||||||
|
# Run this command as early as possible, before dependencies are installed
|
||||||
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
<% if (connectedToCloud) { %>- script: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
||||||
|
# - script: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } %>
|
||||||
- script: <%= packageManagerInstall %>
|
- script: <%= packageManagerInstall %>
|
||||||
- script: git branch --track <%= mainBranch %> origin/<%= mainBranch %>
|
- script: git branch --track <%= mainBranch %> origin/<%= mainBranch %>
|
||||||
condition: eq(variables['Build.Reason'], 'PullRequest')
|
condition: eq(variables['Build.Reason'], 'PullRequest')
|
||||||
|
|||||||
@ -19,10 +19,13 @@ pipelines:
|
|||||||
- npm install --prefix=$HOME/.local -g bun
|
- npm install --prefix=$HOME/.local -g bun
|
||||||
|
|
||||||
<% } %>
|
<% } %>
|
||||||
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# 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 this command as early as possible, before dependencies are installed
|
||||||
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
<% if (connectedToCloud) { %>- <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
||||||
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } %>
|
||||||
- <%= packageManagerInstall %>
|
- <%= packageManagerInstall %>
|
||||||
|
|
||||||
- <%= packageManagerPrefix %> nx-cloud record -- nx format:check
|
- <%= packageManagerPrefix %> nx-cloud record -- nx format:check
|
||||||
@ -35,10 +38,13 @@ pipelines:
|
|||||||
name: 'Build and test affected apps on "<%= mainBranch %>" branch changes'
|
name: 'Build and test affected apps on "<%= mainBranch %>" branch changes'
|
||||||
script:
|
script:
|
||||||
- export NX_BRANCH=$BITBUCKET_BRANCH
|
- export NX_BRANCH=$BITBUCKET_BRANCH
|
||||||
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# 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 this command as early as possible, before dependencies are installed
|
||||||
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
<% if (connectedToCloud) { %>- <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
||||||
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } %>
|
||||||
<% if(packageManager == 'pnpm'){ %>
|
<% if(packageManager == 'pnpm'){ %>
|
||||||
- npm install --prefix=$HOME/.local -g pnpm@8
|
- npm install --prefix=$HOME/.local -g pnpm@8
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|||||||
@ -21,10 +21,13 @@ jobs:
|
|||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|
||||||
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# 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 this command as early as possible, before dependencies are installed
|
||||||
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
<% if (connectedToCloud) { %>- run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
||||||
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } %>
|
||||||
- run: <%= packageManagerInstall %>
|
- run: <%= packageManagerInstall %>
|
||||||
- nx/set-shas:
|
- nx/set-shas:
|
||||||
main-branch-name: '<%= mainBranch %>'
|
main-branch-name: '<%= mainBranch %>'
|
||||||
|
|||||||
@ -28,10 +28,13 @@ jobs:
|
|||||||
bun-version: latest
|
bun-version: latest
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# 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 this command as early as possible, before dependencies are installed
|
||||||
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
<% if (connectedToCloud) { %>- run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
||||||
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } %>
|
||||||
<% if(packageManager != 'bun'){ %>
|
<% if(packageManager != 'bun'){ %>
|
||||||
# Cache node_modules
|
# Cache node_modules
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
|
|||||||
@ -15,10 +15,13 @@ variables:
|
|||||||
<% if(packageManager == 'bun'){ %>
|
<% if(packageManager == 'bun'){ %>
|
||||||
- npm install --prefix=$HOME/.local -g bun
|
- npm install --prefix=$HOME/.local -g bun
|
||||||
<% } %>
|
<% } %>
|
||||||
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
# This enables task distribution via Nx Cloud
|
||||||
# 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 this command as early as possible, before dependencies are installed
|
||||||
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
||||||
|
<% if (connectedToCloud) { %>- <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
||||||
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
||||||
|
<% } %>
|
||||||
- <%= packageManagerInstall %>
|
- <%= packageManagerInstall %>
|
||||||
- NX_HEAD=$CI_COMMIT_SHA
|
- NX_HEAD=$CI_COMMIT_SHA
|
||||||
- NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
|
- NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user