Skip to content

Commit

Permalink
ci: switch to new github nx action
Browse files Browse the repository at this point in the history
  • Loading branch information
JoA-MoS committed Sep 30, 2022
1 parent ef37f2a commit 52e7557
Showing 1 changed file with 24 additions and 45 deletions.
69 changes: 24 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand All @@ -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/[email protected]
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/[email protected]
secrets: inherit
with:
number-of-agents: 3

0 comments on commit 52e7557

Please sign in to comment.