From 52e7557de0f9b5f69b3a54cec837f8c532ace909 Mon Sep 17 00:00:00 2001 From: JoA-MoS Date: Fri, 30 Sep 2022 15:36:58 -0700 Subject: [PATCH] ci: switch to new github nx action --- .github/workflows/main.yml | 69 +++++++++++++------------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9bbea1..f8b2f90 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,6 +8,10 @@ on: - next pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + env: NX_CLOUD_DISTRIBUTED_EXECUTION: true NX_CLOUD_ACCESS_TOKEN: ${{secrets.NX_CLOUD_ACCESS_TOKEN}} @@ -17,49 +21,24 @@ env: jobs: main: - runs-on: ubuntu-latest - steps: - # consider creating reusable action for this - - uses: actions/checkout@v3 - name: Checkout [Trunk] - if: ${{ github.event_name != 'pull_request' }} - with: - fetch-depth: 0 - - uses: actions/checkout@v3 - name: Checkout [PR] - if: ${{ github.event_name == 'pull_request' }} - with: - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v2 - - uses: actions/setup-node@v3 - with: - node-version: '16' - cache: npm - - run: npm ci --ignore-scripts - - run: npx nx workspace-lint - - run: npx nx-cloud start-ci-run - - run: npx nx affected --target=lint --parallel --max-parallel=3 - - run: npx nx affected --target=test --parallel --max-parallel=2 - - run: npx nx affected --target=build --parallel --max-parallel=3 - - run: NX_CLOUD_DISTRIBUTED_EXECUTION=false npx nx affected --target=docker-build - - run: NX_CLOUD_DISTRIBUTED_EXECUTION=false npx nx affected --target=release - - run: npx nx-cloud stop-all-agents - + name: Nx Cloud - Main Job + uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.5 + secrets: inherit + with: + number-of-agents: 3 + parallel-commands: | + npx nx-cloud record -- npx nx workspace-lint + npx nx-cloud record -- npx nx format:check + parallel-commands-on-agents: | + npx nx affected --target=lint --parallel=3 + npx nx affected --target=test --parallel=3 --ci --code-coverage + npx nx affected --target=build --parallel=3 + final-commands: | + npx nx affected --target=docker-build + npx nx affected --target=release agents: - runs-on: ubuntu-latest - name: Agent 1 - timeout-minutes: 60 - strategy: - matrix: - agent: [1, 2, 3] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '16' - cache: npm - - run: npm ci --ignore-scripts - - name: Start Nx Agent ${{ matrix.agent }} - run: npx nx-cloud start-agent + name: Nx Cloud - Agents + uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.5 + secrets: inherit + with: + number-of-agents: 3