fix: attempt at fixing shim building #762
This file contains hidden or 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: CI | |
| on: | |
| schedule: | |
| - cron: "37 13 * * *" | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.arch }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| runner: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| - arch: aarch64 | |
| runner: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| # we need to fetch rust deps first to speed up cargo xtask | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo | |
| ~/.rustup | |
| target | |
| key: ${{ runner.os }}-${{ matrix.arch }}-rust-${{ hashFiles('**/Cargo.lock', '**/.github/workflows/ci.yml') }} | |
| - name: Pull docker | |
| run: docker pull ghcr.io/kunai-project/kunai-builder:latest | |
| - name: Run clippy on full project | |
| run: | | |
| set -eux | |
| cont_name=jap_knife | |
| # building target directory | |
| chmod -R 777 ./ | |
| docker run --name=$cont_name -v $PWD:/kunai-src -w /kunai-src ghcr.io/kunai-project/kunai-builder:latest cargo xtask clippy -- --workspace -- -D warnings | |
| exit_code=$(docker inspect --format='{{.State.ExitCode}}' $cont_name) | |
| cat ./kunai-common/src/co_re/gen.rs | |
| docker rm $cont_name | |
| exit $exit_code | |
| - name: Build (eBPF and userland) | |
| run: | | |
| set -eux | |
| cont_name=jap_knife | |
| docker run --name=$cont_name -v $PWD:/kunai-src -w /kunai-src ghcr.io/kunai-project/kunai-builder:latest cargo xbuild --release --target ${{ matrix.target }} --linker /usr/bin/lld | |
| exit_code=$(docker inspect --format='{{.State.ExitCode}}' $cont_name) | |
| docker rm $cont_name | |
| exit $exit_code | |
| - name: Preparing files for upload | |
| run: | | |
| set -eux | |
| sudo chmod -R 777 ./target | |
| release="target/${{ matrix.target }}/release" | |
| tmp_release="target.tmp/${{ matrix.target }}/release/" | |
| mkdir -p $tmp_release | |
| find $release -maxdepth 1 -type f -executable | xargs -I '{}' cp '{}' $tmp_release | |
| - name: Upload target | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: target-${{ matrix.arch }} | |
| path: target.tmp | |
| tests: | |
| needs: build | |
| name: Testing on ${{ matrix.arch }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| runner: ubuntu-latest | |
| packages: qemu-system-x86 | |
| - arch: aarch64 | |
| runner: ubuntu-latest | |
| packages: qemu-system-arm | |
| steps: | |
| - name: Install system tools | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ${{ matrix.packages }} | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| name: target-${{ matrix.arch }} | |
| path: target | |
| - name: Make target bin exec | |
| run: chmod +x target/*/release/* | |
| - name: Set kernel cache key | |
| run: echo "KERNEL_CACHE_KEY=cache-vmlinuz-${{ matrix.arch }}-cache-$(date +%Y-%m-%d)" >> $GITHUB_ENV | |
| - name: Cache Linux Kernels | |
| uses: actions/cache@v4 | |
| with: | |
| path: cache | |
| key: ${{ env.KERNEL_CACHE_KEY }} | |
| - name: Linux Kernel LTS 5.4 | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| run: ./scripts/ci/test_kernel.sh 5.4 | |
| - name: Linux Kernel LTS 5.10 | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| run: ./scripts/ci/test_kernel.sh 5.10 | |
| - name: Linux Kernel LTS 5.15 | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| run: ./scripts/ci/test_kernel.sh 5.15 | |
| - name: Linux Kernel LTS 6.1 | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| run: ./scripts/ci/test_kernel.sh 6.1 | |
| - name: Linux Kernel LTS 6.6 | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| run: ./scripts/ci/test_kernel.sh 6.6 |