docs(core): update bitbucket recipe (#19986)

This commit is contained in:
Isaac Mann 2023-11-06 04:23:10 -05:00 committed by GitHub
parent cc9077a062
commit 4b6b00ddc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@
Below is an example of a Bitbucket Pipeline setup for an Nx workspace - building and testing only what is affected.
```yaml
image: node:16
image: node:20
pipelines:
pull-requests:
'**':
@ -14,9 +14,7 @@ pipelines:
script:
- npm ci
- npx nx format:check
- npx nx affected -t lint --base=origin/master --parallel --max-parallel=3
- npx nx affected -t test --base=origin/master --parallel --max-parallel=3 --configuration=ci
- npx nx affected -t build --base=origin/master --head=HEAD --parallel --max-parallel=3
- npx nx affected -t lint,test,build --base=origin/master --head=HEAD --configuration=ci
branches:
main:
@ -27,7 +25,46 @@ pipelines:
script:
- npm ci
- npx nx format:check
- npx nx affected -t lint --base=origin/master --parallel --max-parallel=3 & npx nx affected -t test --base=HEAD~1 --parallel --max-parallel=3 --configuration=ci & npx nx affected -t build --base=HEAD~1 --parallel --max-parallel=3
- npx nx affected -t lint,test,build --base=HEAD~1 --configuration=ci
```
The `pull-requests` and `main` jobs implement the CI workflow.
## Distributed Task Execution
This pipeline uses [Distributed Task Execution (DTE)](/core-features/distribute-task-execution) to automatically distribute work across multiple agent processes.
```yaml
image: node:20
clone:
depth: full
definitions:
steps:
- step: &agent
name: Agent
script:
- export NX_BRANCH=$BITBUCKET_PR_ID
- npm ci
- npx nx-cloud start-agent
pipelines:
pull-requests:
'**':
- parallel:
- step:
name: CI
script:
- export NX_BRANCH=$BITBUCKET_PR_ID
- npm ci
- npx nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
- npx nx-cloud record -- npx nx format:check
- npx nx affected --target=lint,test,build
- npx nx-cloud stop-all-agents
- step: *agent
- step: *agent
- step: *agent
```