feat: build script for libkrun #31
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: Cache libkrun | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/usr/local/lib64/libkrunfw.so | |
/usr/local/lib64/libkrun.so | |
key: ${{ runner.os }}-libkrun-${{ hashFiles('**/build_libkrun.sh') }} | |
- name: Verify libkrun Installation | |
run: ls -la /usr/local/lib64 | grep libkrun | |
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-${{ hashFiles('**/build_libkrun.sh') }} | |
- 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 | |
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-${{ hashFiles('**/build_libkrun.sh') }} | |
- 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 }} |