DDO-3037: Add support for filtering workflow dispatch runs by run-name. #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Build with ncc | |
run: | | |
npm install -g yarn | |
yarn install | |
yarn run build | |
- name: Archive dist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
echo-1-test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
name: "echo-1-test [trigger|by workflow name]" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Download dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Invoke echo 1 workflow using this action (do not wait for completion) | |
uses: ./ | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
workflow: Message Echo 1 | |
token: ${{ secrets.BROADBOT_TOKEN }} | |
inputs: '{"message": "blah blah"}' | |
wait-for-completion: false | |
echo-2-test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
name: "echo-2-test [trigger|by workflow filename|may confuse with concurrent echo-2]" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Download dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Invoke echo 2 workflow using this action | |
uses: ./ | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
workflow: echo-02.yaml | |
token: ${{ secrets.BROADBOT_TOKEN }} | |
wait-for-completion: false | |
long-running-test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
name: "long-running-test [trigger+wait|by workflow filename|shoud succeed]" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Download dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Invoke 'long-running' workflow and wait for result using this action | |
id: long-running-workflow | |
uses: ./ | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
workflow: long-running.yml | |
token: ${{ secrets.BROADBOT_TOKEN }} | |
wait-for-completion-interval: 10s | |
wait-for-completion-timeout: 5m | |
continue-on-error: true | |
- uses: nick-invision/assert-action@v1 | |
with: | |
expected: success | |
actual: ${{ steps.long-running-workflow.outputs.workflow-conclusion }} | |
- uses: nick-invision/assert-action@v1 | |
with: | |
expected: success | |
actual: ${{ steps.long-running-workflow.outcome }} | |
failing-test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
name: "failing-test [trigger+wait|by workflow filename|shoud report failure]" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Download dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Invoke 'failing' workflow and wait for result using this action | |
id: failing-workflow | |
uses: ./ | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
workflow: failing.yml | |
token: ${{ secrets.BROADBOT_TOKEN }} | |
wait-for-completion-interval: 10s | |
wait-for-completion-timeout: 5m | |
continue-on-error: true | |
- run: echo "worflow-conclusion=${{ steps.failing-workflow.outputs.workflow-conclusion }}" | |
- uses: nick-invision/assert-action@v1 | |
with: | |
expected: failure | |
actual: ${{ steps.failing-workflow.outputs.workflow-conclusion }} | |
- uses: nick-invision/assert-action@v1 | |
with: | |
expected: failure | |
actual: ${{ steps.failing-workflow.outcome }} | |
timeout-test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
name: "timeout-test [trigger+wait|by workflow filename|shoud report timed_out]" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Download dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Invoke 'timeout' workflow and wait for result using this action | |
id: timeout-workflow | |
uses: ./ | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
workflow: timeout.yml | |
token: ${{ secrets.BROADBOT_TOKEN }} | |
wait-for-completion-interval: 10s | |
wait-for-completion-timeout: 30s | |
continue-on-error: true | |
- uses: nick-invision/assert-action@v1 | |
with: | |
expected: timed_out | |
actual: ${{ steps.timeout-workflow.outputs.workflow-conclusion }} | |
- uses: nick-invision/assert-action@v1 | |
with: | |
expected: failure | |
actual: ${{ steps.timeout-workflow.outcome }} | |
concurrent-echo-2-test: | |
needs: [build] | |
strategy: | |
matrix: | |
msg : [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ] | |
runs-on: ubuntu-latest | |
name: "concurrent-echo-2-test [trigger|by workflow filename|confusing workflow run id should not happen]" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Download dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Invoke concurrent echo-2 workflows using this action | |
id: concurrent-echo-2 | |
uses: ./ | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
run-name: "echo-02-${{ matrix.msg }}" | |
workflow: echo-02.yaml | |
token: ${{ secrets.BROADBOT_TOKEN }} | |
inputs: '{ | |
"message": "${{ matrix.msg }}", | |
"run-name": "echo-02-${{ matrix.msg }}" | |
}' |