Skip to content

Commit

Permalink
workflow filter via sel4projects.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Heider <[email protected]>
  • Loading branch information
axel-h authored and Axel Heider committed Jun 14, 2024
1 parent 93c9071 commit 4d1dada
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 49 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/sel4bench-hw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ name: seL4Bench-HW

on:
workflow_call:
inputs:
hw:
type: boolean
required: false
default: false

# intended to run on
# pull_request_target:
# types: [opened, reopened, synchronize, labeled]

# downgrade permissions to read-only as you would have in a standard PR action
permissions:
Expand All @@ -21,13 +23,6 @@ jobs:
code:
name: Freeze Code
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request_target' &&
(
github.event.action != 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'hw-bench') ||
github.event.action == 'labeled' &&
github.event.label.name == 'hw-bench'
) }}
outputs:
xml: ${{ steps.repo.outputs.xml }}
steps:
Expand All @@ -42,11 +37,6 @@ jobs:
name: Build
needs: code
runs-on: ubuntu-latest
# To reduce the load on GitHub runner numbers and machine queue we cancel
# any older runs of this workflow for the current PR.
concurrency:
group: ${{ github.workflow }}-sel4bench-build-pr-${{ github.event.number }}-${{ strategy.job-index }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
Expand All @@ -65,12 +55,9 @@ jobs:

hw-run:
name: HW Benchmark
if: ${{ github.repository_owner == 'seL4' }}
if: ${{ github.repository_owner == 'seL4' && inputs.hw }}
runs-on: ubuntu-latest
needs: [build]
concurrency:
group: ${{ github.workflow }}-sel4bench-hw-run-pr-${{ github.event.number }}-${{ strategy.job-index }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/sel4projects.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2024, Axel Heider
#
# SPDX-License-Identifier: BSD-2-Clause

name: sel4-projects

on:
workflow_call:

# intended to run on
# pull_request_target:
# types: [opened, reopened, synchronize, labeled]
# needs PR target for secrets access; guard by requiring label

# downgrade permissions to read-only as you would have in a standard PR action
permissions:
contents: read

jobs:
check:
if: ${{ github.event_name == 'pull_request_target' }}
outputs:
sel4test: ${{ ((github.event.action != 'labeled') &&
(contains(github.event.pull_request.labels.*.name, 'hw-build') ||
contains(github.event.pull_request.labels.*.name, 'hw-test'))) ||
((github.event.action == 'labeled') &&
((github.event.label.name == 'hw-build') ||
(github.event.label.name == 'hw-test'))) }}
sel4bench: ${{ ((github.event.action == 'labeled') &&
(github.event.label.name == 'hw-bench')) ||
((github.event.action != 'labeled') &&
contains(github.event.pull_request.labels.*.name, 'hw-bench')) }}
runs-on: ubuntu-latest
steps:
- run: echo "dummy"

sel4test:
name: sel4test
needs: [check]
if: ${{ needs.check.outputs.sel4test }}
concurrency:
group: ${{ github.workflow }}-sel4test-pr-${{ github.event.number }}
cancel-in-progress: true
uses: axel-h/ci-actions/.github/workflows/sel4test-hw.yml@patch-axel-7
with:
hw: ${{ contains(github.event.pull_request.labels.*.name, 'hw-build') }}
secrets: inherit

sel4bench:
name: sel4bench
needs: [check]
if: ${{ needs.check.outputs.sel4bench }}
concurrency:
group: ${{ github.workflow }}-sel4bench-pr-${{ github.event.number }}
cancel-in-progress: true
uses: axel-h/ci-actions/.github/workflows/sel4bench-hw.yml@patch-axel-7
with:
hw: ${{ contains(github.event.pull_request.labels.*.name, 'hw-bench') }}
secrets: inherit
36 changes: 6 additions & 30 deletions .github/workflows/sel4test-hw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ name: seL4Test-HW

on:
workflow_call:

# intended to run on
# pull_request_target:
# types: [opened, reopened, synchronize, labeled]
# needs PR target for secrets access; guard by requiring label
inputs:
hw:
type: boolean
required: false
default: false

# downgrade permissions to read-only as you would have in a standard PR action
permissions:
Expand All @@ -24,15 +24,6 @@ jobs:
code:
name: Freeze Code
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request_target' &&
(
github.event.action != 'labeled' &&
(contains(github.event.pull_request.labels.*.name, 'hw-build') ||
contains(github.event.pull_request.labels.*.name, 'hw-test')) ||
github.event.action == 'labeled' &&
(github.event.label.name == 'hw-build' ||
github.event.label.name == 'hw-test')
) }}
outputs:
xml: ${{ steps.repo.outputs.xml }}
steps:
Expand All @@ -47,11 +38,6 @@ jobs:
name: HW Build
runs-on: ubuntu-latest
needs: code
# To reduce the load (especially on the machine queue) we cancel any older
# runs of this workflow for the current PR.
concurrency:
group: ${{ github.workflow }}-sel4test-build-pr-${{ github.event.number }}-${{ strategy.job-index }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -90,17 +76,7 @@ jobs:
name: HW Run
runs-on: ubuntu-latest
needs: the_matrix
if: ${{ github.repository_owner == 'seL4' &&
(github.event_name == 'push' ||
github.event_name == 'pull_request_target' &&
github.event.action != 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'hw-test') ||
github.event_name == 'pull_request_target' &&
github.event.action == 'labeled' &&
github.event.label.name == 'hw-test') }}
concurrency:
group: ${{ github.workflow }}-sel4test-hw-run-pr-${{ github.event.number }}-${{ strategy.job-index }}
cancel-in-progress: true
if: ${{ github.repository_owner == 'seL4' && inputs.hw }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.the_matrix.outputs.matrix) }}
Expand Down

0 comments on commit 4d1dada

Please sign in to comment.