From ec87ae1387b9568dea3cd314c1b0005e339e8f7a Mon Sep 17 00:00:00 2001 From: Victor Savkin Date: Tue, 15 Aug 2023 10:31:18 -0400 Subject: [PATCH] feat(repo): enable agents --- .circleci/config.yml | 92 ++++++++------------------------------- .nx/workflows/agents.yaml | 50 +++++++++++++++++++++ 2 files changed, 68 insertions(+), 74 deletions(-) create mode 100644 .nx/workflows/agents.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml index 24225eca401d14..fa14b8379d8388 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -113,46 +113,6 @@ commands: # 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_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 test@test.com - 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 # ------------------------- @@ -174,30 +134,30 @@ jobs: - 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: 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-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 & - pids+=($!) - (pnpm nx affected --target=build --base=$NX_BASE --head=$NX_HEAD --parallel=3 && - pnpm nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --parallel=1) & - pids+=($!) - +# pnpm nx affected --target=test --base=$NX_BASE --head=$NX_HEAD --parallel=1 & +# pids+=($!) +# (pnpm nx affected --target=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 @@ -234,22 +194,6 @@ 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 +# - mainmacos: +# name: main-macos-e2e diff --git a/.nx/workflows/agents.yaml b/.nx/workflows/agents.yaml new file mode 100644 index 00000000000000..7b23a46a31b2d5 --- /dev/null +++ b/.nx/workflows/agents.yaml @@ -0,0 +1,50 @@ +parallelism: 5 +env: + CI: 'true' + 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-linux + NX_VERBOSE_LOGGING: 'false' + NX_DAEMON: 'true' + NX_PERF_LOGGING: 'false' + NX_NATIVE_LOGGING: 'false' + SELECTED_PM: 'pnpm' + NX_E2E_RUN_E2E: 'true' +steps: + - name: Git Clone + script: | + git init /workspace + 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 --prefix=$HOME/.local -g @pnpm/exe@8.3.1 + + - name: Pnpm Install + script: | + pnpm install --frozen-lockfile + + - name: Configure git metadata (needed for lerna smoke tests) + script: | + git config --global user.email test@test.com + git config --global user.name "Test Test" + + - name: Run Agent + script: | + 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-s