Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LudovicTOURMAN committed Jan 2, 2024
1 parent 125042e commit 20d8ecc
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 5 deletions.
58 changes: 53 additions & 5 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
failing-test:
needs: [build]
runs-on: ubuntu-latest
name: "failing-test [trigger+wait|by workflow filename|shoud report failure]"
name: "failing-test [trigger+wait|by workflow filename|should report failure]"
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
timeout-test:
needs: [build]
runs-on: ubuntu-latest
name: "timeout-test [trigger+wait|by workflow filename|shoud report timed_out]"
name: "timeout-test [trigger+wait|by workflow filename|should report timed_out]"
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
print-workflow-logs-test:
needs: [build]
runs-on: ubuntu-latest
name: "print-workflow-logs-test [trigger+wait|by workflow filename|print logs|shoud report timed_out]"
name: "print-workflow-logs-test [trigger+wait|by workflow filename|print logs|should report timed_out]"
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -198,10 +198,58 @@ jobs:
# - name: Invoke external workflow using this action
# uses: ./
# with:
# workflow: Deploy To Kubernetes
# workflow: Deploy To Kubernetes
# repo: benc-uk/dapr-store
# token: ${{ secrets.PERSONAL_TOKEN }}
# ref: master
# ref: master

parallel-runs-test:
needs: [build]
runs-on: ubuntu-latest
name: "parallel-runs-test [trigger+wait|by workflow filename|should succeed]"
strategy:
fail-fast: false
matrix:
environment:
- trunk
- staging
env:
RUN_NAME: ${{ github.repository }}/actions/runs/${{ github.run_id }}/envs/${{ matrix.environment }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Download dist
uses: actions/download-artifact@v3
with:
name: build
path: dist
- name: Invoke 'named-run' workflow for this environment and wait for result using this action
id: named-run-workflow
uses: ./
with:
workflow: named-run.yml
token: ${{ secrets.PERSONAL_TOKEN }}
run-name: ${{ env.RUN_NAME }}
wait-for-completion-interval: 10s
wait-for-completion-timeout: 120s
workflow-logs: print
inputs: >-
{
"run-name": "${{ env.RUN_NAME }}"
}
continue-on-error: true
- uses: nick-invision/assert-action@v1
with:
expected: success
actual: ${{ steps.named-run-workflow.outputs.workflow-conclusion }}
- uses: nick-invision/assert-action@v1
with:
expected: success
actual: ${{ steps.named-run-workflow.outcome }}
- uses: nick-invision/assert-action@v1
with:
expected: "Run name: ${{ env.RUN_NAME }}"
actual: ${{ steps.named-run-workflow.outcome }}

deploy:
needs:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/named-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Named run
run-name: ${{ inputs.run-name }}

on:
workflow_dispatch:
inputs:
run-name:
description: 'The distinct run name used to retrieve the run ID. Defaults to the workflow name'
type: string
required: false

jobs:
echo:
runs-on: ubuntu-latest
steps:
- name: Sleep
run: sleep 10s
- name: Echo message
run: |
echo 'Run name: ${{ github.event.inputs.run-name || github.workflow }}'

0 comments on commit 20d8ecc

Please sign in to comment.