-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
119 additions
and
112 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: 'Tar build artifacts' | ||
inputs: | ||
kbuild-output: | ||
description: 'Path to the kernel build output' | ||
required: true | ||
repo-root: | ||
description: "Path to the root of the kernel repository" | ||
required: true | ||
arch: | ||
required: true | ||
toolchain: | ||
required: true | ||
outputs: | ||
archive-name: | ||
description: 'Artifacts tarball name' | ||
value: ${{ steps.run-script.outputs.archive-name }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run tar-artifacts.sh | ||
id: run-script | ||
env: | ||
KBUILD_OUTPUT: ${{ inputs.kbuild-output }} | ||
REPO_ROOT: ${{ inputs.repo-root }} | ||
shell: bash | ||
run: | ||
${GITHUB_ACTION_PATH}/tar-artifacts.sh "${{ inputs.arch }}" "${{ inputs.toolchain }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/bin/bash | ||
|
||
set -eux -o pipefail | ||
|
||
if [ ! -d "${REPO_ROOT:-}" ]; then | ||
echo "REPO_ROOT must be a directory: ${REPO_ROOT}" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "${KBUILD_OUTPUT:-}" ]; then | ||
echo "KBUILD_OUTPUT must be a directory: ${KBUILD_OUTPUT}" | ||
exit 1 | ||
fi | ||
|
||
ARCHIVE_BPF_SELFTESTS="${ARCHIVE_BPF_SELFTESTS:-true}" | ||
ARCHIVE_MAKE_HELPERS="${ARCHIVE_MAKE_HELPERS:-}" | ||
ARCHIVE_SCHED_EXT_SELFTESTS="${ARCHIVE_SCHED_EXT_SELFTESTS:-}" | ||
|
||
arch="${1}" | ||
toolchain="${2}" | ||
|
||
tarball="vmlinux-${arch}-${toolchain}.tar" | ||
|
||
source "${GITHUB_ACTION_PATH}/../helpers.sh" | ||
|
||
# Strip debug information, which is excessively large (consuming | ||
# bandwidth) while not actually being used (the kernel does not use | ||
# DWARF to symbolize stacktraces). | ||
"${arch}"-linux-gnu-strip --strip-debug "${KBUILD_OUTPUT}"/vmlinux | ||
|
||
image_name=$(make ARCH="$(platform_to_kernel_arch "${arch}")" -s image_name) | ||
kbuild_output_file_list=( | ||
".config" | ||
"${image_name}" | ||
"include/config/auto.conf" | ||
"include/generated/autoconf.h" | ||
"vmlinux" | ||
) | ||
|
||
tar -rf "${tarball}" -C "${KBUILD_OUTPUT}" \ | ||
--transform "s,^,kbuild-output/," \ | ||
"${kbuild_output_file_list[@]}" | ||
|
||
# In case artifacts are restored not to the kernel repo root, | ||
# package up a bunch of additional infrastructure to support running | ||
# 'make kernelrelease' and bpf tool checks later on. | ||
if [[ -n "${ARCHIVE_MAKE_HELPERS}" ]]; then | ||
find "${REPO_ROOT}" -iname Makefile -printf '%P\n' \ | ||
| tar -rf "${tarball}" -C "${REPO_ROOT}" -T - | ||
tar -rf "${tarball}" -C "${REPO_ROOT}" \ | ||
--exclude '*.o' \ | ||
--exclude '*.d' \ | ||
"scripts/" \ | ||
"tools/testing/selftests/bpf/" \ | ||
"tools/include/" \ | ||
"tools/bpf/bpftool/" | ||
fi | ||
|
||
if [[ -n "${ARCHIVE_BPF_SELFTESTS}" ]]; then | ||
# add .bpf.o files | ||
find "${REPO_ROOT}/tools/testing/selftests/bpf" -name "*.bpf.o" -printf 'selftests/bpf/%P\n' \ | ||
| tar -rf "${tarball}" -C "${REPO_ROOT}/tools/testing" -T - | ||
# add other relevant files | ||
tar -rf "${tarball}" -C "${REPO_ROOT}/tools/testing" \ | ||
--exclude '*.cmd' \ | ||
--exclude '*.d' \ | ||
--exclude '*.h' \ | ||
--exclude '*.o' \ | ||
--exclude '*.output' \ | ||
selftests/bpf/ | ||
fi | ||
|
||
if [[ -n "${ARCHIVE_SCHED_EXT_SELFTESTS}" ]]; then | ||
tar -rf "${tarball}" -C "${REPO_ROOT}/tools/testing" selftests/sched_ext/ | ||
fi | ||
|
||
zst_tarball="vmlinux-${arch}-${toolchain}.tar.zst" | ||
zstd -T0 -19 -i "${tarball}" -o "${zst_tarball}" | ||
echo "archive-name=$(realpath "${zst_tarball}")" >> $GITHUB_OUTPUT |