ci: test RPM build #69
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 | |
on: | |
pull_request: | |
branches: | |
- '*' | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'branch name to build' | |
required: true | |
default: 'kvm-nyx-5.10.73' | |
publish: | |
description: 'publish a Github release' | |
required: true | |
default: 'false' | |
jobs: | |
debian_package: | |
runs-on: intellabs-01 | |
steps: | |
- run: | | |
BRANCH=kvm-nyx-6.0 | |
# remove / (forbidden character in upload-artifact name) | |
BRANCH=${BRANCH///} | |
# env.ref = kafl/sdv-6.1 | |
echo "ref=kvm-nyx-6.0" >> $GITHUB_ENV | |
# env.ref_art = kaflsdv-6.1 (for artifact name) | |
echo "ref_art=${BRANCH///}" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.ref }} | |
path: sources | |
# https://github.com/apache/flink/blob/02d30ace69dc18555a5085eccf70ee884e73a16e/tools/azure-pipelines/free_disk_space.sh | |
- name: Free some disk space | |
run: | | |
echo "==============================================================================" | |
echo "Freeing up disk space on CI system" | |
echo "==============================================================================" | |
echo "Listing 100 largest packages" | |
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100 | |
df -h | |
echo "Removing large packages" | |
sudo apt-get remove -y '^dotnet-.*' | |
sudo apt-get remove -y '^llvm-.*' | |
sudo apt-get remove -y 'php.*' | |
sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox powershell mono-devel | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
df -h | |
echo "Removing large directories" | |
# deleting 15GB | |
sudo rm -rf /usr/share/dotnet/ | |
df -h | |
- name: Install ccache | |
run: sudo apt-get install -y ccache | |
- name: Install build deps | |
run: sudo apt-get install -y libelf-dev dwarves debhelper-compat | |
- name: Get ubuntu's 22.04 5.15.0-25-generic kernel config | |
run: | | |
sudo apt install -y zstd | |
apt download linux-modules-5.15.0-25-generic | |
ar x linux-modules-5.15.0-25-generic_5.15.0-25.25_amd64.deb data.tar.zst | |
tar -xvf data.tar.zst './boot/config-5.15.0-25-generic' | |
mv boot/config-5.15.0-25-generic sources/.config | |
rm -r boot/ data.tar.zst linux-modules-5.15.0-25-generic_5.15.0-25.25_amd64.deb | |
- name: Configure kernel and enable Nyx | |
run: | | |
# disable kernel signature | |
./scripts/config --disable SYSTEM_TRUSTED_KEYS | |
./scripts/config --disable SYSTEM_REVOCATION_KEYS | |
# enable KVM | |
./scripts/config --module KVM | |
# disable KVM_WERROR (otherwise compilation issues in modified KVM) | |
./scripts/config --disable KVM_WERROR | |
# enable Nyx | |
./scripts/config --enable KVM_NYX | |
# disable KVM_HYPERV due to compilation issue | |
./scripts/config --disable KVM_HYPERV | |
# tweak locaversion | |
./scripts/config --set-str LOCALVERSION -nyx | |
# save space | |
./scripts/config --disable DEBUG_INFO | |
./scripts/config --enable MODULE_COMPRESS | |
./scripts/config --enable MODULE_COMPRESS_ZSTD | |
working-directory: sources | |
- name: Configure SDV kernel | |
if: "contains(env.ref, 'sdv')" | |
run: | | |
./scripts/config --enable INTEL_TDX_HOST | |
# tweak locaversion | |
./scripts/config --set-str LOCALVERSION -sdv | |
working-directory: sources | |
- name: make olddefconfig | |
run: make olddefconfig | |
working-directory: sources | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/ccache | |
key: "${{ runner.os }}-${{ env.ref }}-${{ hashFiles('.config') }}" | |
restore-keys: | | |
"${{ runner.os }}-${{ env.ref }}" | |
"${{ runner.os }}" | |
- name: Build kernel | |
run: | | |
export PATH="/usr/lib/ccache:$PATH" | |
make -j$(nproc) bindeb-pkg | |
working-directory: sources | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux-${{ env.ref_art }} | |
path: '*.deb' | |
- run: rm -rf *.deb | |
release: | |
# this job makes an official Github release | |
if: ${{ inputs.publish }} | |
needs: [debian_package] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
BRANCH=${{ inputs.branch }} | |
# remove / (forbidden character in upload-artifact name) | |
BRANCH=${BRANCH///} | |
# env.ref_art = kaflsdv-6.1 (for artifact name) | |
echo "ref_art=${BRANCH///}" >> $GITHUB_ENV | |
# download all artifacts to the current dir | |
- uses: actions/download-artifact@v3 | |
with: | |
name: linux-${{ env.ref_art }} | |
- name: Create a Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: 'Prebuild host kernel package for ${{ inputs.branch }}' | |
tag_name: ${{ inputs.branch }} | |
files: '*.deb' |