CI: Add extra step building and uploading QEMU (#883)

Uses GHA caching to make it quick for future builds
This commit is contained in:
Henrik Tjäder 2024-01-17 21:10:23 +01:00 committed by GitHub
parent 54c2c18c8f
commit 7757d17c7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,6 +13,8 @@ env:
OLDSTABLE_VERSION: 1 OLDSTABLE_VERSION: 1
OLDOLDSTABLE_VERSION: 0.5 OLDOLDSTABLE_VERSION: 0.5
OLDOLDOLDSTABLE_VERSION: 0.4 OLDOLDOLDSTABLE_VERSION: 0.4
QEMU_VERSION: 8.2.0
QEMU_URL: https://download.qemu.org/qemu-8.2.0.tar.xz
jobs: jobs:
# Run cargo xtask format-check # Run cargo xtask format-check
@ -170,9 +172,64 @@ jobs:
- name: Check the examples - name: Check the examples
run: cargo xtask usage-example-build run: cargo xtask usage-example-build
buildqemu:
name: Get modern QEMU, build and store
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache QEMU build
id: cache-qemu
uses: actions/cache@v4
with:
path: qemu-${{ env.QEMU_VERSION }}/build
key: ${{ runner.OS }}-qemu-${{ env.QEMU_VERSION }}
restore-keys: |
${{ runner.OS }}-qemu-${{ env.QEMU_VERSION }}
${{ runner.OS }}-qemu-
- name: Install QEMU to get dependencies
run: |
sudo apt update
sudo apt install -y qemu-system-arm
sudo apt-get install git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev ninja-build
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
name: Download QEMU
run: wget "${{ env.QEMU_URL }}"
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
name: Extract QEMU
run: tar xvJf qemu-${{ env.QEMU_VERSION }}.tar.xz
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
name: Configure QEMU
run: |
cd qemu-${{ env.QEMU_VERSION }}
./configure --target-list=arm-softmmu,riscv32-softmmu
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
name: Build QEMU
run: |
cd qemu-${{ env.QEMU_VERSION }}
make -j$(nproc)
- name: Archive QEMU build
run: |
cd qemu-${{ env.QEMU_VERSION }}/build
tar -cf $GITHUB_WORKSPACE/qemu.tar *
- name: Store QEMU build
uses: actions/upload-artifact@v4
with:
name: qemu
path: qemu.tar
# Verify the example output with run-pass tests # Verify the example output with run-pass tests
testexamples: testexamples:
name: QEMU run name: QEMU run
needs: buildqemu
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
strategy: strategy:
matrix: matrix:
@ -207,11 +264,24 @@ jobs:
- name: Cache Dependencies - name: Cache Dependencies
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Install QEMU - name: Install QEMU to get dependencies
run: | run: |
sudo apt update sudo apt update
sudo apt install -y qemu-system-arm sudo apt install -y qemu-system-arm
- name: Download built QEMU
uses: actions/download-artifact@v4
with:
name: qemu
- name: Extract QEMU into local path
run: tar -xf qemu.tar -C /usr/local/bin
- name: Check which QEMU is used
run: |
which qemu-system-arm
which qemu-system-riscv32
- name: Run-pass tests - name: Run-pass tests
run: cargo xtask --deny-warnings --backend ${{ matrix.backend }} qemu run: cargo xtask --deny-warnings --backend ${{ matrix.backend }} qemu