feat: build script for libkrun #32
Workflow file for this run
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: 🧪 Tests and Checks | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ '**' ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-libkrun: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update -qqy | |
sudo apt-get install -y jq libelf-dev build-essential flex bison libssl-dev libncurses5-dev python3-pip | |
pip3 install --user pyelftools | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Build libkrun | |
run: | | |
./build_libkrun.sh | |
- name: Manual library copy | |
run: | | |
sudo mkdir -p /usr/local/lib64 | |
sudo cp /path/to/built/libkrun.so /usr/local/lib64/ | |
sudo cp /path/to/built/libkrunfw.so /usr/local/lib64/ | |
sudo ldconfig | |
- name: Verify libkrun Installation | |
run: | | |
sudo ls -la /usr/local/lib64 | |
sudo ls -la /usr/local/lib | |
sudo ldconfig -p | grep libkrun | |
- name: Cache libkrun | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/usr/local/lib64/libkrunfw.so | |
/usr/local/lib64/libkrun.so | |
key: ${{ runner.os }}-libkrun-${{ github.sha }} | |
run-checks: | |
needs: build-libkrun | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust-toolchain: | |
- stable | |
- nightly | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Cache Project | |
uses: Swatinem/rust-cache@v2 | |
- name: Restore libkrun cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/usr/local/lib64/libkrunfw.so | |
/usr/local/lib64/libkrun.so | |
key: ${{ runner.os }}-libkrun-${{ github.sha }} | |
- name: Check library dependencies | |
run: | | |
sudo ldd /usr/local/lib64/libkrun.so || true | |
sudo ldd /usr/local/lib/libkrun.so || true | |
- name: Verify Cache Contents | |
run: | | |
sudo ls -la /usr/local/lib64 | |
sudo ls -la /usr/local/lib | |
sudo file /usr/local/lib64/libkrun* | |
sudo file /usr/local/lib/libkrun* | |
- name: Install Rust Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
override: true | |
components: rustfmt, clippy | |
toolchain: ${{ matrix.rust-toolchain }} | |
- name: Check Format | |
uses: actions-rs/cargo@v1 | |
with: | |
args: --all -- --check | |
command: fmt | |
toolchain: ${{ matrix.rust-toolchain }} | |
- name: Run Linter | |
uses: actions-rs/cargo@v1 | |
with: | |
args: --all -- -D warnings | |
command: clippy | |
toolchain: ${{ matrix.rust-toolchain }} | |
- name: Check Advisories | |
if: ${{ matrix.rust-toolchain == 'stable' }} | |
uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
command: check advisories | |
continue-on-error: true | |
- name: Check Bans, Licenses, and Sources | |
if: ${{ matrix.rust-toolchain == 'stable' }} | |
uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
command: check bans licenses sources | |
- name: Test Release | |
if: ${{ matrix.rust-toolchain == 'stable' && github.event_name == 'push' }} | |
run: cargo build --release | |
- name: Update library cache | |
run: sudo ldconfig | |
run-tests: | |
needs: build-libkrun | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust-toolchain: | |
- stable | |
- nightly | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Environment Packages | |
run: | | |
sudo apt-get update -qqy | |
sudo apt-get install jq | |
- name: Cache Project | |
uses: Swatinem/rust-cache@v2 | |
- name: Restore libkrun cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/usr/local/lib64/libkrunfw.so | |
/usr/local/lib64/libkrun.so | |
key: ${{ runner.os }}-libkrun-${{ github.sha }} | |
- name: Check library dependencies | |
run: | | |
sudo ldd /usr/local/lib64/libkrun.so || true | |
sudo ldd /usr/local/lib/libkrun.so || true | |
- name: Verify Cache Contents | |
run: | | |
sudo ls -la /usr/local/lib64 | |
sudo ls -la /usr/local/lib | |
sudo file /usr/local/lib64/libkrun* | |
sudo file /usr/local/lib/libkrun* | |
- name: Install Rust Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
override: true | |
toolchain: ${{ matrix.rust-toolchain }} | |
- name: Run Tests | |
run: | | |
ls -la /usr/local/lib64 | grep libkrun | |
echo "LIBRARY_PATH before: $LIBRARY_PATH" | |
export LIBRARY_PATH="/usr/local/lib64:$LIBRARY_PATH" | |
echo "LIBRARY_PATH after: $LIBRARY_PATH" | |
cargo test --all-features | |
env: | |
LIBRARY_PATH: /usr/local/lib64:${{ env.LIBRARY_PATH }} | |
LD_LIBRARY_PATH: /usr/local/lib64:/usr/local/lib:${{ env.LD_LIBRARY_PATH }} | |
- name: Update library cache | |
run: sudo ldconfig |