@@ -6,25 +6,48 @@ concurrency:
6
6
7
7
on :
8
8
pull_request :
9
- paths-ignore :
10
- - ' apps/**/*.md'
11
9
push :
12
10
branches :
13
11
- " [0-9][0-9]_[0-9]"
14
12
15
13
env :
14
+ NX_CLOUD_DISTRIBUTED_EXECUTION : true # this enables DTE
15
+ NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT : 3 # expected number of agents
16
+ NX_BRANCH : ${{ github.event.number || github.ref_name }}
17
+ # NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
18
+ # NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # this is needed if our pipeline publishes to npm
16
19
NX_SKIP_NX_CACHE : ${{ (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'skip-cache')) && 'true' || 'false' }}
17
20
18
21
jobs :
19
22
main :
20
23
name : main
21
24
runs-on : devextreme-shr2
22
- timeout-minutes : 30
23
-
25
+ timeout-minutes : 90
26
+
24
27
steps :
28
+ - name : Set machine timezone
29
+ run : |
30
+ sudo ln -sf "/usr/share/zoneinfo/$([ "${{ matrix.ARGS.timezone }}" != "" ] && echo "${{ matrix.ARGS.timezone }}" || echo "GMT")" /etc/localtime
31
+ date
32
+
25
33
- name : Get sources
26
34
uses : actions/checkout@v4
27
35
36
+ - name : Download artifacts
37
+ uses : actions/download-artifact@v3
38
+ with :
39
+ name : devextreme-artifacts
40
+ path : ./packages/devextreme
41
+
42
+ - name : Unpack artifacts
43
+ working-directory : ./packages/devextreme
44
+ run : 7z x artifacts.zip -aoa
45
+
46
+ - name : Setup Chrome
47
+ uses : ./.github/actions/setup-chrome
48
+ with :
49
+ chrome-version : ' 121.0.6167.160'
50
+
28
51
- name : Use Node.js
29
52
uses : actions/setup-node@v4
30
53
with :
@@ -55,19 +78,105 @@ jobs:
55
78
corepack enable
56
79
pnpm install
57
80
58
- - name : Run targets
59
- run : >
60
- pnpx nx run-many
61
- -t test
62
- --exclude
63
- devextreme
64
- devextreme-themebuilder
65
- devextreme-angular
66
- devextreme-react
67
- devextreme-vue
68
- devextreme-react-storybook
69
- devextreme-angular-playground
70
- devextreme-testcafe-tests
71
- devextreme-demos
72
- devextreme-react-playground
73
- devextreme-vue-playground
81
+ - name : Initialize the Nx Cloud distributed CI run and stop agents when the build tasks are done
82
+ run : pnpm nx-cloud start-ci-run
83
+
84
+ - name : Run commands in parallel
85
+ run : |
86
+ # initialize an array to store process IDs (PIDs)
87
+ pids=()
88
+
89
+ # function to run commands and store the PID
90
+ function run_command() {
91
+ local command=$1
92
+ $command & # run the command in the background
93
+ pids+=($!) # store the PID of the background process
94
+ }
95
+
96
+ # list of commands to be run on main has env flag NX_CLOUD_DISTRIBUTED_EXECUTION set to false
97
+ # run_command "NX_CLOUD_DISTRIBUTED_EXECUTION=false pnpm nx-cloud record -- nx format:check"
98
+
99
+ # list of commands to be run on agents
100
+ run_command "pnpm nx run-many --targets test,e2e --exclude devextreme devextreme-themebuilder devextreme-angular devextreme-react devextreme-vue devextreme-react-storybook devextreme-main devextreme-angular-playground devextreme-demos devextreme-react-playground devextreme-vue-playground"
101
+
102
+ # wait for all background processes to finish
103
+ for pid in ${pids[*]}; do
104
+ if ! wait $pid; then
105
+ exit 1 # exit with an error status if any process fails
106
+ fi
107
+ done
108
+
109
+ exit 0 # exits with success status if a all processes complete successfully
110
+
111
+ - name : Upload artifacts
112
+ uses : actions/upload-artifact@v4
113
+ if : always()
114
+ with :
115
+ name : profile
116
+ path : profile.json
117
+
118
+ agents :
119
+ name : Agent ${{ matrix.agent }}
120
+ runs-on : devextreme-shr2
121
+ strategy :
122
+ matrix :
123
+ # Add more agents here as your repository expands
124
+ agent : [1, 2, 3]
125
+ steps :
126
+ - name : Set machine timezone
127
+ run : |
128
+ sudo ln -sf "/usr/share/zoneinfo/$([ "${{ matrix.ARGS.timezone }}" != "" ] && echo "${{ matrix.ARGS.timezone }}" || echo "GMT")" /etc/localtime
129
+ date
130
+
131
+ - name : Get sources
132
+ uses : actions/checkout@v4
133
+
134
+ - name : Download artifacts
135
+ uses : actions/download-artifact@v3
136
+ with :
137
+ name : devextreme-artifacts
138
+ path : ./packages/devextreme
139
+
140
+ - name : Unpack artifacts
141
+ working-directory : ./packages/devextreme
142
+ run : 7z x artifacts.zip -aoa
143
+
144
+ - name : Setup Chrome
145
+ uses : ./.github/actions/setup-chrome
146
+ with :
147
+ chrome-version : ' 121.0.6167.160'
148
+
149
+ - name : Use Node.js
150
+ uses : actions/setup-node@v4
151
+ with :
152
+ node-version : ' 20'
153
+
154
+ - uses : pnpm/action-setup@v3
155
+ with :
156
+ version : 9
157
+ run_install : false
158
+
159
+ - name : Get pnpm store directory
160
+ shell : bash
161
+ run : |
162
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
163
+
164
+ - uses : actions/cache@v4
165
+ name : Setup pnpm cache
166
+ with :
167
+ path : |
168
+ ${{ env.STORE_PATH }}
169
+ .nx/cache
170
+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
171
+ restore-keys : |
172
+ ${{ runner.os }}-pnpm-store
173
+
174
+ - name : Install dependencies
175
+ run : |
176
+ corepack enable
177
+ pnpm install
178
+
179
+ - name : Start Nx Agent ${{ matrix.agent }}
180
+ run : pnpm nx-cloud start-agent
181
+ env :
182
+ NX_AGENT_NAME : ${{ matrix.agent }}
0 commit comments