Build resctl-demo images #482
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: Build resctl-demo images | |
on: | |
pull_request: | |
push: | |
# Every Monday 01:00 UTC | |
schedule: | |
- cron: "0 1 * * 1" | |
workflow_dispatch: | |
inputs: | |
resctl_demo_src: | |
type: choice | |
description: resctl-demo source | |
options: | |
- crates.io | |
- git HEAD | |
jobs: | |
build_image: | |
strategy: | |
fail-fast: false | |
matrix: | |
variant: | |
- resctl-demo | |
- resctl-demo-meta | |
name: Build ${{ matrix.variant }} image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create output directory | |
run: mkdir out | |
- name: Generate version | |
id: version | |
run: echo "version=$(date '+%Y%m%d.%H%M%S').${{ matrix.variant }}.$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Save version in outputs directory | |
run: echo ${{ steps.version.outputs.version }} > out/version.txt | |
# ospack | |
- name: Build ospack | |
run: | |
docker run | |
--cgroupns=private | |
-v $(pwd):/recipes | |
-w /recipes | |
--tmpfs /scratch:exec | |
--tmpfs /run | |
--privileged | |
-e TMP=/scratch | |
-e SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=1 | |
--entrypoint "" | |
ghcr.io/go-debos/debos:main | |
debos --artifactdir=out | |
--template-var=variant:${{ matrix.variant }} | |
--template-var=version:"${{ steps.version.outputs.version }}" | |
--template-var="resctl_demo_src:${{ github.event.inputs.resctl_demo_src }}" | |
--scratchsize=16G | |
resctl-demo-ospack.yaml | |
# efi image | |
- name: Build ${{ matrix.variant }}-image-efiboot | |
run: | |
docker run | |
--cgroupns=private | |
-v $(pwd):/recipes | |
-w /recipes | |
--tmpfs /scratch:exec | |
--tmpfs /run | |
--privileged | |
-e TMP=/scratch | |
-e SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=1 | |
--entrypoint "" | |
ghcr.io/go-debos/debos:main | |
debos --artifactdir=out | |
--template-var=variant:${{ matrix.variant }} | |
--template-var=version:"${{ steps.version.outputs.version }}" | |
resctl-demo-image-efiboot.yaml | |
- name: Publish ${{ matrix.variant }}-image-efiboot | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.variant }}-image-efiboot | |
path: | | |
out/${{ matrix.variant }}-image-efiboot.img.bmap | |
out/${{ matrix.variant }}-image-efiboot.img.gz.sha256 | |
out/${{ matrix.variant }}-image-efiboot.img.gz | |
out/version.txt | |
if-no-files-found: error | |
- name: Cleanup working dir builds | |
run: | | |
# Remove files already published as build artifacts | |
rm out/${{ matrix.variant }}-image-efiboot.img.bmap | |
rm out/${{ matrix.variant }}-image-efiboot.img.gz.sha256 | |
rm out/${{ matrix.variant }}-image-efiboot.img.gz | |
rm -f out/version.txt | |
# efi flasher | |
- name: Build ${{ matrix.variant }}-flasher-efiboot | |
run: | |
docker run | |
--cgroupns=private | |
-v $(pwd):/recipes | |
-w /recipes | |
--tmpfs /scratch:exec | |
--tmpfs /run | |
--privileged | |
-e TMP=/scratch | |
-e SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=1 | |
--entrypoint "" | |
ghcr.io/go-debos/debos:main | |
debos --artifactdir=out | |
--template-var=variant:${{ matrix.variant }} | |
--template-var=version:"${{ steps.version.outputs.version }}" | |
resctl-demo-flasher-efiboot.yaml | |
- name: Publish ${{ matrix.variant }}-flasher-efiboot | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.variant }}-flasher-efiboot | |
path: | | |
out/${{ matrix.variant }}-flasher-efiboot.img.bmap | |
out/${{ matrix.variant }}-flasher-efiboot.img.gz.sha256 | |
out/${{ matrix.variant }}-flasher-efiboot.img.gz | |
out/version.txt | |
if-no-files-found: error | |
- name: Cleanup working dir builds | |
run: | | |
# Remove files already published as build artifacts | |
rm out/${{ matrix.variant }}-flasher-efiboot.img.bmap | |
rm out/${{ matrix.variant }}-flasher-efiboot.img.gz.sha256 | |
rm out/${{ matrix.variant }}-flasher-efiboot.img.gz | |
rm -f out/version.txt | |
# legacyboot image | |
- name: Build ${{ matrix.variant }}-image-legacyboot | |
if: matrix.variant == 'resctl-demo' | |
run: | |
docker run | |
--cgroupns=private | |
-v $(pwd):/recipes | |
-w /recipes | |
--tmpfs /scratch:exec | |
--tmpfs /run | |
--privileged | |
-e TMP=/scratch | |
-e SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=1 | |
--entrypoint "" | |
ghcr.io/go-debos/debos:main | |
debos --artifactdir=out | |
--template-var=variant:${{ matrix.variant }} | |
--template-var=version:"${{ steps.version.outputs.version }}" | |
resctl-demo-image-legacyboot.yaml | |
- name: Publish ${{ matrix.variant }}-image-legacyboot | |
if: matrix.variant == 'resctl-demo' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.variant }}-image-legacyboot | |
path: | | |
out/${{ matrix.variant }}-image-legacyboot.img.bmap | |
out/${{ matrix.variant }}-image-legacyboot.img.gz.sha256 | |
out/${{ matrix.variant }}-image-legacyboot.img.gz | |
out/version.txt | |
if-no-files-found: error | |
- name: Cleanup working dir builds | |
if: matrix.variant == 'resctl-demo' | |
run: | | |
# Remove files already published as build artifacts | |
rm out/${{ matrix.variant }}-image-legacyboot.img.bmap | |
rm out/${{ matrix.variant }}-image-legacyboot.img.gz.sha256 | |
rm out/${{ matrix.variant }}-image-legacyboot.img.gz | |
rm -f out/version.txt | |
# Keep workflow alive | |
# See https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#disabling-and-enabling-workflows | |
workflow-keepalive: | |
if: github.event_name == 'schedule' | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- uses: liskin/gh-workflow-keepalive@v1.2.1 |