Skip to content

Honor Kbuild flags and source-version metadata #202

Honor Kbuild flags and source-version metadata

Honor Kbuild flags and source-version metadata #202

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
root-tests:
name: Root tests (Bazel ${{ matrix.bazel }})
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
bazel:
- 8.7.0
- 9.1.0
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-root-${{ matrix.bazel }}
repository-cache: |
- MODULE.bazel
- MODULE.bazel.lock
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Test
env:
BAZEL_BEP: ${{ runner.temp }}/root-${{ matrix.bazel }}.bep.json
BAZEL_LOG: ${{ runner.temp }}/root-${{ matrix.bazel }}.log
BAZEL_PATH_MAPPING: ${{ matrix.bazel == '9.1.0' && '--config=path-mapping' || '' }}
BAZEL_PROFILE: ${{ runner.temp }}/root-${{ matrix.bazel }}.profile.gz
run: |
set -euo pipefail
targets=(//...)
path_mapping_args=()
if [[ -n "${BAZEL_PATH_MAPPING}" ]]; then
targets+=(//internal/tests:path_mapping_test)
path_mapping_args+=("${BAZEL_PATH_MAPPING}")
fi
bazel --host_jvm_args=-Xmx6g \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
test "${targets[@]}" \
"${path_mapping_args[@]}" \
--build_event_json_file="${BAZEL_BEP}" \
--profile="${BAZEL_PROFILE}" \
2>&1 | tee "${BAZEL_LOG}"
- name: Report cache efficiency
if: ${{ !cancelled() }}
env:
BAZEL_BEP: ${{ runner.temp }}/root-${{ matrix.bazel }}.bep.json
BAZEL_LOG: ${{ runner.temp }}/root-${{ matrix.bazel }}.log
BAZEL_PROFILE: ${{ runner.temp }}/root-${{ matrix.bazel }}.profile.gz
run: |
.github/workflows/bazel_cache_report.sh \
"Root tests (Bazel ${{ matrix.bazel }})" \
"${BAZEL_PROFILE}" \
"${BAZEL_BEP}" \
"${BAZEL_LOG}"
- name: Upload Bazel profile
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: bazel-profile-root-${{ matrix.bazel }}
path: |
${{ runner.temp }}/root-${{ matrix.bazel }}.profile.gz
${{ runner.temp }}/root-${{ matrix.bazel }}.bep.json
${{ runner.temp }}/root-${{ matrix.bazel }}.log
if-no-files-found: warn
retention-days: 14
examples:
name: Standalone examples (${{ matrix.title }})
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- batch: initramfs
title: initramfs
targets: "//:example_initramfs"
report_name: ""
report_target: ""
report_title: ""
report_mnemonics: ""
- batch: x86-64-variants
title: x86_64 base + overlays
targets: "//:x86_64_kernel //:x86_64_debug_kernel //:x86_64_btf_vmlinux //:x86_64_lz4_kernel //:x86_64_shared_graph_metadata"
report_name: x86-64-base
report_target: "//:x86_64_kernel"
report_title: x86_64 base
report_mnemonics: >-
LinuxObjectCompile
LinuxPurgatoryCompile
LinuxRealmodeCompile
LinuxVDSOCompile
LinuxVmlinuxCompile
LinuxX86CompressedCompile
LinuxX86EFIStubCompile
LinuxX86SetupCompile
- batch: aarch64-base
title: aarch64 base
targets: "//:aarch64_kernel"
report_name: aarch64-base
report_target: "//:aarch64_kernel"
report_title: aarch64 base
report_mnemonics: >-
LinuxObjectCompile
LinuxARM64VDSOCompile
LinuxARM64VDSO32Compile
LinuxVmlinuxCompile
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-examples-${{ matrix.batch }}
module-root: examples
repository-cache: |
- examples/.bazelversion
- examples/MODULE.bazel
- examples/MODULE.bazel.lock
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Build ${{ matrix.title }}
working-directory: examples
env:
BAZEL_BEP: ${{ runner.temp }}/examples-${{ matrix.batch }}.bep.json
BAZEL_LOG: ${{ runner.temp }}/examples-${{ matrix.batch }}.log
BAZEL_PROFILE: ${{ runner.temp }}/examples-${{ matrix.batch }}.profile.gz
BAZEL_TARGETS: ${{ matrix.targets }}
run: |
set -euo pipefail
read -r -a targets <<<"${BAZEL_TARGETS}"
bazel --host_jvm_args=-Xmx6g \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
build "${targets[@]}" \
--config=path-mapping \
--notrack_incremental_state \
--nokeep_state_after_build \
--discard_analysis_cache \
--experimental_record_metrics_for_all_mnemonics \
--build_event_json_file="${BAZEL_BEP}" \
--profile="${BAZEL_PROFILE}" \
2>&1 | tee "${BAZEL_LOG}"
- name: Generate Linux object input reports
if: ${{ matrix.report_target != '' }}
working-directory: examples
env:
BAZEL_REPORT_MNEMONICS: ${{ matrix.report_mnemonics }}
BAZEL_REPORT_TARGET: ${{ matrix.report_target }}
REPORT_NAME: ${{ matrix.report_name }}
REPORT_TITLE: ${{ matrix.report_title }}
run: |
set -euo pipefail
report_dir="${RUNNER_TEMP}/linux-object-input-report-${REPORT_NAME}"
aquery="${report_dir}/aquery.json"
reporter="${RUNNER_TEMP}/linuxobjectinputreport"
mkdir -p "${report_dir}"
execroot="$(
bazel \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
info \
--config=path-mapping \
execution_root
)"
bazel \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
build \
--config=path-mapping \
--remote_download_toplevel \
@linux.bzl//tools:linuxobjectinputreport
reporter_output="$(
bazel \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
cquery \
--config=path-mapping \
--output=files \
@linux.bzl//tools:linuxobjectinputreport
)"
install -m 0755 "${reporter_output}" "${reporter}"
bazel \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
build \
--config=path-mapping \
--remote_download_all \
"${BAZEL_REPORT_TARGET}"
bazel \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
aquery \
--config=path-mapping \
--output=jsonproto \
--include_artifacts \
--noinclude_commandline \
"deps(${BAZEL_REPORT_TARGET})" >"${aquery}"
"${reporter}" \
-input "${aquery}" \
-execroot "${execroot}" |
tee "${report_dir}/linux-object-input-report.txt"
read -r -a mnemonics <<<"${BAZEL_REPORT_MNEMONICS}"
mnemonic_args=()
for mnemonic in "${mnemonics[@]}"; do
mnemonic_args+=(-mnemonic "${mnemonic}")
done
"${reporter}" \
-input "${aquery}" \
-execroot "${execroot}" \
"${mnemonic_args[@]}" |
tee "${report_dir}/linux-object-input-report-all-compiles.txt"
gzip "${aquery}"
{
printf '### Linux object input reports (%s)\n\n' "${REPORT_TITLE}"
printf "Full reports and their compressed producer-complete aquery are attached as \`%s\`.\n\n" \
"linux-object-input-report-${REPORT_NAME}"
printf '<details><summary>LinuxObjectCompile report</summary>\n\n```text\n'
cat "${report_dir}/linux-object-input-report.txt"
printf '```\n\n</details>\n\n'
printf '<details><summary>All selected compile actions</summary>\n\n```text\n'
cat "${report_dir}/linux-object-input-report-all-compiles.txt"
printf '```\n\n</details>\n'
} >>"${GITHUB_STEP_SUMMARY}"
- name: Upload Linux object input reports
if: ${{ !cancelled() && matrix.report_target != '' }}
uses: actions/upload-artifact@v7
with:
name: linux-object-input-report-${{ matrix.report_name }}
path: ${{ runner.temp }}/linux-object-input-report-${{ matrix.report_name }}
if-no-files-found: warn
retention-days: 14
- name: Report cache efficiency
if: ${{ !cancelled() }}
env:
BAZEL_BEP: ${{ runner.temp }}/examples-${{ matrix.batch }}.bep.json
BAZEL_LOG: ${{ runner.temp }}/examples-${{ matrix.batch }}.log
BAZEL_PROFILE: ${{ runner.temp }}/examples-${{ matrix.batch }}.profile.gz
run: |
.github/workflows/bazel_cache_report.sh \
"Standalone examples (${{ matrix.title }})" \
"${BAZEL_PROFILE}" \
"${BAZEL_BEP}" \
"${BAZEL_LOG}"
- name: Verify shared kernel graph
if: ${{ matrix.batch == 'x86-64-variants' }}
working-directory: examples
env:
BAZEL_BEP: ${{ runner.temp }}/examples-${{ matrix.batch }}.bep.json
run: >-
../.github/workflows/assert_shared_kernel_graph.sh
"${BAZEL_BEP}"
bazel-bin/x86_64_shared_graph_metadata.json
3533
4727
117000
- name: Upload Bazel profile
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: bazel-profile-examples-${{ matrix.batch }}
path: |
${{ runner.temp }}/examples-${{ matrix.batch }}.profile.gz
${{ runner.temp }}/examples-${{ matrix.batch }}.bep.json
${{ runner.temp }}/examples-${{ matrix.batch }}.log
if-no-files-found: warn
retention-days: 14
qemu-e2e:
name: QEMU e2e (${{ matrix.batch }})
runs-on: ubuntu-latest
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
include:
- batch: tooling
title: E2E tooling
targets: "//boot:init_test //cmd/qemuboot:qemuboot_test"
- batch: linux-6.12-x86_64
title: Linux 6.12 x86_64
targets: "//:linux_6_12_96_x86_64_boot_test //:linux_6_12_96_x86_64_module_test //:modversions_6_12_96_x86_64_build_test"
- batch: linux-6.12-aarch64
title: Linux 6.12 aarch64
targets: "//:linux_6_12_96_aarch64_boot_test //:linux_6_12_96_aarch64_module_test"
- batch: linux-6.18-x86_64
title: Linux 6.18 x86_64
targets: "//:kernel_outputs_x86_64_build_test //:linux_6_18_39_x86_64_boot_test //:linux_6_18_39_x86_64_module_test //:modversions_6_18_39_x86_64_build_test //:srcversions_6_18_39_x86_64_build_test"
- batch: linux-6.18-kvm-verity
title: Linux 6.18 KVM and dm-verity
targets: "//:kvm_verity_kernel_build_test //:cnic_module_version_build_test"
- batch: linux-6.18-aarch64
title: Linux 6.18 aarch64
targets: "//:kernel_outputs_aarch64_build_test //:linux_6_18_39_aarch64_boot_test //:linux_6_18_39_aarch64_module_test //:modversions_6_18_39_aarch64_build_test"
- batch: linux-6.18-armv7
title: Linux 6.18 ARMv7
targets: "//:kernel_outputs_armv7_build_test //:linux_source_root_package_build_test //artifacts:armv7_test"
- batch: linux-6.18-rust-x86_64
title: Linux 6.18 Rust x86_64
targets: "//:linux_6_18_39_rust_module_test"
- batch: linux-6.18-rust-aarch64
title: Linux 6.18 Rust aarch64
targets: "//:linux_6_18_39_aarch64_rust_module_test"
- batch: linux-6.12-rust-x86_64
title: Linux 6.12 Rust x86_64
targets: "//:linux_6_12_96_rust_module_test"
- batch: linux-6.12-rust-aarch64
title: Linux 6.12 Rust aarch64
targets: "//:linux_6_12_96_aarch64_rust_module_test"
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-qemu-e2e-${{ matrix.batch }}
module-root: e2e
repository-cache: |
- e2e/.bazelversion
- e2e/MODULE.bazel
- e2e/MODULE.bazel.lock
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Run ${{ matrix.title }}
working-directory: e2e
env:
BAZEL_BEP: ${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.bep.json
BAZEL_LOG: ${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.log
BAZEL_PROFILE: ${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.profile.gz
BAZEL_TARGETS: ${{ matrix.targets }}
run: |
set -euo pipefail
read -r -a targets <<<"${BAZEL_TARGETS}"
bazel --host_jvm_args=-Xmx6g \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
test "${targets[@]}" \
--config=path-mapping \
--notrack_incremental_state \
--nokeep_state_after_build \
--discard_analysis_cache \
--build_event_json_file="${BAZEL_BEP}" \
--profile="${BAZEL_PROFILE}" \
2>&1 | tee "${BAZEL_LOG}"
- name: Report cache efficiency
if: ${{ !cancelled() }}
env:
BAZEL_BEP: ${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.bep.json
BAZEL_LOG: ${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.log
BAZEL_PROFILE: ${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.profile.gz
run: |
.github/workflows/bazel_cache_report.sh \
"QEMU e2e (${{ matrix.title }})" \
"${BAZEL_PROFILE}" \
"${BAZEL_BEP}" \
"${BAZEL_LOG}"
- name: Upload Bazel profile
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: bazel-profile-qemu-e2e-${{ matrix.batch }}
path: |
${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.profile.gz
${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.bep.json
${{ runner.temp }}/qemu-e2e-${{ matrix.batch }}.log
if-no-files-found: warn
retention-days: 14
aya-e2e:
name: Aya eBPF VMs
runs-on: ubuntu-latest
timeout-minutes: 240
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-aya-e2e
module-root: aya_e2e
repository-cache: |
- aya_e2e/.bazelversion
- aya_e2e/MODULE.bazel
- aya_e2e/MODULE.bazel.lock
- aya_e2e/patches/BUILD.bazel
- aya_e2e/patches/aya_linux_bzl_api.patch
- aya_e2e/patches/aya_rust_kernel_module_e2e.patch
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Run Aya integration VMs
working-directory: aya_e2e
env:
BAZEL_BEP: ${{ runner.temp }}/aya-e2e.bep.json
BAZEL_LOG: ${{ runner.temp }}/aya-e2e.log
BAZEL_PROFILE: ${{ runner.temp }}/aya-e2e.profile.gz
run: |
set -euo pipefail
bazel --host_jvm_args=-Xmx6g \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
test \
'@aya//test/integration-test:vm_aarch64' \
'@aya//test/integration-test:vm_x86_64' \
--notrack_incremental_state \
--nokeep_state_after_build \
--discard_analysis_cache \
--build_event_json_file="${BAZEL_BEP}" \
--profile="${BAZEL_PROFILE}" \
2>&1 | tee "${BAZEL_LOG}"
- name: Report cache efficiency
if: ${{ !cancelled() }}
env:
BAZEL_BEP: ${{ runner.temp }}/aya-e2e.bep.json
BAZEL_LOG: ${{ runner.temp }}/aya-e2e.log
BAZEL_PROFILE: ${{ runner.temp }}/aya-e2e.profile.gz
run: |
.github/workflows/bazel_cache_report.sh \
"Aya eBPF VMs" \
"${BAZEL_PROFILE}" \
"${BAZEL_BEP}" \
"${BAZEL_LOG}"
- name: Upload Bazel profile
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: bazel-profile-aya-e2e
path: |
${{ runner.temp }}/aya-e2e.profile.gz
${{ runner.temp }}/aya-e2e.bep.json
${{ runner.temp }}/aya-e2e.log
if-no-files-found: warn
retention-days: 14
sonic-e2e:
name: SONiC linux_ngbde module
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-sonic-e2e
module-root: sonic_e2e
repository-cache: |
- sonic_e2e/.bazelversion
- sonic_e2e/MODULE.bazel
- sonic_e2e/MODULE.bazel.lock
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Build SONiC linux_ngbde module
working-directory: sonic_e2e
env:
BAZEL_BEP: ${{ runner.temp }}/sonic-e2e.bep.json
BAZEL_LOG: ${{ runner.temp }}/sonic-e2e.log
BAZEL_PROFILE: ${{ runner.temp }}/sonic-e2e.profile.gz
run: |
set -euo pipefail
bazel --host_jvm_args=-Xmx6g \
--bazelrc="${GITHUB_WORKSPACE}/.github/workflows/ci.bazelrc" \
test //:sonic_linux_ngbde_module_test \
--config=path-mapping \
--notrack_incremental_state \
--nokeep_state_after_build \
--discard_analysis_cache \
--build_event_json_file="${BAZEL_BEP}" \
--profile="${BAZEL_PROFILE}" \
2>&1 | tee "${BAZEL_LOG}"
- name: Report cache efficiency
if: ${{ !cancelled() }}
env:
BAZEL_BEP: ${{ runner.temp }}/sonic-e2e.bep.json
BAZEL_LOG: ${{ runner.temp }}/sonic-e2e.log
BAZEL_PROFILE: ${{ runner.temp }}/sonic-e2e.profile.gz
run: |
.github/workflows/bazel_cache_report.sh \
"SONiC linux_ngbde module" \
"${BAZEL_PROFILE}" \
"${BAZEL_BEP}" \
"${BAZEL_LOG}"
- name: Upload Bazel profile
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: bazel-profile-sonic-e2e
path: |
${{ runner.temp }}/sonic-e2e.profile.gz
${{ runner.temp }}/sonic-e2e.bep.json
${{ runner.temp }}/sonic-e2e.log
if-no-files-found: warn
retention-days: 14