Skip to content

Commit 7ee0cf2

Browse files
committed
build: Add aarch64 target to GitHub Actions build
This commit introduces matrix to add the aarch64 target. The unit tests are disabled for aarch64 target because default GitHub Actions runners are x86_64 only. Signed-off-by: Akira Moroo <[email protected]>
1 parent d5ec9e9 commit 7ee0cf2

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

.github/workflows/build.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,35 @@ jobs:
99
if: github.event_name == 'pull_request'
1010
name: Build
1111
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- target: x86_64-unknown-none.json
17+
tests: true
18+
- target: aarch64-unknown-none.json
19+
tests: false
1220
steps:
1321
- name: Code checkout
1422
uses: actions/checkout@v2
1523
with:
1624
fetch-depth: 0
1725
- name: Install Rust toolchain
1826
uses: dtolnay/rust-toolchain@stable
19-
- name: Install rust-src
20-
run: rustup component add rust-src
21-
- name: Install clippy
22-
run: rustup component add clippy
23-
- name: Install rustfmt
24-
run: rustup component add rustfmt
27+
- name: Install Rust components
28+
run: rustup component add rust-src clippy rustfmt
2529
- name: Build (debug)
26-
run: cargo build --target x86_64-unknown-none.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem
30+
run: cargo build --target ${{ matrix.target }} -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem
2731
- name: Build (release)
28-
run: cargo build --release --target x86_64-unknown-none.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem
32+
run: cargo build --release --target ${{ matrix.target }} -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem
2933
- name: Clippy (default)
30-
run: cargo clippy --target x86_64-unknown-none.json -Zbuild-std=core,alloc
34+
run: cargo clippy --target ${{ matrix.target }} -Zbuild-std=core,alloc
3135
- name: Clippy (all targets, all features)
3236
run: cargo clippy --all-targets --all-features
3337
- name: Formatting
3438
run: cargo fmt --all -- --check
35-
- name: Unit tests
39+
- if: ${{ matrix.tests }}
40+
name: Unit tests
3641
run: |
3742
sudo apt-get install -y mtools
3843
bash scripts/run_unit_tests.sh

.github/workflows/docker-image.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,32 @@ jobs:
1818
- name: Code checkout
1919
uses: actions/checkout@v2
2020

21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v2
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
2127
- name: Get active Rust toolchain
2228
id: get-toolchain
2329
run: echo "toolchain=`rustup show active-toolchain | cut -d ' ' -f1`" >> $GITHUB_ENV
2430

2531
- name: Login to DockerHub
2632
if: ${{ github.repository == 'cloud-hypervisor/rust-hypervisor-firmware' && github.event_name == 'push' }}
27-
uses: docker/login-action@v1
33+
uses: docker/login-action@v2
2834
with:
2935
username: ${{ secrets.DOCKERHUB_USERNAME }}
3036
password: ${{ secrets.DOCKERHUB_TOKEN }}
3137

3238
- name: Build
33-
uses: docker/build-push-action@v2
39+
uses: docker/build-push-action@v3
3440
with:
3541
file: ./resources/Dockerfile
3642
build-args: |
3743
RUST_TOOLCHAIN=${{ env.toolchain }}
38-
platforms: linux/amd64
44+
platforms: |
45+
linux/arm64
46+
linux/amd64
3947
push: ${{ github.repository == 'cloud-hypervisor/rust-hypervisor-firmware' && github.event_name == 'push' }}
4048
tags: rusthypervisorfirmware/dev:latest
4149

0 commit comments

Comments
 (0)