-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflow: move build operations in a reusable workflow
This is step 1 of running the kernel build from a re-useable workflow. This change simply move the "build" job in its own reusable workflow file. Signed-off-by: Manu Bretelle <[email protected]>
- Loading branch information
Showing
2 changed files
with
129 additions
and
90 deletions.
There are no files selected for viewing
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,118 @@ | ||
|
||
name: Reusable build workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
arch: | ||
required: true | ||
type: string | ||
toolchain_full: | ||
required: true | ||
type: string | ||
toolchain: | ||
required: true | ||
type: string | ||
runs_on: | ||
required: true | ||
type: string | ||
llvm-version: | ||
required: true | ||
type: string | ||
kernel: | ||
required: true | ||
type: string | ||
|
||
|
||
jobs: | ||
build: | ||
name: build for ${{ inputs.arch }} with ${{ inputs.toolchain_full }} | ||
runs-on: ${{ fromJSON(inputs.runs_on) }} | ||
timeout-minutes: 100 | ||
env: | ||
KERNEL: ${{ inputs.kernel }} | ||
REPO_ROOT: ${{ github.workspace }} | ||
REPO_PATH: "" | ||
KBUILD_OUTPUT: kbuild-output/ | ||
steps: | ||
- uses: actions/checkout@v3 | ||
# We fetch an actual bit of history here to facilitate incremental | ||
# builds (which may check out some earlier upstream change). | ||
with: | ||
fetch-depth: 50 | ||
- if: ${{ github.repository == 'kernel-patches/vmtest' }} | ||
name: Download bpf-next tree | ||
uses: libbpf/ci/get-linux-source@main | ||
with: | ||
dest: '.kernel' | ||
- if: ${{ github.repository == 'kernel-patches/vmtest' }} | ||
name: Move linux source in place | ||
shell: bash | ||
run: | | ||
rm -rf .kernel/.git | ||
cp -rf .kernel/. . | ||
rm -rf .kernel | ||
- name: Get commit meta-data | ||
id: get-commit-metadata | ||
run: | | ||
bash .github/scripts/get-commit-metadata.sh | ||
- name: Pull recent KBUILD_OUTPUT contents | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.KBUILD_OUTPUT }} | ||
key: kbuild-output-${{ inputs.arch }}-${{ inputs.toolchain_full }}-${{ steps.get-commit-metadata.outputs.branch }}-${{ steps.get-commit-metadata.outputs.timestamp }}-${{ steps.get-commit-metadata.outputs.commit }} | ||
restore-keys: | | ||
kbuild-output-${{ inputs.arch }}-${{ inputs.toolchain_full }}-${{ steps.get-commit-metadata.outputs.branch }}-${{ steps.get-commit-metadata.outputs.timestamp }}- | ||
kbuild-output-${{ inputs.arch }}-${{ inputs.toolchain_full }}-${{ steps.get-commit-metadata.outputs.branch }}- | ||
kbuild-output-${{ inputs.arch }}-${{ inputs.toolchain_full }}- | ||
- name: Prepare incremental build | ||
shell: bash | ||
run: | | ||
bash .github/scripts/prepare-incremental-builds.sh ${{ steps.get-commit-metadata.outputs.commit }} | ||
- uses: libbpf/ci/patch-kernel@main | ||
with: | ||
patches-root: '${{ github.workspace }}/ci/diffs' | ||
repo-root: '${{ github.workspace }}' | ||
- name: Setup build environment | ||
uses: libbpf/ci/setup-build-env@main | ||
with: | ||
llvm-version: ${{ inputs.llvm-version }} | ||
- name: Build kernel image | ||
uses: libbpf/ci/build-linux@main | ||
with: | ||
arch: ${{ inputs.arch }} | ||
toolchain: ${{ inputs.toolchain }} | ||
kbuild-output: ${{ env.KBUILD_OUTPUT }} | ||
max-make-jobs: 32 | ||
llvm-version: ${{ inputs.llvm-version }} | ||
- name: Build selftests | ||
uses: libbpf/ci/build-selftests@main | ||
with: | ||
toolchain: ${{ inputs.toolchain }} | ||
kbuild-output: ${{ env.KBUILD_OUTPUT }} | ||
max-make-jobs: 32 | ||
llvm-version: ${{ inputs.llvm-version }} | ||
- if: ${{ github.event_name != 'push' }} | ||
name: Build samples | ||
uses: libbpf/ci/build-samples@main | ||
with: | ||
toolchain: ${{ inputs.toolchain }} | ||
kbuild-output: ${{ env.KBUILD_OUTPUT }} | ||
max-make-jobs: 32 | ||
llvm-version: ${{ inputs.llvm-version }} | ||
- name: Tar artifacts | ||
run: | | ||
bash .github/scripts/tar-artifact.sh ${{ inputs.arch }} ${{ inputs.toolchain_full }} | ||
- if: ${{ github.event_name != 'push' }} | ||
name: Remove KBUILD_OUTPUT content | ||
shell: bash | ||
run: | | ||
# Remove $KBUILD_OUTPUT to prevent cache creation for pull requests. | ||
# Only on pushed changes are build artifacts actually cached, because | ||
# of github.com/actions/cache's cache isolation logic. | ||
rm -rf "${KBUILD_OUTPUT}" | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }} | ||
if-no-files-found: error | ||
path: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst |
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