chore(repo): parallelize CI build steps or PR/merge (#7986)

This commit is contained in:
Miroslav Jonaš 2021-12-03 07:41:35 -06:00 committed by GitHub
parent 056bfeba79
commit 0934755111
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 44 deletions

View File

@ -85,6 +85,10 @@ commands:
os: os:
type: string type: string
steps: steps:
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_RUN_GROUP=\"run-group-<< parameters.os >>-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
- checkout - checkout
- when: - when:
condition: condition:
@ -137,10 +141,6 @@ jobs:
SELECTED_PM: << parameters.pm >> SELECTED_PM: << parameters.pm >>
NX_E2E_RUN_CYPRESS: 'false' NX_E2E_RUN_CYPRESS: 'false'
steps: steps:
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_RUN_GROUP=\"run-group-<< parameters.os >>-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
- setup: - setup:
os: << parameters.os >> os: << parameters.os >>
- run: - run:
@ -151,23 +151,16 @@ jobs:
# ------------------------- # -------------------------
# JOBS: Main # JOBS: Main
# ------------------------- # -------------------------
main: main-checks:
executor: linux executor: linux
environment: environment:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true' NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
steps: steps:
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_RUN_GROUP=\"run-group-linux-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
- setup: - setup:
os: linux os: linux
- nx/set-shas: - nx/set-shas:
main-branch-name: 'master' main-branch-name: 'master'
- run:
name: Check Documentation
command: yarn documentation
- run: - run:
name: Check Imports name: Check Imports
command: yarn check-imports command: yarn check-imports
@ -181,24 +174,78 @@ jobs:
name: Check Package dependencies name: Check Package dependencies
command: yarn depcheck command: yarn depcheck
- run: - run:
name: Run Tests name: Check Documentation
command: | command: yarn documentation
npx nx affected --target=test --base=$NX_BASE --head=$NX_HEAD --parallel --max-parallel=3 no_output_timeout: 20m
main-lint:
executor: linux
environment:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
steps:
- setup:
os: linux
- nx/set-shas:
main-branch-name: 'master'
- run: - run:
name: Run Lint name: Run Lint
command: | command: |
npx nx workspace-lint npx nx workspace-lint
# npx nx affected --target=lint --base=$NX_BASE --head=$NX_HEAD --parallel --max-parallel=3 # npx nx affected --target=lint --base=$NX_BASE --head=$NX_HEAD --parallel --max-parallel=3
echo "Linting is temporarily disabled until ESLint v8 support is published" echo "Linting is temporarily disabled until ESLint v8 support is published"
main-test:
executor: linux
environment:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
steps:
- setup:
os: linux
- nx/set-shas:
main-branch-name: 'master'
- run:
name: Run Tests
command: |
npx nx affected --target=test --base=$NX_BASE --head=$NX_HEAD --parallel --max-parallel=3
main-build:
executor: linux
environment:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
steps:
- setup:
os: linux
- nx/set-shas:
main-branch-name: 'master'
- run: - run:
name: Run Builds name: Run Builds
command: | command: |
npx nx affected --target=build --base=$NX_BASE --head=$NX_HEAD --parallel --max-parallel=3 npx nx affected --target=build --base=$NX_BASE --head=$NX_HEAD --parallel --max-parallel=3
main-e2e:
executor: linux
environment:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
steps:
- setup:
os: linux
- nx/set-shas:
main-branch-name: 'master'
- run: - run:
name: Run E2E Tests name: Run E2E Tests
command: | command: |
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-react-native,e2e-detox,e2e-gatsby --parallel --max-parallel=1 npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-react-native,e2e-detox,e2e-gatsby --parallel --max-parallel=1
no_output_timeout: 45m no_output_timeout: 30m
main-linux-cleanup:
executor: linux
environment:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
steps:
- setup:
os: linux
- run: - run:
name: Stop All Running Agents for This CI Run name: Stop All Running Agents for This CI Run
command: npx nx-cloud stop-all-agents command: npx nx-cloud stop-all-agents
@ -212,10 +259,6 @@ jobs:
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true' NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
NX_E2E_CI_CACHE_KEY: e2e-circleci-macos NX_E2E_CI_CACHE_KEY: e2e-circleci-macos
steps: steps:
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_RUN_GROUP=\"run-group-macos-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
- setup: - setup:
os: macos os: macos
- nx/set-shas: - nx/set-shas:
@ -224,7 +267,7 @@ jobs:
name: Run E2E Tests name: Run E2E Tests
command: | command: |
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-js,e2e-next,e2e-gatsby,e2e-workspace-create,e2e-workspace-integrations,e2e-workspace-core,e2e-react,e2e-web,e2e-angular-extensions,e2e-angular-core,e2e-cli,e2e-nx-plugin,e2e-storybook,e2e-cypress,e2e-node,e2e-linter,e2e-jest --max-parallel=1 npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --exclude=e2e-js,e2e-next,e2e-gatsby,e2e-workspace-create,e2e-workspace-integrations,e2e-workspace-core,e2e-react,e2e-web,e2e-angular-extensions,e2e-angular-core,e2e-cli,e2e-nx-plugin,e2e-storybook,e2e-cypress,e2e-node,e2e-linter,e2e-jest --max-parallel=1
no_output_timeout: 45m no_output_timeout: 30m
- run: - run:
name: Stop All Running Agents for This CI Run name: Stop All Running Agents for This CI Run
command: npx nx-cloud stop-all-agents command: npx nx-cloud stop-all-agents
@ -238,37 +281,45 @@ workflows:
build: build:
jobs: jobs:
- agent: - agent:
name: 'agent1' name: 'agent-linux-1'
- agent: - agent:
name: 'agent2' name: 'agent-linux-2'
- agent: - agent:
name: 'agent3' name: 'agent-linux-3'
- agent: - agent:
name: 'agent4' name: 'agent-linux-4'
- agent: - agent:
name: 'agent5' name: 'agent-linux-5'
- agent: - agent:
name: 'agent6' name: 'agent-linux-6'
- agent: - agent:
name: 'agent7' name: 'agent-linux-7'
- agent: - agent:
name: 'agent8' name: 'agent-linux-8'
- agent: - agent:
name: 'agent9' name: 'agent-macos-1'
pm: 'npm' pm: 'npm'
os: 'macos' os: 'macos'
- agent: - agent:
name: 'agent10' name: 'agent-macos-2'
pm: 'npm' pm: 'npm'
os: 'macos' os: 'macos'
# - agent:
# name: 'agent10'
# pm: 'npm'
# os: 'android'
# ------------------------- # -------------------------
# Pull request logic # Pull request logic
# ------------------------- # -------------------------
- main: - main-checks
name: pull-request - main-lint
- main-test
- main-build
- main-e2e:
name: main-linux-e2e
requires:
- main-checks
- main-lint
- main-test
- main-build
- main-linux-cleanup:
requires:
- main-linux-e2e
- mainmacos: - mainmacos:
name: pull-request-macos name: main-macos-e2e

View File

@ -12,16 +12,13 @@ export function generateDevkitDocumentation() {
execSync('nx build typedoc-theme', execSyncOptions); execSync('nx build typedoc-theme', execSyncOptions);
Frameworks.forEach((framework) => { Frameworks.forEach((framework) => {
execSync(`rm -rf docs/${framework}/api-nx-devkit`, execSyncOptions);
execSync( execSync(
`rm -rf docs/${framework}/api-nx-devkit && npx typedoc packages/devkit/index.ts packages/devkit/ngcli-adapter.ts --tsconfig packages/devkit/tsconfig.lib.json --out ./docs/${framework}/api-nx-devkit --hideBreadcrumbs true --disableSources --publicPath ../../${framework}/nx-devkit/ --theme dist/typedoc-theme/src/lib --readme none`, `npx typedoc packages/devkit/index.ts packages/devkit/ngcli-adapter.ts --tsconfig packages/devkit/tsconfig.lib.json --out ./docs/${framework}/api-nx-devkit --hideBreadcrumbs true --disableSources --publicPath ../../${framework}/nx-devkit/ --theme dist/typedoc-theme/src/lib --readme none`,
execSyncOptions execSyncOptions
); );
execSync( execSync(
`rm -rf docs/${framework}/api-nx-devkit/modules.md docs/${framework}/api-nx-devkit/.nojekyll`, `rm -rf docs/${framework}/api-nx-devkit/modules.md docs/${framework}/api-nx-devkit/.nojekyll docs/${framework}/api-nx-devkit/README.md`,
execSyncOptions
);
execSync(
`rm -rf docs/${framework}/api-nx-devkit/modules.md docs/${framework}/api-nx-devkit/README.md`,
execSyncOptions execSyncOptions
); );
execSync( execSync(