Skip to content

Commit 373b5d5

Browse files
ZackDeRoseTkDodo
andauthoredApr 28, 2023
chore: Adding DTE to the PR workflow (#5256)
* setting up pr workflow for dte * fixing yml syntax error * fixing more pr workflow errors * fixing more pr workflow errors * removing coverage upload step from agents * starting the ci run * making the test:build cacheable * setting matrix down to 4 total agents * rm NX_VERBOSE_LOGGING env var in workflow files * rm option to skip nx cache * testing with parallel option of 1 * adding affected base option * busting cache * adding root package.json as dep * adding parallel=2 option and busting cache * default parallel option and busting cache * rm debris from cache-busting for time tests --------- Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
1 parent 8f468aa commit 373b5d5

File tree

4 files changed

+35
-54
lines changed

4 files changed

+35
-54
lines changed
 

‎.github/workflows/ci-v3.yml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- 'v3'
77
env:
88
NX_DAEMON: false
9-
NX_VERBOSE_LOGGING: true
109
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1110
jobs:
1211
test:

‎.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ on:
1515
- 'beta'
1616
env:
1717
NX_DAEMON: false
18-
NX_VERBOSE_LOGGING: true
1918
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
2019
jobs:
2120
test-and-publish:

‎.github/workflows/pr.yml

+32-51
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ name: pr
22
on: [pull_request]
33
env:
44
NX_DAEMON: false
5-
NX_VERBOSE_LOGGING: true
65
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
76
jobs:
8-
test:
9-
name: 'Test'
7+
agent:
8+
name: 'Nx Cloud Agents'
109
runs-on: ubuntu-latest
10+
timeout-minutes: 20
11+
strategy:
12+
matrix:
13+
agent: [1, 2, 3, 4]
1114
steps:
1215
- uses: actions/checkout@v3
1316
with:
@@ -23,16 +26,10 @@ jobs:
2326
cache: 'pnpm'
2427
- name: Install dependencies
2528
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'
3633
runs-on: ubuntu-latest
3734
steps:
3835
- uses: actions/checkout@v3
@@ -49,26 +46,25 @@ jobs:
4946
cache: 'pnpm'
5047
- name: Install dependencies
5148
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 }}
6660
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
7268
format:
7369
name: 'Format'
7470
runs-on: ubuntu-latest
@@ -87,7 +83,7 @@ jobs:
8783
cache: 'pnpm'
8884
- name: Install dependencies
8985
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
9187
test-react-17:
9288
name: 'Test React 17'
9389
runs-on: ubuntu-latest
@@ -106,28 +102,13 @@ jobs:
106102
cache: 'pnpm'
107103
- name: Install dependencies
108104
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
109107
- name: Run Tests
110108
uses: nick-fields/retry@v2.8.3
111109
with:
112110
timeout_minutes: 5
113111
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 }}
115113
env:
116114
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 }}

‎nx.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"test:lib",
88
"test:eslint",
99
"test:types",
10+
"test:build",
1011
"build:types",
1112
"build",
1213
"rollup"
@@ -27,7 +28,8 @@
2728
"{workspaceRoot}/rollup.config.js",
2829
"{workspaceRoot}/rollup.config.ts",
2930
"{workspaceRoot}/tsconfig.json",
30-
"{workspaceRoot}/tsconfig.base.json"
31+
"{workspaceRoot}/tsconfig.base.json",
32+
"{workspaceRoot}/package.json"
3133
],
3234
"globalNonBuildAffectingConfig": [
3335
"{workspaceRoot}/.eslintrc",

0 commit comments

Comments
 (0)