use cargo for rust stuff #202
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: Build & Test | |
on: [push, pull_request] | |
jobs: | |
build-test-nix: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
stuff: | |
- flake: IA-32 | |
step_config: make alldefconfig MAKE_ARCH=x86 && make tests MAKE_ARCH=x86 | |
step_build: make MAKE_ARCH=x86 CROSS_COMPILE=i686-elf- | |
step_bootimg: make bootimg-x86-32 MAKE_ARCH=x86 | |
nm: i686-elf-nm | |
runcmd: qemu-system-x86_64 -cdrom vix.iso -nographic | |
ignore_test_failure: false | |
- flake: x86-64 | |
step_config: make alldefconfig MAKE_ARCH=x86 && make tests MAKE_ARCH=x86 && sed -i "s/CONFIG_ENABLE_KERNEL_32=y/# CONFIG_ENABLE_KERNEL_32=y\nCONFIG_ENABLE_KERNEL_64=y/g" kernel/.config | |
step_build: make MAKE_ARCH=x86 CROSS_COMPILE=x86_64-elf- | |
step_bootimg: make bootimg-x86-64 MAKE_ARCH=x86 | |
nm: x86_64-elf-nm | |
runcmd: qemu-system-x86_64 -nographic -serial mon:stdio -hda vix_uefi.img | |
ignore_test_failure: false | |
- flake: aarch64 | |
step_config: make alldefconfig MAKE_ARCH=aarch64 && make tests MAKE_ARCH=aarch64 | |
step_build: make MAKE_ARCH=aarch64 CROSS_COMPILE=aarch64-none-elf- | |
step_bootimg: make bootimg-aarch64 MAKE_ARCH=aarch64 | |
nm: aarch64-none-elf-nm | |
runcmd: qemu-system-aarch64 -m 1024m -bios "$VIX_QEMU_UEFI_BIOS_PATH" -cpu cortex-a53 -smp 4 -machine virt -device ramfb -device qemu-xhci -device usb-kbd -nographic -serial mon:stdio -hda vix_uefi.img | |
ignore_test_failure: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v28 | |
- name: Restore and cache Nix store | |
uses: nix-community/cache-nix-action@v5 | |
with: | |
primary-key: nix-${{ runner.os }}-${{ matrix.stuff.flake }}-${{ hashFiles('**/*.nix', 'flake.lock') }} | |
restore-prefixes-first-match: nix-${{ runner.os }}- | |
purge-prefixes: cache-${{ runner.os }} | |
- name: Build development environment | |
run: nix develop .#${{ matrix.stuff.flake }} --print-build-logs --command bash -c "ls -lah" | |
- name: Run Kconfig | |
run: | | |
nix develop .#${{ matrix.stuff.flake }} --command bash -c '${{ matrix.stuff.step_config }}' | |
- name: Compile | |
run: | | |
nix develop .#${{ matrix.stuff.flake }} --command bash -c '${{ matrix.stuff.step_build }}' | |
- name: Build boot image | |
run: | | |
nix develop .#${{ matrix.stuff.flake }} --command bash -c '${{ matrix.stuff.step_bootimg }}' | |
- name: Run in emulator | |
run: nix develop .#${{ matrix.stuff.flake }} --command bash -c 'timeout 30 ${{ matrix.stuff.runcmd }} | ansifilter | tee log.txt || true' | |
- name: Check Tests | |
continue-on-error: ${{ matrix.stuff.ignore_test_failure }} | |
run: | | |
nix develop .#${{ matrix.stuff.flake }} --command bash -c '${{ matrix.stuff.nm }} --format=bsd -n kernel/kernel.o | python3 tools/testparser.py log.txt >> $GITHUB_STEP_SUMMARY' | |
nix develop .#${{ matrix.stuff.flake }} --command bash -c '${{ matrix.stuff.nm }} --format=bsd -n kernel/kernel.o | python3 tools/testparser.py log.txt -f' | |
formatting_and_spelling: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y codespell python3 | |
- name: count LOC | |
run: | | |
cd $GITHUB_WORKSPACE | |
python3 tools/locchart.py >> $GITHUB_STEP_SUMMARY | |
- name: codespell | |
run: cd $GITHUB_WORKSPACE && codespell -q 3 --builtin clear -S ./.git,./kernel/scripts -L useable || true >> $GITHUB_STEP_SUMMARY | |
- name: clang-format | |
run: cd $GITHUB_WORKSPACE && python3 tools/clang_check.py >> $GITHUB_STEP_SUMMARY |