@@ -2,12 +2,15 @@ name: pr
2
2
on : [pull_request]
3
3
env :
4
4
NX_DAEMON : false
5
- NX_VERBOSE_LOGGING : true
6
5
NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
7
6
jobs :
8
- test :
9
- name : ' Test '
7
+ agent :
8
+ name : ' Nx Cloud Agents '
10
9
runs-on : ubuntu-latest
10
+ timeout-minutes : 20
11
+ strategy :
12
+ matrix :
13
+ agent : [1, 2, 3, 4]
11
14
steps :
12
15
- uses : actions/checkout@v3
13
16
with :
@@ -23,16 +26,10 @@ jobs:
23
26
cache : ' pnpm'
24
27
- name : Install dependencies
25
28
run : pnpm --filter "./packages/**" --filter query --prefer-offline install
26
- - name : Run Tests
27
- uses : nick-fields/retry@v2.8.3
28
- with :
29
- command : pnpm test:lib --base=${{ github.event.pull_request.base.sha }}
30
- timeout_minutes : 5
31
- max_attempts : 3
32
- - name : Upload coverage to Codecov
33
- uses : codecov/codecov-action@v3
34
- lint :
35
- name : ' Lint'
29
+ - name : Start Nx Agent ${{ matrix.agent }}
30
+ run : npx nx-cloud start-agent
31
+ orchestrator :
32
+ name : ' Nx Cloud Orchestrator'
36
33
runs-on : ubuntu-latest
37
34
steps :
38
35
- uses : actions/checkout@v3
@@ -49,26 +46,25 @@ jobs:
49
46
cache : ' pnpm'
50
47
- name : Install dependencies
51
48
run : pnpm --filter "./packages/**" --filter query --prefer-offline install
52
- - run : pnpm run test:eslint --base=${{ github.event.pull_request.base.sha }}
53
- typecheck :
54
- name : ' Typecheck'
55
- runs-on : ubuntu-latest
56
- steps :
57
- - uses : actions/checkout@v3
58
- with :
59
- fetch-depth : 0
60
- ref : ${{ github.head_ref }}
61
- repository : ${{github.event.pull_request.head.repo.full_name}}
62
- - uses : pnpm/action-setup@v2.2.4
63
- with :
64
- version : 7
65
- - uses : actions/setup-node@v3
49
+ - name : Derive appropriate SHAs for base and head for `nx affected` commands
50
+ uses : nrwl/nx-set-shas@v2
51
+ - run : |
52
+ echo "BASE: ${{ env.NX_BASE }}"
53
+ echo "HEAD: ${{ env.NX_HEAD }}"
54
+ - name : Start CI Orchestrator
55
+ run : npx nx-cloud start-ci-run
56
+ - name : Run All Checks
57
+ uses : nick-fields/retry@v2.8.3
58
+ env :
59
+ BUNDLEWATCH_GITHUB_TOKEN : ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
66
60
with :
67
- node-version : 16.14.2
68
- cache : ' pnpm'
69
- - name : Install dependencies
70
- run : pnpm --filter "./packages/**" --filter query --prefer-offline install
71
- - run : pnpm run test:types --base=${{ github.event.pull_request.base.sha }}
61
+ timeout_minutes : 5
62
+ max_attempts : 3
63
+ command : npx nx affected --targets=test:eslint,test:types,test:build,test:lib --base=${{ github.event.pull_request.base.sha }}
64
+ - name : Stop Agents
65
+ run : npx nx-cloud stop-all-agents
66
+ - name : Upload coverage to Codecov
67
+ uses : codecov/codecov-action@v3
72
68
format :
73
69
name : ' Format'
74
70
runs-on : ubuntu-latest
87
83
cache : ' pnpm'
88
84
- name : Install dependencies
89
85
run : pnpm --filter "./packages/**" --filter query --prefer-offline install
90
- - run : pnpm run test:format --base=${{ github.event.pull_request.base.sha }}
86
+ - run : pnpm run test:format
91
87
test-react-17 :
92
88
name : ' Test React 17'
93
89
runs-on : ubuntu-latest
@@ -106,28 +102,13 @@ jobs:
106
102
cache : ' pnpm'
107
103
- name : Install dependencies
108
104
run : pnpm --filter "./packages/**" --filter query --prefer-offline install
105
+ - name : Derive appropriate SHAs for base and head for `nx affected` commands
106
+ uses : nrwl/nx-set-shas@v2
109
107
- name : Run Tests
110
108
uses : nick-fields/retry@v2.8.3
111
109
with :
112
110
timeout_minutes : 5
113
111
max_attempts : 3
114
- command : pnpm run test:react:17 --base=${{ github.event.pull_request.base.sha }}
112
+ command : npx nx affected --targets= test:lib --base=${{ github.event.pull_request.base.sha }}
115
113
env :
116
114
REACTJS_VERSION : 17
117
- test-build :
118
- name : ' Test Build'
119
- runs-on : ubuntu-latest
120
- steps :
121
- - uses : actions/checkout@v3
122
- - uses : pnpm/action-setup@v2.2.4
123
- with :
124
- version : 7
125
- - uses : actions/setup-node@v3
126
- with :
127
- node-version : 16.14.2
128
- cache : ' pnpm'
129
- - name : Install dependencies
130
- run : pnpm --filter "./packages/**" --filter query --prefer-offline install
131
- - run : pnpm run test:build
132
- env :
133
- BUNDLEWATCH_GITHUB_TOKEN : ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
0 commit comments