Skip to content

Commit 20d8ecc

Browse files
author
Ludovic TOURMAN
committed
Add tests
1 parent 125042e commit 20d8ecc

File tree

2 files changed

+73
-5
lines changed

2 files changed

+73
-5
lines changed

.github/workflows/build-test.yaml

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
failing-test:
106106
needs: [build]
107107
runs-on: ubuntu-latest
108-
name: "failing-test [trigger+wait|by workflow filename|shoud report failure]"
108+
name: "failing-test [trigger+wait|by workflow filename|should report failure]"
109109
steps:
110110
- name: Check out repository
111111
uses: actions/checkout@v3
@@ -136,7 +136,7 @@ jobs:
136136
timeout-test:
137137
needs: [build]
138138
runs-on: ubuntu-latest
139-
name: "timeout-test [trigger+wait|by workflow filename|shoud report timed_out]"
139+
name: "timeout-test [trigger+wait|by workflow filename|should report timed_out]"
140140
steps:
141141
- name: Check out repository
142142
uses: actions/checkout@v3
@@ -166,7 +166,7 @@ jobs:
166166
print-workflow-logs-test:
167167
needs: [build]
168168
runs-on: ubuntu-latest
169-
name: "print-workflow-logs-test [trigger+wait|by workflow filename|print logs|shoud report timed_out]"
169+
name: "print-workflow-logs-test [trigger+wait|by workflow filename|print logs|should report timed_out]"
170170
steps:
171171
- name: Check out repository
172172
uses: actions/checkout@v3
@@ -198,10 +198,58 @@ jobs:
198198
# - name: Invoke external workflow using this action
199199
# uses: ./
200200
# with:
201-
# workflow: Deploy To Kubernetes
201+
# workflow: Deploy To Kubernetes
202202
# repo: benc-uk/dapr-store
203203
# token: ${{ secrets.PERSONAL_TOKEN }}
204-
# ref: master
204+
# ref: master
205+
206+
parallel-runs-test:
207+
needs: [build]
208+
runs-on: ubuntu-latest
209+
name: "parallel-runs-test [trigger+wait|by workflow filename|should succeed]"
210+
strategy:
211+
fail-fast: false
212+
matrix:
213+
environment:
214+
- trunk
215+
- staging
216+
env:
217+
RUN_NAME: ${{ github.repository }}/actions/runs/${{ github.run_id }}/envs/${{ matrix.environment }}
218+
steps:
219+
- name: Check out repository
220+
uses: actions/checkout@v3
221+
- name: Download dist
222+
uses: actions/download-artifact@v3
223+
with:
224+
name: build
225+
path: dist
226+
- name: Invoke 'named-run' workflow for this environment and wait for result using this action
227+
id: named-run-workflow
228+
uses: ./
229+
with:
230+
workflow: named-run.yml
231+
token: ${{ secrets.PERSONAL_TOKEN }}
232+
run-name: ${{ env.RUN_NAME }}
233+
wait-for-completion-interval: 10s
234+
wait-for-completion-timeout: 120s
235+
workflow-logs: print
236+
inputs: >-
237+
{
238+
"run-name": "${{ env.RUN_NAME }}"
239+
}
240+
continue-on-error: true
241+
- uses: nick-invision/assert-action@v1
242+
with:
243+
expected: success
244+
actual: ${{ steps.named-run-workflow.outputs.workflow-conclusion }}
245+
- uses: nick-invision/assert-action@v1
246+
with:
247+
expected: success
248+
actual: ${{ steps.named-run-workflow.outcome }}
249+
- uses: nick-invision/assert-action@v1
250+
with:
251+
expected: "Run name: ${{ env.RUN_NAME }}"
252+
actual: ${{ steps.named-run-workflow.outcome }}
205253

206254
deploy:
207255
needs:

.github/workflows/named-run.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Named run
2+
run-name: ${{ inputs.run-name }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
run-name:
8+
description: 'The distinct run name used to retrieve the run ID. Defaults to the workflow name'
9+
type: string
10+
required: false
11+
12+
jobs:
13+
echo:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Sleep
17+
run: sleep 10s
18+
- name: Echo message
19+
run: |
20+
echo 'Run name: ${{ github.event.inputs.run-name || github.workflow }}'

0 commit comments

Comments
 (0)