Skip to content

Commit

Permalink
CI: QEMU Add caching
Browse files Browse the repository at this point in the history
  • Loading branch information
AfoHT committed Jan 17, 2024
1 parent 6256670 commit 9bb584e
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,38 +179,68 @@ jobs:
- 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
- name: Download QEMU
- if: ${{ steps.cache-qemu.outputs.cache-hit == 'true' }}
name: Cache hit
continue-on-error: true
run: |
ls -l qemu-${{ env.QEMU_VERSION }}/build
ls -l $GITHUB_WORKSPACE/
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
name: Download QEMU
run: wget "${{ env.QEMU_URL }}"

- name: Extract QEMU
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
name: Extract QEMU
run: tar xvJf qemu-${{ env.QEMU_VERSION }}.tar.xz

- name: Configure QEMU
- if: ${{ steps.cache-qemu.outputs.cache-hit != 'true' }}
name: Configure QEMU
run: |
cd qemu-${{ env.QEMU_VERSION }}
./configure --target-list=arm-softmmu,riscv32-softmmu
- name: Build QEMU
- 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 ../qemu.tar *
tar -cf $GITHUB_WORKSPACE/qemu.tar *
- name: Store QEMU build
uses: actions/upload-artifact@v4
with:
name: qemu
path: qemu-${{ env.QEMU_VERSION }}/qemu.tar
path: qemu.tar

- name: Print env
continue-on-error: true
run: |
pwd
ls -l
ls -l $GITHUB_WORKSPACE/
ls -l qemu-${{ env.QEMU_VERSION }}
ls -l qemu-${{ env.QEMU_VERSION }}/build
# Verify the example output with run-pass tests
Expand Down Expand Up @@ -264,9 +294,6 @@ jobs:
- name: Extract QEMU into local path
run: tar -xf qemu.tar -C /usr/local/bin

- name: Print $PATH
run: echo $PATH

- name: Check which QEMU is used
run: |
which qemu-system-arm
Expand Down

0 comments on commit 9bb584e

Please sign in to comment.