Skip to content

Commit

Permalink
[workflow] move test in a reusable workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Manu Bretelle <[email protected]>
  • Loading branch information
chantra committed Oct 25, 2023
1 parent b6206d7 commit a320bab
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 39 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/kernel-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Reusable test workflow

on:
workflow_call:
inputs:
arch:
required: true
type: string
toolchain_full:
required: true
type: string
runs_on:
required: true
type: string
kernel:
required: true
type: string
test:
required: true
type: string
continue_on_error:
required: true
type: boolean
timeout_minutes:
required: true
type: number

jobs:
test:
if: ${{ github.event_name != 'push' }}
name: ${{ inputs.test }} on ${{ inputs.arch }} with ${{ inputs.toolchain_full }}
runs-on: ${{ fromJSON(matrix.runs_on) }}
timeout-minutes: 100
env:
KERNEL: ${{ inputs.kernel }}
REPO_ROOT: ${{ github.workspace }}
REPO_PATH: ""
KBUILD_OUTPUT: kbuild-output/
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}
path: .
- name: Untar artifacts
# zstd is installed by default in the runner images.
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -
- name: Prepare rootfs
uses: libbpf/ci/prepare-rootfs@main
with:
project-name: 'libbpf'
arch: ${{ inputs.arch }}
kernel: ${{ inputs.kernel }}
kernel-root: '.'
kbuild-output: ${{ env.KBUILD_OUTPUT }}
image-output: '/tmp/root.img'
test: ${{ inputs.test }}
- name: Run selftests
uses: libbpf/ci/run-qemu@main
continue-on-error: ${{ inputs.continue_on_error }}
timeout-minutes: ${{ inputs.timeout_minutes }}
with:
arch: ${{ inputs.arch}}
img: '/tmp/root.img'
vmlinuz: '${{ github.workspace }}/vmlinuz'
kernel-root: '.'
max-cpu: 8
kernel-test: ${{ inputs.test }}
49 changes: 10 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,49 +49,20 @@ jobs:
kernel: ${{ matrix.kernel }}

test:
if: ${{ github.event_name != 'push' }}
name: ${{ matrix.test }} on ${{ matrix.arch }} with ${{ matrix.toolchain_full }}
uses: ./.github/workflows/kernel-test.yml
needs: [set-matrix, build]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.set-matrix.outputs.test-matrix) }}
runs-on: ${{ matrix.runs_on }}
timeout-minutes: 100
env:
KERNEL: ${{ matrix.kernel }}
REPO_ROOT: ${{ github.workspace }}
REPO_PATH: ""
KBUILD_OUTPUT: kbuild-output/
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: vmlinux-${{ matrix.arch }}-${{ matrix.toolchain_full }}
path: .
- name: Untar artifacts
# zstd is installed by default in the runner images.
run: zstd -d -T0 vmlinux-${{ matrix.arch }}-${{ matrix.toolchain_full }}.tar.zst --stdout | tar -xf -
- name: Prepare rootfs
uses: libbpf/ci/prepare-rootfs@main
with:
project-name: 'libbpf'
arch: ${{ matrix.arch }}
kernel: ${{ matrix.kernel }}
kernel-root: '.'
kbuild-output: ${{ env.KBUILD_OUTPUT }}
image-output: '/tmp/root.img'
test: ${{ matrix.test }}
- name: Run selftests
uses: libbpf/ci/run-qemu@main
continue-on-error: ${{ matrix.continue_on_error }}
timeout-minutes: ${{ matrix.timeout_minutes }}
with:
arch: ${{ matrix.arch}}
img: '/tmp/root.img'
vmlinuz: '${{ github.workspace }}/vmlinuz'
kernel-root: '.'
max-cpu: 8
kernel-test: ${{ matrix.test }}
with:
arch: ${{ matrix.arch }}
toolchain_full: ${{ matrix.toolchain_full }}
runs_on: ${{ toJSON(matrix.runs_on) }}
kernel: ${{ matrix.kernel }}
test: ${{ matrix.text }}
continue_on_error: ${{ matrix.continue_on_error }}
timeout_minutes: ${{ matrix.timeout_minutes }}

veristat:
name: veristat
needs: [set-matrix, build]
Expand Down

0 comments on commit a320bab

Please sign in to comment.