Overhaul CI for efficiency and correctness #14
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: Build & Test kbox | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - '**.md' | |
| - 'LICENSE' | |
| - '.editorconfig' | |
| - 'scripts/gdb/**' | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: | |
| - '**.md' | |
| - 'LICENSE' | |
| - '.editorconfig' | |
| - 'scripts/gdb/**' | |
| workflow_dispatch: | |
| concurrency: | |
| group: kbox-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| coding-style: | |
| name: Coding style | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install formatting tools | |
| run: .ci/install-deps.sh format | |
| - name: Check trailing newlines | |
| run: .ci/check-newline.sh | |
| - name: Check code formatting | |
| run: .ci/check-format.sh | |
| unit-tests: | |
| name: Unit tests | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install build dependencies | |
| run: .ci/install-deps.sh build | |
| - name: Build and run unit tests | |
| run: make check-unit | |
| build: | |
| name: Build kbox (x86_64) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| needs: [unit-tests, coding-style] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install build dependencies | |
| run: .ci/install-deps.sh lkl | |
| - name: Provision LKL | |
| uses: ./.github/actions/provision-lkl | |
| with: | |
| gh-token: ${{ github.token }} | |
| - name: Build kbox | |
| run: make BUILD=release | |
| - name: Upload kbox binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: kbox-x86_64 | |
| path: kbox | |
| if-no-files-found: error | |
| integration: | |
| name: Integration tests | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: .ci/install-deps.sh build | |
| - name: Download kbox binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: kbox-x86_64 | |
| - name: Make kbox executable | |
| run: chmod +x kbox | |
| - name: Cache rootfs | |
| id: cache-rootfs | |
| uses: actions/cache@v4 | |
| with: | |
| path: alpine.ext4 | |
| key: rootfs-${{ hashFiles('scripts/mkrootfs.sh', 'scripts/alpine-sha256.txt') }} | |
| - name: Build rootfs | |
| if: steps.cache-rootfs.outputs.cache-hit != 'true' | |
| run: ./scripts/mkrootfs.sh | |
| - name: Run integration tests | |
| run: ./scripts/run-tests.sh ./kbox alpine.ext4 | |
| asan: | |
| name: ASAN/UBSAN build | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| needs: [unit-tests, coding-style] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install build dependencies | |
| run: .ci/install-deps.sh lkl | |
| - name: Provision LKL | |
| uses: ./.github/actions/provision-lkl | |
| with: | |
| gh-token: ${{ github.token }} | |
| - name: Build with ASAN+UBSAN (default) | |
| run: make | |
| - name: Run unit tests under ASAN | |
| run: make check-unit |