gnu-efi/.github/workflows/linux-mingw.yml
Pete Batard 46aca420cc
Add build time QEMU UEFI tests
Use OVMF/AVMF and the UEFI Shell in a QEMU environment to validate that the
UEFI executables we build do run and produce the expected output.

The tests to run are flexibly defined is test_list.txt and can be expanded.

At this stage, only x64, ia32, aa64 and arm are run, which rely on the UEFI
firmwares found at https://github.com/pbatard/EfiFs/tree/gh-pages/AAVMF and
https://github.com/pbatard/EfiFs/tree/gh-pages/OVMF as well as Shell builds
from https://github.com/pbatard/UEFI-Shell.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 16:12:11 +01:00

97 lines
2.5 KiB
YAML

name: Linux, MinGW
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x64, ia32]
include:
- arch: x64
dir: x86_64
pkg: gcc-mingw-w64-x86-64
tuple: x86_64-w64-mingw32-
- arch: ia32
dir: ia32
pkg: gcc-mingw-w64-i686
tuple: i686-w64-mingw32-
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install gcc toolchain
run: sudo apt install ${{ matrix.pkg }}
- name: Build
run: make ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.tuple }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: ./${{ matrix.dir }}/apps/*.efi
tests:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
arch: [x64, ia32]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
- arch: ia32
pkg: qemu-system-x86
qemu_arch: i386
qemu_opts: -M pc
fw_base: OVMF
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image -nodefaults -nographic -serial stdio -net none"
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh