275 lines
7.7 KiB
YAML
275 lines
7.7 KiB
YAML
version: 2.1
|
|
|
|
# -------------------------
|
|
# ORBS
|
|
# -------------------------
|
|
orbs:
|
|
nx: nrwl/nx@1.0.0
|
|
|
|
# -------------------------
|
|
# DEFAULTS
|
|
# -------------------------
|
|
machine:
|
|
pre:
|
|
- mkdir ~/.cache/yarn
|
|
- mkdir ~/Library/Caches/Homebrew
|
|
- mkdir /usr/local/Homebrew
|
|
|
|
dependencies:
|
|
cache_directories:
|
|
- ~/.cache/yarn
|
|
- /usr/local/Homebrew
|
|
- ~/Library/Caches/Homebrew
|
|
override:
|
|
- yarn install
|
|
- brew install
|
|
|
|
defaults: &defaults
|
|
working_directory: ~/repo
|
|
|
|
# -------------------------
|
|
# EXECUTORS
|
|
# -------------------------
|
|
executors:
|
|
linux:
|
|
<<: *defaults
|
|
docker:
|
|
- image: cimg/node:14.17-browsers
|
|
|
|
macos:
|
|
<<: *defaults
|
|
macos:
|
|
xcode: &_XCODE_VERSION '13.0.0'
|
|
|
|
android:
|
|
<<: *defaults
|
|
docker:
|
|
- image: reactnativecommunity/react-native-android
|
|
resource_class: 'large'
|
|
environment:
|
|
- ADB_INSTALL_TIMEOUT: 10
|
|
- _JAVA_OPTIONS: '-Xmx1024m -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap'
|
|
- GRADLE_OPTS: '-Xmx2014m -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+UnlockExperimentalVMOptions -XX:+HeapDumpOnOutOfMemoryError"'
|
|
|
|
# -------------------------
|
|
# COMMANDS
|
|
# -------------------------
|
|
commands:
|
|
run-yarn-install:
|
|
parameters:
|
|
os:
|
|
type: string
|
|
steps:
|
|
- restore_cache:
|
|
name: Restore Yarn Package Cache
|
|
keys:
|
|
- nrwl-nx-yarn-packages-<< parameters.os >>-{{ checksum "yarn.lock" }}
|
|
- run:
|
|
name: Install dependencies
|
|
command: yarn install --prefer-offline --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
|
|
- save_cache:
|
|
name: Save Yarn Package Cache
|
|
key: nrwl-nx-yarn-packages-<< parameters.os >>-{{ checksum "yarn.lock" }}
|
|
paths:
|
|
- node_modules
|
|
- ~/.cache/yarn
|
|
|
|
install-pnpm:
|
|
steps:
|
|
- run:
|
|
name: Install PNPM
|
|
command: npm install --prefix=$HOME/.local -g pnpm@6.9.1
|
|
|
|
setup:
|
|
parameters:
|
|
os:
|
|
type: string
|
|
steps:
|
|
- checkout
|
|
- when:
|
|
condition:
|
|
equal: [<< parameters.os >>, macos]
|
|
steps:
|
|
- restore_cache:
|
|
name: Restore Homebrew packages
|
|
keys:
|
|
- nrwl-nx-homebrew-packages
|
|
- run:
|
|
name: Configure Detox Environment, Install applesimutils
|
|
command: |
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
|
|
xcrun simctl shutdown all && xcrun simctl erase all
|
|
no_output_timeout: 20m
|
|
- save_cache:
|
|
name: Save Homebrew Cache
|
|
key: nrwl-nx-homebrew-packages
|
|
paths:
|
|
- /usr/local/Homebrew
|
|
- ~/Library/Caches/Homebrew
|
|
|
|
- run-yarn-install:
|
|
os: << parameters.os >>
|
|
- install-pnpm
|
|
|
|
# -------------------------
|
|
# JOBS
|
|
# -------------------------
|
|
jobs:
|
|
# -------------------------
|
|
# JOBS: Agent
|
|
# -------------------------
|
|
agent:
|
|
parameters:
|
|
os:
|
|
type: string
|
|
default: 'linux'
|
|
pm:
|
|
type: string
|
|
default: 'pnpm'
|
|
executor: << parameters.os >>
|
|
environment:
|
|
GIT_AUTHOR_EMAIL: test@test.com
|
|
GIT_AUTHOR_NAME: Test
|
|
GIT_COMMITTER_EMAIL: test@test.com
|
|
GIT_COMMITTER_NAME: Test
|
|
NX_E2E_CI_CACHE_KEY: e2e-circleci-<< parameters.os >>
|
|
SELECTED_PM: << parameters.pm >>
|
|
NX_E2E_RUN_CYPRESS: 'false'
|
|
steps:
|
|
- run:
|
|
name: Set dynamic nx run variable
|
|
command: |
|
|
echo "export NX_RUN_GROUP=\"run-group-<< parameters.os >>-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
|
|
- setup:
|
|
os: << parameters.os >>
|
|
- run:
|
|
name: Agent
|
|
command: npx nx-cloud start-agent
|
|
no_output_timeout: 60m
|
|
|
|
# -------------------------
|
|
# JOBS: Main
|
|
# -------------------------
|
|
main:
|
|
executor: linux
|
|
environment:
|
|
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
|
|
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
|
|
steps:
|
|
- run:
|
|
name: Set dynamic nx run variable
|
|
command: |
|
|
echo "export NX_RUN_GROUP=\"run-group-linux-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
|
|
- setup:
|
|
os: linux
|
|
- nx/set-shas:
|
|
main-branch-name: 'master'
|
|
- run:
|
|
name: Check Documentation
|
|
command: yarn documentation
|
|
- run:
|
|
name: Check Imports
|
|
command: yarn check-imports
|
|
- run:
|
|
name: Check Formatting
|
|
command: yarn nx format:check --base=$NX_BASE --head=$NX_HEAD
|
|
- run:
|
|
name: Check Commit
|
|
command: yarn check-commit
|
|
- run:
|
|
name: Check Package dependencies
|
|
command: yarn depcheck
|
|
- run:
|
|
name: Run Tests
|
|
command: |
|
|
npx nx affected --target=test --base=$NX_BASE --head=$NX_HEAD --parallel --max-parallel=3
|
|
- run:
|
|
name: Run Lint
|
|
command: |
|
|
npx nx workspace-lint
|
|
# 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"
|
|
- run:
|
|
name: Run Builds
|
|
command: |
|
|
npx nx affected --target=build --base=$NX_BASE --head=$NX_HEAD --parallel --max-parallel=3
|
|
- run:
|
|
name: Run E2E Tests
|
|
command: |
|
|
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
|
|
- run:
|
|
name: Stop All Running Agents for This CI Run
|
|
command: npx nx-cloud stop-all-agents
|
|
|
|
# -------------------------
|
|
# JOBS: Main-MacOS
|
|
# -------------------------
|
|
mainmacos:
|
|
executor: macos
|
|
environment:
|
|
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
|
|
NX_E2E_CI_CACHE_KEY: e2e-circleci-macos
|
|
steps:
|
|
- run:
|
|
name: Set dynamic nx run variable
|
|
command: |
|
|
echo "export NX_RUN_GROUP=\"run-group-macos-$CIRCLE_WORKFLOW_ID\";" >> $BASH_ENV
|
|
- setup:
|
|
os: macos
|
|
- nx/set-shas:
|
|
main-branch-name: 'master'
|
|
- run:
|
|
name: Run E2E Tests
|
|
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
|
|
no_output_timeout: 45m
|
|
- run:
|
|
name: Stop All Running Agents for This CI Run
|
|
command: npx nx-cloud stop-all-agents
|
|
|
|
# -------------------------
|
|
# WORKFLOWS
|
|
# -------------------------
|
|
workflows:
|
|
version: 2
|
|
|
|
build:
|
|
jobs:
|
|
- agent:
|
|
name: 'agent1'
|
|
- agent:
|
|
name: 'agent2'
|
|
- agent:
|
|
name: 'agent3'
|
|
- agent:
|
|
name: 'agent4'
|
|
- agent:
|
|
name: 'agent5'
|
|
- agent:
|
|
name: 'agent6'
|
|
- agent:
|
|
name: 'agent7'
|
|
- agent:
|
|
name: 'agent8'
|
|
- agent:
|
|
name: 'agent9'
|
|
pm: 'npm'
|
|
os: 'macos'
|
|
- agent:
|
|
name: 'agent10'
|
|
pm: 'npm'
|
|
os: 'macos'
|
|
# - agent:
|
|
# name: 'agent10'
|
|
# pm: 'npm'
|
|
# os: 'android'
|
|
# -------------------------
|
|
# Pull request logic
|
|
# -------------------------
|
|
- main:
|
|
name: pull-request
|
|
- mainmacos:
|
|
name: pull-request-macos
|