Skip to content

feat: build script for libkrun #26

feat: build script for libkrun

feat: build script for libkrun #26

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: Debug Environment
run: |
echo "Current directory: $(pwd)"
echo "Directory contents:"
ls -la
echo "PATH: $PATH"
echo "Rust version:"
rustc --version
echo "Cargo version:"
cargo --version
echo "Python version:"
python3 --version
- name: Build libkrun
run: |
echo "Starting libkrun build..."
echo "build_libkrun.sh contents:"
cat ./build_libkrun.sh
echo "Executing build_libkrun.sh..."
./build_libkrun.sh
env:
PATH: ${{ env.HOME }}/.cargo/bin:${{ env.PATH }}
- name: Debug Post-Build
run: |
echo "build_libkrun.sh execution completed"
echo "Current directory: $(pwd)"
echo "Directory contents:"
ls -la
echo "Checking for libkrun files:"
ls -la /usr/local/lib64/libkrun* || echo "No libkrun files found in /usr/local/lib64"
ls -la /usr/local/lib/libkrun* || echo "No libkrun files found in /usr/local/lib"
- 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') }}
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: cargo test --all-features