Skip to content

Commit

Permalink
treadmill-ci: add manual workflow dispatch trigger
Browse files Browse the repository at this point in the history
This adds the ability to manually dispatch Treadmill hardware CI
workflows for arbitrary branches of the Tock kernel and libtock-c
repositories. This can be used to, e.g., test PRs made from branches
of the kernel repository before merge, or test branches other than
master (like release branches).
  • Loading branch information
lschuermann committed Dec 30, 2024
1 parent 041f57e commit 1e53035
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/treadmill-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,25 @@ on:
# allows this workflow to run without access to repository secrets.
#pull_request:
merge_group: # Run CI for the GitHub merge queue
# Manually dispatch for a specific branch (will require approval
# through the treadmill-ci-merged environment:
workflow_dispatch:
inputs:
tock-kernel-ref:
description: 'Ref (revision/branch/tag) of the upstream Tock repo to test'
required: true
default: 'master'
libtock-c-ref:
description: 'Ref (revision/branch/tag) of the upstream libtock-c repo to test'
required: true
default: 'master'
tests-json:
description: 'tests-json value passed to HWCI workflow (if empty, output from determine-tests step is used)'
required: false

permissions:
contents: read

jobs:
determine-tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -94,7 +110,7 @@ jobs:

# This checks whether there is at least one test to run, see
# https://github.com/orgs/community/discussions/27125#discussioncomment-3254720
if: fromJSON(needs.determine-tests.outputs.hwci-tests-json)[0] != null
if: fromJSON(needs.determine-tests.outputs.hwci-tests-json)[0] != null || github.event_name == 'workflow_dispatch'

# The main tock-hardware-ci workflow is imported from another repository. It
# can be reused across multiple Tock repositories such as the kernel,
Expand All @@ -108,21 +124,21 @@ jobs:
repository-filter: 'tock/tock'

# Provide access to the required Treadmill secrets by running in the
# appropriate environment (depending on the on: triggers above)
job-environment: ${{ github.event_name == 'pull_request' && 'treadmill-ci' || 'treadmill-ci-merged' }}

# Use the latest upstream Tock hardware CI tests and userspace components:
libtock-c-ref: 'master'
# appropriate environment (depending on the `on:` triggers above)
job-environment: ${{ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch') && 'treadmill-ci' || 'treadmill-ci-merged' }}

# Reference for tock-hardware-ci repo, change if you want a specific test
# suite. In this case, you should also update the branch reference in the
# suite. In this case, you should also update the branch reference in the
# "uses" line above.
tock-hardware-ci-ref: 'main'

# Test the tock kernel revision that triggered this workflow
tock-kernel-ref: ${{ github.sha }}
# Test the tock kernel revision that triggered this workflow:
tock-kernel-ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tock-kernel-ref || github.sha }}

# Use the latest upstream libtock-c library:
libtock-c-ref: ${{ github.event_name == 'workflow_dispatch' && inputs.libtock-c-ref || 'master' }}

# Pass the selected tests
tests-json: ${{ needs.determine-tests.outputs.hwci-tests-json }}
# Pass the selected tests:
tests-json: ${{ (github.event_name == 'workflow_dispatch' && inputs.tests-json != '') && inputs.tests-json || needs.determine-tests.outputs.hwci-tests-json }}

secrets: inherit

0 comments on commit 1e53035

Please sign in to comment.