Open History to see the last commit
1name: pr
2β
3on:
4 pull_request:
5β
6concurrency:
7 group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
8 cancel-in-progress: true
9β
10env:
11 NX_CLOUD_DISTRIBUTED_EXECUTION: true
12 NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3
13 NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
14 NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
15β
16jobs:
17 main:
18 name: Nx Cloud - Main Job
19 runs-on: ubuntu-latest
20 steps:
21 - name: Checkout
22 uses: actions/checkout@v4.2.2
23 with:
24 fetch-depth: 0
25 - name: Setup pnpm
26 uses: pnpm/action-setup@v4.1.0
27 - name: Setup Node
28 uses: actions/setup-node@v3
29 with:
30 node-version-file: .nvmrc
31 cache: pnpm
32 cache-dependency-path: pnpm-lock.yaml
33 - name: Install dependencies
34 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
35 - name: Get appropriate base and head commits for `nx affected` commands
36 uses: nrwl/nx-set-shas@v3
37 with:
38 main-branch-name: 'main'
39 - run: |
40 echo "BASE: ${{ env.NX_BASE }}"
41 echo "HEAD: ${{ env.NX_HEAD }}"
42 - name: Start CI Orchestrator
43 run: npx nx-cloud start-ci-run
44 - name: Run Tests
45 run: pnpm run test:pr
46 - name: Stop Agents
47 run: npx nx-cloud stop-all-agents
48 - name: Upload coverage to Codecov
49 uses: codecov/codecov-action@v3
50 agents:
51 name: Nx Cloud - Agents
52 runs-on: ubuntu-latest
53 timeout-minutes: 10
54 strategy:
55 matrix:
56 agent: [1, 2, 3]
57 steps:
58 - name: Checkout
59 uses: actions/checkout@v4.2.2
60 with:
61 fetch-depth: 0
62 - name: Setup pnpm
63 uses: pnpm/action-setup@v4.1.0
64 - name: Setup Node
65 uses: actions/setup-node@v3
66 with:
67 node-version-file: .nvmrc
68 cache: pnpm
69 cache-dependency-path: pnpm-lock.yaml
70 - name: Install dependencies
71 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
72 - name: Start Nx Agent ${{ matrix.agent }}
73 run: npx nx-cloud start-agent
74 format:
75 name: Format
76 runs-on: ubuntu-latest
77 steps:
78 - name: Checkout
79 uses: actions/checkout@v4.2.2
80 with:
81 fetch-depth: 0
82 - name: Setup pnpm
83 uses: pnpm/action-setup@v4.1.0
84 - name: Setup Node
85 uses: actions/setup-node@v3
86 with:
87 node-version-file: .nvmrc
88 cache: pnpm
89 cache-dependency-path: pnpm-lock.yaml
90 - name: Install dependencies
91 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
92 - name: Run prettier
93 run: pnpm run test:format
94 test-react-17:
95 name: 'Test React 17'
96 runs-on: ubuntu-latest
97 steps:
98 - name: Checkout
99 uses: actions/checkout@v4.2.2
100 with:
101 fetch-depth: 0
102 ref: ${{ github.head_ref }}
103 repository: ${{github.event.pull_request.head.repo.full_name}}
104 - name: Setup pnpm
105 uses: pnpm/action-setup@v4.1.0
106 - uses: actions/setup-node@v3
107 with:
108 node-version-file: .nvmrc
109 cache: pnpm
110 cache-dependency-path: pnpm-lock.yaml
111 - name: Install dependencies
112 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
113 - name: Derive appropriate SHAs for base and head for `nx affected` commands
114 uses: nrwl/nx-set-shas@v2
115 - name: Run Tests
116 uses: nick-fields/retry@v2.8.3
117 with:
118 timeout_minutes: 5
119 max_attempts: 3
120 command: npx nx affected --targets=test:lib --base=${{ github.event.pull_request.base.sha }}
121 env:
122 NX_CLOUD_DISTRIBUTED_EXECUTION: false
123 REACTJS_VERSION: 17