diff --git a/.github/workflows/nx.yaml b/.github/workflows/nx.yaml new file mode 100644 index 0000000..3182e7b --- /dev/null +++ b/.github/workflows/nx.yaml @@ -0,0 +1,62 @@ +name: CI +on: + push: + branches: + - main + pull_request: + +env: + NX_CLOUD_DISTRIBUTED_EXECUTION: true + +jobs: + main: + runs-on: ubuntu-latest + if: ${{ github.event_name != 'pull_request' }} + steps: + - uses: actions/checkout@v2 + name: Checkout [main] + with: + 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@v1 + with: + node-version: "14" + - run: npm install + - run: npx nx-cloud start-ci-run + - run: npx nx affected --target=build --parallel --max-parallel=3 + - run: npx nx affected --target=test --parallel --max-parallel=2 + - run: npx nx-cloud stop-all-agents + pr: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} + steps: + - uses: actions/checkout@v2 + 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@v1 + with: + node-version: "14" + - run: npm install + - run: npx nx-cloud start-ci-run + - run: npx nx affected --target=build --parallel --max-parallel=3 + - run: npx nx affected --target=test --parallel --max-parallel=2 + - run: npx nx-cloud stop-all-agents + agents: + runs-on: ubuntu-latest + name: Agent 1 + timeout-minutes: 60 + strategy: + matrix: + agent: [1, 2, 3] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: "14" + - run: npm install + - name: Start Nx Agent ${{ matrix.agent }} + run: npx nx-cloud start-agent