185 lines
5.1 KiB
YAML
185 lines
5.1 KiB
YAML
version: 2.1
|
|
|
|
# -------------------------
|
|
# ORBS
|
|
# -------------------------
|
|
orbs:
|
|
nx: nrwl/nx@1.6.1
|
|
rust: circleci/rust@1.6.0
|
|
browser-tools: circleci/browser-tools@1.4.6
|
|
|
|
# -------------------------
|
|
# EXECUTORS
|
|
# -------------------------
|
|
|
|
defaults: &defaults
|
|
working_directory: ~/repo
|
|
|
|
executors:
|
|
linux:
|
|
<<: *defaults
|
|
docker:
|
|
- image: cimg/rust:1.73.0-browsers
|
|
resource_class: medium+
|
|
|
|
macos:
|
|
<<: *defaults
|
|
resource_class: macos.m1.medium.gen1
|
|
macos:
|
|
xcode: '14.2.0'
|
|
|
|
# -------------------------
|
|
# COMMANDS
|
|
# -------------------------
|
|
commands:
|
|
run-pnpm-install:
|
|
parameters:
|
|
os:
|
|
type: string
|
|
steps:
|
|
- restore_cache:
|
|
name: Restore pnpm Package Cache
|
|
keys:
|
|
- node-deps-{{ arch }}-v3-{{ checksum "pnpm-lock.yaml" }}
|
|
- when:
|
|
condition:
|
|
equal: [<< parameters.os >>, linux]
|
|
steps:
|
|
- run:
|
|
name: Install pnpm package manager (linux)
|
|
command: |
|
|
npm install --prefix=$HOME/.local -g @pnpm/exe@8.7.4
|
|
- when:
|
|
condition:
|
|
equal: [<< parameters.os >>, macos]
|
|
steps:
|
|
- run:
|
|
name: Install pnpm package manager (macos)
|
|
command: |
|
|
npm install -g @pnpm/exe@8.7.4
|
|
- run:
|
|
name: Install Dependencies
|
|
command: |
|
|
pnpm install --frozen-lockfile
|
|
pnpm playwright install --with-deps firefox webkit chrome
|
|
- save_cache:
|
|
name: Save pnpm Package Cache
|
|
key: node-deps-{{ arch }}-v3-{{ checksum "pnpm-lock.yaml" }}
|
|
paths:
|
|
- ~/.pnpm-store
|
|
- ~/.cache/Cypress
|
|
- node_modules
|
|
# -------------------------
|
|
# JOBS
|
|
# -------------------------
|
|
jobs:
|
|
# -------------------------
|
|
# JOBS: Main Linux
|
|
# -------------------------
|
|
main-linux:
|
|
executor: linux
|
|
environment:
|
|
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
|
|
NX_VERBOSE_LOGGING: 'true'
|
|
NX_DAEMON: 'true'
|
|
NX_PERF_LOGGING: 'false'
|
|
NX_NATIVE_LOGGING: 'false'
|
|
NX_E2E_RUN_E2E: 'true'
|
|
NX_CI_EXECUTION_ENV: 'linux'
|
|
steps:
|
|
- run: lscpu
|
|
- checkout
|
|
- run: npx nx-cloud@next start-ci-run --distributes-on="8 linux-medium" --stop-agents-after="e2e"
|
|
- run:
|
|
command: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y ca-certificates lsof
|
|
- browser-tools/install-chrome
|
|
- browser-tools/install-chromedriver
|
|
- run-pnpm-install:
|
|
os: linux
|
|
- nx/set-shas:
|
|
main-branch-name: 'master'
|
|
- run:
|
|
name: Benchmark
|
|
command: node tools/benchmark/benchmark.js
|
|
- run:
|
|
name: Check Documentation
|
|
command: pnpm nx documentation --no-dte
|
|
no_output_timeout: 20m
|
|
- run:
|
|
name: Run Checks/Lint/Test/Build
|
|
no_output_timeout: 60m
|
|
command: |
|
|
pids=()
|
|
|
|
pnpm nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD &
|
|
pids+=($!)
|
|
|
|
pnpm nx run-many -t check-imports check-commit check-lock-files check-codeowners documentation --parallel=1 --no-dte &
|
|
pids+=($!)
|
|
|
|
(pnpm nx affected --targets=lint,test,build --base=$NX_BASE --head=$NX_HEAD --parallel=3 &&
|
|
pnpm nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --parallel=1) &
|
|
pids+=($!)
|
|
|
|
for pid in "${pids[@]}"; do
|
|
wait "$pid"
|
|
done
|
|
# -------------------------
|
|
# JOBS: Main-MacOS
|
|
# -------------------------
|
|
mainmacos:
|
|
executor: macos
|
|
environment:
|
|
NX_E2E_CI_CACHE_KEY: e2e-circleci-macos
|
|
NX_PERF_LOGGING: 'false'
|
|
NX_CI_EXECUTION_ENV: 'macos'
|
|
SELECTED_PM: 'npm' # explicitly define npm for macOS tests
|
|
steps:
|
|
- checkout
|
|
- 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-pnpm-install:
|
|
os: macos
|
|
- rust/install
|
|
- nx/set-shas:
|
|
main-branch-name: 'master'
|
|
- run:
|
|
name: Run E2E Tests for macOS
|
|
command: |
|
|
pnpm nx affected -t e2e-macos --parallel=1 --base=$NX_BASE --head=$NX_HEAD
|
|
no_output_timeout: 45m
|
|
- run:
|
|
name: Close CI group
|
|
command: |
|
|
pnpm nx-cloud stop-all-agents
|
|
no_output_timeout: 45m
|
|
|
|
# -------------------------
|
|
# WORKFLOWS(JOBS)
|
|
# -------------------------
|
|
workflows:
|
|
version: 2
|
|
|
|
build:
|
|
jobs:
|
|
- main-linux
|
|
- mainmacos:
|
|
name: main-macos-e2e
|