ci: refactor test script #2070
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 MOS | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: "MOS ${{matrix.config.name}} (${{matrix.build_type}})" | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux:latest | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { "name": "x86_64 limine", "arch": "x86_64", "bootwait": 20 } | |
- { "name": "RISC-V limine", "arch": "riscv64", "bootwait": 15 } | |
build_type: [Debug, Release] | |
steps: | |
- name: Install Packages | |
run: | | |
pacman -Syu --noconfirm base-devel git nasm jq ninja cpio wget unzip cmake limine protobuf python-protobuf python-setuptools | |
pacman -Syu --noconfirm qemu-system-x86 qemu-system-riscv64 | |
- name: Install Toolchains | |
run: | | |
echo "" >> /etc/pacman.conf | |
echo '[mos]' >> /etc/pacman.conf | |
echo 'SigLevel = Optional TrustAll' >> /etc/pacman.conf | |
echo 'Server = https://repo.mooody.me/$repo/$arch' >> /etc/pacman.conf | |
pacman -Sy --noconfirm rustup \ | |
mos-sdk \ | |
${{matrix.config.arch}}-mos-gcc \ | |
${{matrix.config.arch}}-mos-binutils \ | |
${{matrix.config.arch}}-mos-mlibc \ | |
${{matrix.config.arch}}-mos-nlohmann-json \ | |
mos-llvm \ | |
mos-rust | |
pacman -Sy --noconfirm python-ptyprocess | |
rustup toolchain link mosdev /opt/mos-rust/ | |
rustup default mosdev | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Configure | |
run: | | |
cmake \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DMOS_CONFIG=${{matrix.config.arch}}-default \ | |
-DMOS_ARCH=${{matrix.config.arch}} \ | |
-B build \ | |
-G Ninja | |
ln -svf $(pwd)/build/ $(pwd)/build/${{matrix.config.arch}} | |
- name: Build | |
run: | | |
cd build | |
mkdir -p initrd/libs | |
# Copy the required libraries to the initrd | |
cp -rv /opt/${{matrix.config.arch}}-mos/lib/lib*.so* initrd/lib/ | |
cp -rv /opt/${{matrix.config.arch}}-mos/lib/ld.so initrd/lib/ | |
ninja mos_uefi_partition | |
- name: Upload Bootable Artifact | |
uses: actions/[email protected] | |
with: | |
name: MOS-${{matrix.build_type}}-${{matrix.config.arch}} | |
path: build/uefi-files | |
- name: Test | |
run: | | |
cd build | |
../tools/testing/main.py \ | |
--arch ${{matrix.config.arch}} \ | |
--kernel-tests \ | |
-t 120 \ | |
-w ${{matrix.config.bootwait}} | |
- name: Upload Test Results | |
if: always() | |
uses: actions/[email protected] | |
with: | |
name: MOS-${{matrix.build_type}}-${{matrix.config.arch}}-test-results | |
path: build/test-results/ |