Skip to content

Commit

Permalink
feat(core): move distribution to beginning of generated ci workflows (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav authored Feb 2, 2024
1 parent 396ffc4 commit d6d7b1c
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
"
Expand All @@ -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
"
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
"
Expand All @@ -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:
Expand All @@ -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
"
Expand All @@ -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
"
Expand Down Expand Up @@ -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
"
Expand All @@ -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
"
Expand All @@ -264,16 +267,16 @@ 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
- run: pnpm 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: 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
Expand Down Expand Up @@ -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
Expand All @@ -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
"
Expand All @@ -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
Expand All @@ -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
"
Expand All @@ -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
"
Expand Down Expand Up @@ -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
"
Expand All @@ -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
"
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
"
Expand All @@ -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:
Expand All @@ -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
"
Expand All @@ -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
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Loading

0 comments on commit d6d7b1c

Please sign in to comment.