aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
diff options
context:
space:
mode:
authorHenrik Tjäder <henrik@tjaders.com>2024-01-17 21:10:23 +0100
committerGitHub <noreply@github.com>2024-01-17 20:10:23 +0000
commit7757d17c7ce131caf5a72ecbd9cabf8495b91bd4 (patch)
tree69aa6322bd609275b32f441deb5c15b6f076b14c /.github/workflows/build.yml
parent54c2c18c8f016827fa676fdbe97e396fe329bc36 (diff)
CI: Add extra step building and uploading QEMU (#883)
Uses GHA caching to make it quick for future builds
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r--.github/workflows/build.yml72
1 files changed, 71 insertions, 1 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a44d837..79d2255 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -13,6 +13,8 @@ env:
OLDSTABLE_VERSION: 1
OLDOLDSTABLE_VERSION: 0.5
OLDOLDOLDSTABLE_VERSION: 0.4
+ QEMU_VERSION: 8.2.0
+ QEMU_URL: https://download.qemu.org/qemu-8.2.0.tar.xz
jobs:
# Run cargo xtask format-check
@@ -170,9 +172,64 @@ jobs:
- name: Check the examples
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
testexamples:
name: QEMU run
+ needs: buildqemu
runs-on: ubuntu-22.04
strategy:
matrix:
@@ -207,11 +264,24 @@ jobs:
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- - name: Install QEMU
+ - name: Install QEMU to get dependencies
run: |
sudo apt update
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
run: cargo xtask --deny-warnings --backend ${{ matrix.backend }} qemu