Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update Nx cloud workflow #5515

Merged
merged 8 commits into from
Jun 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 26 additions & 83 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,37 @@
name: pr

on: [pull_request]

env:
NX_DAEMON: false
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

jobs:
agent:
name: 'Nx Cloud Agents'
main:
name: Nx Cloud
uses: nrwl/ci/.github/workflows/[email protected]
with:
node-version: 18.16.0
pnpm-version: 8.6.0
main-branch-name: alpha
artifacts-name: nx-cloud-artifact
artifacts-path: |
**/build/**
**/coverage/**
!**/node_modules/**
parallel-commands: |
npx nx test:format
npx nx affected --targets=test:eslint,test:types,test:build,test:lib
codecov:
name: Codecov
needs: main
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
agent: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v3
- name: Downloading artifacts
uses: actions/download-artifact@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Start Nx Agent ${{ matrix.agent }}
run: npx nx-cloud start-agent
orchestrator:
name: 'Nx Cloud Orchestrator'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Get appropriate base and head commits for `nx affected` commands
uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'alpha'
- run: |
echo "BASE: ${{ env.NX_BASE }}"
echo "HEAD: ${{ env.NX_HEAD }}"
- name: Start CI Orchestrator
run: npx nx-cloud start-ci-run
- name: Run All Checks
uses: nick-fields/[email protected]
env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
with:
timeout_minutes: 5
max_attempts: 3
command: npx nx affected --targets=test:eslint,test:types,test:build,test:lib --base=${{ github.event.pull_request.base.sha }}
- name: Stop Agents
run: npx nx-cloud stop-all-agents
name: nx-cloud-artifact
path: .
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
format:
name: 'Format'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- run: pnpm run test:format --base=${{ github.event.pull_request.base.sha }}