Skip to content

Commit 5094346

Browse files
Fix QEMU CI
1 parent 3e41c12 commit 5094346

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

.github/workflows/qemu.yaml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ name: QEMU tests
99
jobs:
1010
qemu-tests:
1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
toolchain: [ stable, nightly, 1.68.0 ]
1415
target:
@@ -41,27 +42,43 @@ jobs:
4142
continue-on-error: ${{ matrix.experimental || false }}
4243
steps:
4344
- uses: actions/checkout@v4
45+
- name: Cache cargo
46+
uses: actions/cache@v4
47+
with:
48+
path: |
49+
~/.cargo/registry
50+
~/.cargo/git
51+
target
52+
key: ${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
53+
restore-keys: |
54+
${{ runner.os }}-cargo-${{ matrix.toolchain }}-
4455
- uses: dtolnay/rust-toolchain@master
4556
with:
4657
toolchain: ${{ matrix.toolchain }}
4758
targets: ${{ matrix.target }}
4859

4960
- name: Install QEMU
5061
run: |
51-
sudo apt-get update
52-
sudo apt-get install -y qemu-system-misc
62+
set -euo pipefail
63+
for i in 1 2 3; do
64+
sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-system-misc && break || sleep 5
65+
done
66+
qemu-system-riscv64 --version || true
67+
qemu-system-riscv32 --version || true
5368
5469
- name: Build example for QEMU
5570
run: |
71+
set -euo pipefail
5672
FEATURES_ARG=""
5773
if [ -n "${{ matrix.features }}" ]; then
5874
FEATURES_ARG="--features=${{ matrix.features }}"
5975
fi
60-
RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --release ${FEATURES_ARG}
76+
RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --locked --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --release ${FEATURES_ARG}
6177
6278
- name: Run example on QEMU (riscv32)
6379
if: startsWith(matrix.target, 'riscv32')
6480
run: |
81+
set -euo pipefail
6582
FEATURES_LABEL=""
6683
if [ -n "${{ matrix.features }}" ]; then
6784
FEATURES_LABEL=" (${{ matrix.features }})"
@@ -80,6 +97,7 @@ jobs:
8097
- name: Run example on QEMU (riscv64)
8198
if: startsWith(matrix.target, 'riscv64')
8299
run: |
100+
set -euo pipefail
83101
FEATURES_LABEL=""
84102
if [ -n "${{ matrix.features }}" ]; then
85103
FEATURES_LABEL=" (${{ matrix.features }})"
@@ -94,20 +112,3 @@ jobs:
94112
fi
95113
exit $exitcode
96114
}
97-
98-
qemu-tests-check:
99-
needs:
100-
- qemu-tests
101-
runs-on: ubuntu-latest
102-
if: always()
103-
steps:
104-
- run: |
105-
RESULT="${{ needs.qemu-tests.result }}"
106-
if [ "$RESULT" = "failure" ]; then
107-
echo "QEMU tests failed"
108-
exit 1
109-
elif [ "$RESULT" = "skipped" ]; then
110-
echo "QEMU tests skipped"
111-
exit 1
112-
fi
113-
echo "QEMU tests passed"

0 commit comments

Comments
 (0)