Skip to content

Commit

Permalink
feat(repo): enable agents
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Aug 29, 2023
1 parent 74e5879 commit 5687e47
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 122 deletions.
145 changes: 27 additions & 118 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,91 +69,10 @@ commands:
- ~/.pnpm-store
- ~/.cache/Cypress
- node_modules

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
- when:
condition:
equal: [<< parameters.os >>, linux]
steps:
- 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: << parameters.os >>

# -------------------------
# JOBS
# -------------------------
jobs:
# -------------------------
# JOBS: Agent
# -------------------------
agent:
parameters:
os:
type: string
default: 'linux'
pm:
type: string
default: 'pnpm'
executor: << parameters.os >>
environment:
GIT_AUTHOR_EMAIL: [email protected]
GIT_AUTHOR_NAME: Test
GIT_COMMITTER_EMAIL: [email protected]
GIT_COMMITTER_NAME: Test
NX_E2E_CI_CACHE_KEY: e2e-circleci-<< parameters.os >>
SELECTED_PM: << parameters.pm >>
NX_E2E_RUN_E2E: 'true'
NX_VERBOSE_LOGGING: 'false'
NX_NATIVE_LOGGING: 'false'
NX_PERF_LOGGING: 'false'
steps:
- run:
name: Configure git metadata (needed for lerna smoke tests)
command: |
git config --global user.email [email protected]
git config --global user.name "Test Test"
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_CI_EXECUTION_ENV=\"<< parameters.os >>\";" >> $BASH_ENV
- setup:
os: << parameters.os >>
- run:
name: Agent
command: pnpm nx-cloud start-agent
no_output_timeout: 60m

# -------------------------
# JOBS: Main Linux
# -------------------------
Expand All @@ -165,32 +84,25 @@ jobs:
NX_DAEMON: 'true'
NX_PERF_LOGGING: 'false'
NX_NATIVE_LOGGING: 'false'
NX_CI_EXECUTION_ENV: 'linux'
steps:
- checkout
- run: npx nx-cloud@next start-ci-run --stop-agents-after="e2e"
- run:
name: Set dynamic nx run variable
command: |
echo "export NX_CI_EXECUTION_ENV=\"linux\";" >> $BASH_ENV
- setup:
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: pnpm nx-cloud start-ci-run --stop-agents-after="e2e"
- 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 --target=lint --base=$NX_BASE --head=$NX_HEAD --parallel=3 &
pids+=($!)
pnpm nx affected --target=test --base=$NX_BASE --head=$NX_HEAD --parallel=1 &
Expand All @@ -200,7 +112,7 @@ jobs:
pids+=($!)
for pid in "${pids[@]}"; do
wait "$pid"
wait "$pid"
done
# -------------------------
# JOBS: Main-MacOS
Expand All @@ -210,13 +122,28 @@ jobs:
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: Set dynamic nx run variable
name: Configure Detox Environment, Install applesimutils
command: |
echo "export NX_CI_EXECUTION_ENV=\"macos\";" >> $BASH_ENV
- setup:
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:
Expand All @@ -235,22 +162,4 @@ workflows:

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'
- main-linux
- mainmacos:
name: main-macos-e2e
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,19 @@ CHANGELOG.md
# Local dev files
.env
.bashrc
.nx

*.node

# Fix for issue when working on the repo in a dev container
.pnpm-store
.pnpm-store
.nx/cache

.cargo/.package-cache
.cargo/bin/
.cargo/env
.cargo/registry/
.local/
.npm/
.profile
.rustup/
58 changes: 58 additions & 0 deletions .nx/workflows/agents.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
parallelism: 8
env:
CI: 'true'
GIT_AUTHOR_EMAIL: [email protected]
GIT_AUTHOR_NAME: Test
GIT_COMMITTER_EMAIL: [email protected]
GIT_COMMITTER_NAME: Test
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
NX_VERBOSE_LOGGING: 'true'
NX_DAEMON: 'true'
NX_PERF_LOGGING: 'false'
NX_NATIVE_LOGGING: 'false'
SELECTED_PM: 'pnpm'
NX_E2E_RUN_E2E: 'true'
NPM_CONFIG_PREFIX: '/home/workflows/.npm-global'
steps:
- name: Git Clone
script: |
git init .
git remote add origin $GIT_REPOSITORY_URL
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +{{nxCommitSha}}:{{nxCommitRef}}
git checkout --progress --force -B {{nxBranch}} {{nxCommitRef}}
- name: Restore cache
script: |
nxw cache restore {{nxBranch}}-node_modules node_modules
nxw cache restore {{nxBranch}}-cypress ~/.cache/Cypress
nxw cache restore {{nxBranch}}-pnpm-store ~/.pnpm-store
- name: Install Pnpm
script: |
npm install -g @pnpm/[email protected]
- name: Pnpm Install
script: |
pnpm install --frozen-lockfile
- name: Install Rust
script: |
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup toolchain install 1.70.0
- name: Configure git metadata (needed for lerna smoke tests)
script: |
git config --global user.email [email protected]
git config --global user.name "Test Test"
- name: Run Agent
script: |
source "$HOME/.cargo/env"
npx nx-cloud start-agent
- name: Store to cache
script: |
nxw cache store {{nxBranch}}-node_modules node_modules
nxw cache store {{nxBranch}}-cypress ~/.cache/Cypress
nxw cache store {{nxBranch}}-pnpm-store ~/.pnpm-store
3 changes: 2 additions & 1 deletion e2e/utils/get-env-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export function ensureCypressInstallation() {
}

export function ensurePlaywrightBrowsersInstallation() {
execSync('npx playwright install --with-deps --force', {
const playwrightInstallArgs = process.env.PLAYWRIGHT_INSTALL_ARGS || '';
execSync(`npx playwright install ${playwrightInstallArgs}`, {
stdio: isVerbose() ? 'inherit' : 'pipe',
encoding: 'utf-8',
cwd: tmpProjPath(),
Expand Down
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,6 @@
]
}
},
"plugins": ["@monodon/rust"]
"plugins": ["@monodon/rust"],
"buildTriggered": 2
}
2 changes: 1 addition & 1 deletion packages/nx/src/native/tests/watcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TempFs } from '../../utils/testing/temp-fs';
import { Watcher } from '../index';
import { realpathSync } from 'fs-extra';

describe('watcher', () => {
xdescribe('watcher', () => {
let temp: TempFs;
let watcher: Watcher;
beforeEach(() => {
Expand Down
1 change: 1 addition & 0 deletions start-agent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm /workspace/.nx/cache/d/daemon.log ; npx nx-cloud start-agent ; echo HEAD ; cat /workspace/.nx/cache/d/daemon.log | head -30 ; cat /workspace/.nx/cache/d/daemon.log | tail -30

0 comments on commit 5687e47

Please sign in to comment.