@@ -24,6 +24,117 @@ jobs:
2424 directory : ./coverage/
2525 verbose : true
2626
27+ ci_integration :
28+ name : Run Integration Tests
29+ if : startsWith(github.ref, 'refs/heads')
30+ runs-on : ubuntu-latest
31+ steps :
32+ - name : Checkout
33+ uses : actions/checkout@v2
34+ - name : Setup Node.js
35+ uses : actions/setup-node@v1
36+ with :
37+ node-version : 16
38+ - name : Install dependencies
39+ run : npm ci
40+
41+ - name : happy-path
42+ id : happy_path
43+ uses : ./
44+ with :
45+ timeout_minutes : 1
46+ max_attempts : 2
47+ command : npm -v
48+ - uses : nick-invision/assert-action@v1
49+ with :
50+ expected : true
51+ actual : ${{ steps.happy_path.outputs.total_attempts == '1' && steps.happy_path.outputs.exit_code == '0' }}
52+
53+ - name : log examples
54+ uses : ./
55+ with :
56+ command : node ./.github/scripts/log-examples.js
57+ timeout_minutes : 1
58+
59+ - name : sad-path (error)
60+ id : sad_path_error
61+ uses : ./
62+ continue-on-error : true
63+ with :
64+ timeout_minutes : 1
65+ max_attempts : 2
66+ command : node -e "process.exit(1)"
67+ - uses : nick-invision/assert-action@v1
68+ with :
69+ expected : 2
70+ actual : ${{ steps.sad_path_error.outputs.total_attempts }}
71+ - uses : nick-invision/assert-action@v1
72+ with :
73+ expected : failure
74+ actual : ${{ steps.sad_path_error.outcome }}
75+
76+ - name : retry_on (timeout) fails early if error encountered
77+ id : retry_on_timeout_fail
78+ uses : ./
79+ continue-on-error : true
80+ with :
81+ timeout_minutes : 1
82+ max_attempts : 3
83+ retry_on : timeout
84+ command : node -e "process.exit(2)"
85+ - uses : nick-invision/assert-action@v1
86+ with :
87+ expected : 1
88+ actual : ${{ steps.retry_on_timeout_fail.outputs.total_attempts }}
89+ - uses : nick-invision/assert-action@v1
90+ with :
91+ expected : failure
92+ actual : ${{ steps.retry_on_timeout_fail.outcome }}
93+ - uses : nick-invision/assert-action@v1
94+ with :
95+ expected : 2
96+ actual : ${{ steps.retry_on_timeout_fail.outputs.exit_code }}
97+
98+ - name : retry_on (error)
99+ id : retry_on_error
100+ uses : ./
101+ continue-on-error : true
102+ with :
103+ timeout_minutes : 1
104+ max_attempts : 2
105+ retry_on : error
106+ command : node -e "process.exit(2)"
107+ - uses : nick-invision/assert-action@v1
108+ with :
109+ expected : 2
110+ actual : ${{ steps.retry_on_error.outputs.total_attempts }}
111+ - uses : nick-invision/assert-action@v1
112+ with :
113+ expected : failure
114+ actual : ${{ steps.retry_on_error.outcome }}
115+ - uses : nick-invision/assert-action@v1
116+ with :
117+ expected : 2
118+ actual : ${{ steps.retry_on_error.outputs.exit_code }}
119+
120+ - name : sad-path (wrong shell for OS)
121+ id : wrong_shell
122+ uses : ./
123+ continue-on-error : true
124+ with :
125+ timeout_minutes : 1
126+ max_attempts : 2
127+ shell : cmd
128+ command : ' dir'
129+ - uses : nick-invision/assert-action@v1
130+ with :
131+ expected : 2
132+ actual : ${{ steps.wrong_shell.outputs.total_attempts }}
133+ - uses : nick-invision/assert-action@v1
134+ with :
135+ expected : failure
136+ actual : ${{ steps.wrong_shell.outcome }}
137+
27138 ci_integration_envvar :
28139 name : Run Integration Env Var Tests
29140 if : startsWith(github.ref, 'refs/heads')
@@ -175,8 +286,8 @@ jobs:
175286 expected : success
176287 actual : ${{ steps.sad_path_continue_on_error.outcome }}
177288
178- ci_integration :
179- name : Run Integration Tests
289+ ci_integration_retry_wait_seconds :
290+ name : Run Integration Tests (retry_wait_seconds)
180291 if : startsWith(github.ref, 'refs/heads')
181292 runs-on : ubuntu-latest
182293 steps :
@@ -189,24 +300,6 @@ jobs:
189300 - name : Install dependencies
190301 run : npm ci
191302
192- - name : happy-path
193- id : happy_path
194- uses : ./
195- with :
196- timeout_minutes : 1
197- max_attempts : 2
198- command : npm -v
199- - uses : nick-invision/assert-action@v1
200- with :
201- expected : true
202- actual : ${{ steps.happy_path.outputs.total_attempts == '1' && steps.happy_path.outputs.exit_code == '0' }}
203-
204- - name : log examples
205- uses : ./
206- with :
207- command : node ./.github/scripts/log-examples.js
208- timeout_minutes : 1
209-
210303 - name : sad-path (retry_wait_seconds)
211304 id : sad_path_wait_sec
212305 uses : ./
@@ -230,6 +323,20 @@ jobs:
230323 actual : ${{ steps.sad_path_wait_sec.outputs.exit_error }}
231324 comparison : contains
232325
326+ ci_integration_on_retry_cmd :
327+ name : Run Integration Tests (on_retry_command)
328+ if : startsWith(github.ref, 'refs/heads')
329+ runs-on : ubuntu-latest
330+ steps :
331+ - name : Checkout
332+ uses : actions/checkout@v2
333+ - name : Setup Node.js
334+ uses : actions/setup-node@v1
335+ with :
336+ node-version : 16
337+ - name : Install dependencies
338+ run : npm ci
339+
233340 - name : new-command-on-retry
234341 id : new-command-on-retry
235342 uses : ./
@@ -259,88 +366,9 @@ jobs:
259366 command : node -e "process.exit(1)"
260367 on_retry_command : node -e "throw new Error('This is an on-retry command error')"
261368
262- - name : sad-path (error)
263- id : sad_path_error
264- uses : ./
265- continue-on-error : true
266- with :
267- timeout_minutes : 1
268- max_attempts : 2
269- command : node -e "process.exit(1)"
270- - uses : nick-invision/assert-action@v1
271- with :
272- expected : 2
273- actual : ${{ steps.sad_path_error.outputs.total_attempts }}
274- - uses : nick-invision/assert-action@v1
275- with :
276- expected : failure
277- actual : ${{ steps.sad_path_error.outcome }}
278-
279- - name : retry_on (timeout) fails early if error encountered
280- id : retry_on_timeout_fail
281- uses : ./
282- continue-on-error : true
283- with :
284- timeout_minutes : 1
285- max_attempts : 3
286- retry_on : timeout
287- command : node -e "process.exit(2)"
288- - uses : nick-invision/assert-action@v1
289- with :
290- expected : 1
291- actual : ${{ steps.retry_on_timeout_fail.outputs.total_attempts }}
292- - uses : nick-invision/assert-action@v1
293- with :
294- expected : failure
295- actual : ${{ steps.retry_on_timeout_fail.outcome }}
296- - uses : nick-invision/assert-action@v1
297- with :
298- expected : 2
299- actual : ${{ steps.retry_on_timeout_fail.outputs.exit_code }}
300-
301- - name : retry_on (error)
302- id : retry_on_error
303- uses : ./
304- continue-on-error : true
305- with :
306- timeout_minutes : 1
307- max_attempts : 2
308- retry_on : error
309- command : node -e "process.exit(2)"
310- - uses : nick-invision/assert-action@v1
311- with :
312- expected : 2
313- actual : ${{ steps.retry_on_error.outputs.total_attempts }}
314- - uses : nick-invision/assert-action@v1
315- with :
316- expected : failure
317- actual : ${{ steps.retry_on_error.outcome }}
318- - uses : nick-invision/assert-action@v1
319- with :
320- expected : 2
321- actual : ${{ steps.retry_on_error.outputs.exit_code }}
322-
323- - name : sad-path (wrong shell for OS)
324- id : wrong_shell
325- uses : ./
326- continue-on-error : true
327- with :
328- timeout_minutes : 1
329- max_attempts : 2
330- shell : cmd
331- command : ' dir'
332- - uses : nick-invision/assert-action@v1
333- with :
334- expected : 2
335- actual : ${{ steps.wrong_shell.outputs.total_attempts }}
336- - uses : nick-invision/assert-action@v1
337- with :
338- expected : failure
339- actual : ${{ steps.wrong_shell.outcome }}
340-
341369 # timeout tests take longer to run so run in parallel
342- ci_integration_timeout :
343- name : Run Integration Timeout Tests
370+ ci_integration_timeout_seconds :
371+ name : Run Integration Timeout Tests (seconds)
344372 if : startsWith(github.ref, 'refs/heads')
345373 runs-on : ubuntu-latest
346374 steps :
@@ -370,6 +398,20 @@ jobs:
370398 expected : failure
371399 actual : ${{ steps.sad_path_timeout.outcome }}
372400
401+ ci_integration_timeout_retry_on_timeout :
402+ name : Run Integration Timeout Tests (retry_on timeout)
403+ if : startsWith(github.ref, 'refs/heads')
404+ runs-on : ubuntu-latest
405+ steps :
406+ - name : Checkout
407+ uses : actions/checkout@v2
408+ - name : Setup Node.js
409+ uses : actions/setup-node@v1
410+ with :
411+ node-version : 16
412+ - name : Install dependencies
413+ run : npm ci
414+
373415 - name : retry_on (timeout)
374416 id : retry_on_timeout
375417 uses : ./
@@ -388,6 +430,20 @@ jobs:
388430 expected : failure
389431 actual : ${{ steps.retry_on_timeout.outcome }}
390432
433+ ci_integration_timeout_retry_on_error :
434+ name : Run Integration Timeout Tests (retry_on error)
435+ if : startsWith(github.ref, 'refs/heads')
436+ runs-on : ubuntu-latest
437+ steps :
438+ - name : Checkout
439+ uses : actions/checkout@v2
440+ - name : Setup Node.js
441+ uses : actions/setup-node@v1
442+ with :
443+ node-version : 16
444+ - name : Install dependencies
445+ run : npm ci
446+
391447 - name : retry_on (error) fails early if timeout encountered
392448 id : retry_on_error_fail
393449 uses : ./
@@ -410,6 +466,20 @@ jobs:
410466 expected : 1
411467 actual : ${{ steps.retry_on_error_fail.outputs.exit_code }}
412468
469+ ci_integration_timeout_minutes :
470+ name : Run Integration Timeout Tests (minutes)
471+ if : startsWith(github.ref, 'refs/heads')
472+ runs-on : ubuntu-latest
473+ steps :
474+ - name : Checkout
475+ uses : actions/checkout@v2
476+ - name : Setup Node.js
477+ uses : actions/setup-node@v1
478+ with :
479+ node-version : 16
480+ - name : Install dependencies
481+ run : npm ci
482+
413483 - name : sad-path (timeout minutes)
414484 id : sad_path_timeout_minutes
415485 uses : ./
@@ -421,11 +491,11 @@ jobs:
421491 - uses : nick-invision/assert-action@v1
422492 with :
423493 expected : 2
424- actual : ${{ steps.sad_path_timeout .outputs.total_attempts }}
494+ actual : ${{ steps.sad_path_timeout_minutes .outputs.total_attempts }}
425495 - uses : nick-invision/assert-action@v1
426496 with :
427497 expected : failure
428- actual : ${{ steps.sad_path_timeout .outcome }}
498+ actual : ${{ steps.sad_path_timeout_minutes .outcome }}
429499
430500 ci_windows :
431501 name : Run Windows Tests
@@ -479,10 +549,32 @@ jobs:
479549 echo "this is
480550 a test"
481551
552+ ci_all_tests_passed :
553+ name : All tests passed
554+ needs :
555+ [
556+ ci_unit,
557+ ci_integration,
558+ ci_integration_envvar,
559+ ci_integration_large_output,
560+ ci_integration_on_retry_cmd,
561+ ci_integration_retry_wait_seconds,
562+ ci_integration_continue_on_error,
563+ ci_integration_retry_on_exit_code,
564+ ci_integration_timeout_seconds,
565+ ci_integration_timeout_minutes,
566+ ci_integration_timeout_retry_on_timeout,
567+ ci_integration_timeout_retry_on_error,
568+ ci_windows,
569+ ]
570+ runs-on : ubuntu-latest
571+ steps :
572+ - run : echo "If this is hit, all tests successfully passed"
573+
482574 # runs on push to master only
483575 cd :
484576 name : Publish Action
485- needs : [ci_integration, ci_integration_timeout, ci_windows ]
577+ needs : [ci_all_tests_passed ]
486578 if : github.ref == 'refs/heads/master'
487579 runs-on : ubuntu-latest
488580 steps :
0 commit comments