workflow: move build operations in a reusable workflow #1
Workflow file for this run
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: Reusable veristat workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
arch: | ||
required: true | ||
type: string | ||
toolchain: | ||
required: true | ||
type: string | ||
runs_on: | ||
required: true | ||
type: string | ||
aws_region: | ||
required: true | ||
secrets: | ||
AWS_ROLE_ARN: | ||
required: true | ||
jobs: | ||
veristat: | ||
name: veristat on ${{ inputs.arch }} with ${{ inputs.toolchain }} | ||
runs-on: ${{ fromJSON(inputs.runs_on) }} | ||
timeout-minutes: 100 | ||
permissions: | ||
id-token: write | ||
contents: read | ||
env: | ||
KERNEL: LATEST | ||
REPO_ROOT: ${{ github.workspace }} | ||
REPO_PATH: "" | ||
KBUILD_OUTPUT: kbuild-output/ | ||
ARCH_AND_TOOL: ${{ inputs.arch }}-${{ inputs.toolchain }} | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: vmlinux-${{ env.ARCH_AND_TOOL }} | ||
path: . | ||
- name: Untar artifacts | ||
# zstd is installed by default in the runner images. | ||
run: zstd -d -T0 vmlinux-${{ env.ARCH_AND_TOOL }}.tar.zst --stdout | tar -xf - | ||
- name: Prepare rootfs | ||
uses: libbpf/ci/prepare-rootfs@main | ||
with: | ||
project-name: 'libbpf' | ||
arch: x86_64 | ||
kernel: LATEST | ||
kernel-root: '.' | ||
kbuild-output: ${{ env.KBUILD_OUTPUT }} | ||
image-output: '/tmp/root.img' | ||
- name: Configure AWS Credentials | ||
# Disabling BPF objects download and veristat-meta benchmark for PRs | ||
# created from fork repositories. These won't have access to required | ||
# enviroment variables and secrets, and otherwise would consistently fail | ||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-region: ${{ inputs.aws_region }} | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
role-session-name: github-action-bpf-ci | ||
- name: Download BPF objects | ||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | ||
run: | | ||
set -eux | ||
if [ -n "$AWS_ROLE_ARN" ]; then | ||
mkdir /tmp/bpf_objects | ||
aws s3 sync s3://veristat-bpf-binaries /tmp/bpf_objects | ||
fi | ||
env: | ||
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }} | ||
- name: Add BPF objects to rootfs | ||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | ||
shell: bash | ||
run: ./.github/scripts/bpf-objects-rootfs.sh | ||
- name: Run veristat | ||
uses: libbpf/ci/run-qemu@main | ||
with: | ||
arch: x86_64 | ||
img: '/tmp/root.img' | ||
vmlinuz: '${{ github.workspace }}/vmlinuz' | ||
kernel-root: '.' | ||
max-cpu: 8 | ||
kernel-test: run_veristat_kernel,run_veristat_meta | ||
output-dir: '${{ github.workspace }}' | ||
- name: Compare and save veristat.kernel.csv | ||
uses: ./.github/actions/veristat_baseline_compare | ||
with: | ||
veristat_output: veristat-kernel | ||
baseline_name: ${{ env.ARCH_AND_TOOL}}-baseline-veristat-kernel | ||
- name: Compare and save veristat.meta.csv | ||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | ||
uses: ./.github/actions/veristat_baseline_compare | ||
with: | ||
veristat_output: veristat-meta | ||
baseline_name: ${{ env.ARCH_AND_TOOL}}-baseline-veristat-meta |