Windows and bindings support #39
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: CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test_plugins_linux: | |
name: Build and Test Plugins (Linux) | |
runs-on: ubuntu-latest | |
container: ubuntu:22.04 | |
steps: | |
- name: Install QEMU User | |
run: | | |
apt-get -y update && \ | |
apt-get -y install git curl qemu-user build-essential | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: actions/checkout@v4 | |
- name: Test QEMU Install | |
run: | | |
qemu-x86_64 --help | |
- name: Build and Test Tracer | |
run: | | |
cd plugins/tracer | |
cargo build -r || exit 0 | |
cargo build -r | |
cargo run -r --bin tracer -- -a /bin/ls -- -lah | |
cd ../.. | |
- name: Build and Test Tiny | |
run: | | |
cd plugins/tiny | |
cargo build -r | |
qemu-x86_64 -plugin ../../target/release/libtiny.so /bin/ls -lah | |
cd ../.. | |
test_plugins_windows: | |
name: Build and Test Plugins (Windows) | |
runs-on: windows-latest | |
env: | |
# QEMU 8.1.0 | |
QEMU_URL: "https://qemu.weilnetz.de/w64/2023/qemu-w64-setup-20230822.exe" | |
RUSTUP_URL: "https://win.rustup.rs/x86_64" | |
FEDORA_CLOUDIMG_URL: "https://download.fedoraproject.org/pub/fedora/linux/releases/39/Cloud/x86_64/images/Fedora-Cloud-Base-39-1.5.x86_64.qcow2" | |
steps: | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: UCRT64 | |
update: true | |
install: git mingw-w64-ucrt-x86_64-gcc | |
location: C:\msys-custom | |
- name: Download and Install Rust | |
run: | | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -Uri ${{ env.RUSTUP_URL }} -OutFile rustup-init.exe | |
./rustup-init.exe --default-toolchain nightly --default-host x86_64-pc-windows-gnu -y | |
- name: Install QEMU | |
shell: msys2 {0} | |
run: | | |
pacman -Syu --noconfirm | |
pacman -Sy mingw-w64-ucrt-x86_64-qemu --noconfirm | |
- name: Test QEMU | |
run: | | |
C:\msys-custom\msys64\ucrt64\bin\qemu-system-x86_64.exe --version | |
- uses: actions/checkout@v4 | |
- name: Download Cloud Image | |
run: | | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -Uri ${{ env.FEDORA_CLOUDIMG_URL }} -OutFile Fedora-Cloud-Base-39-1.5.x86_64.qcow2 | |
ls | |
- name: Build and Test Tiny | |
run: | | |
cd plugins/tiny-system | |
cargo build -r | |
cd ../.. | |
Start-Process PowerShell.exe -NoNewWindow -ArgumentList "-Command", "C:\msys-custom\msys64\ucrt64\bin\qemu-system-x86_64.exe -machine type=q35 -m 2G -nographic -device virtio-net-pci,netdev=net0 -netdev user,id=net0,hostfwd=tcp::2222-:22 -drive if=virtio,format=qcow2,file=Fedora-Cloud-Base-39-1.5.x86_64.qcow2 -drive if=virtio,format=raw,file=.github/rsrc/seed.img -plugin target/release/tiny_system.dll" | |
echo "Sleeping 180.0 seconds until booted (boot process took 118s first time)" | |
Start-Sleep -Seconds 180.0 | |
echo "Sending shutdown command to VM" | |
ssh -p 2222 -i .github/rsrc/id_rsa fedora@localhost sudo shutdown now | |
# Wait for shutdown | |
echo "Waiting 30.0 seconds for shutdown" | |
Start-Sleep -Seconds 30.0 |