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