Skip to content

Commit

Permalink
build: Add aarch64 target to GitHub Actions build
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
retrage committed Nov 20, 2022
1 parent eddb3c8 commit edeabe7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,35 @@ jobs:
if: github.event_name == 'pull_request'
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-none.json
tests: true
- target: aarch64-unknown-none.json
tests: false
steps:
- name: Code checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install rust-src
run: rustup component add rust-src
- name: Install clippy
run: rustup component add clippy
- name: Install rustfmt
run: rustup component add rustfmt
- name: Install Rust components
run: rustup component add rust-src clippy rustfmt
- name: Build (debug)
run: cargo build --target x86_64-unknown-none.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem
run: cargo build --target ${{ matrix.target }} -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem
- name: Build (release)
run: cargo build --release --target x86_64-unknown-none.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem
run: cargo build --release --target ${{ matrix.target }} -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem
- name: Clippy (default)
run: cargo clippy --target x86_64-unknown-none.json -Zbuild-std=core,alloc
run: cargo clippy --target ${{ matrix.target }} -Zbuild-std=core,alloc
- name: Clippy (all targets, all features)
run: cargo clippy --all-targets --all-features
- name: Formatting
run: cargo fmt --all -- --check
- name: Unit tests
- if: ${{ matrix.tests }}
name: Unit tests
run: |
sudo apt-get install -y mtools
bash scripts/run_unit_tests.sh
14 changes: 11 additions & 3 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,32 @@ jobs:
- name: Code checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Get active Rust toolchain
id: get-toolchain
run: echo "toolchain=`rustup show active-toolchain | cut -d ' ' -f1`" >> $GITHUB_ENV

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

- name: Build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
file: ./resources/Dockerfile
build-args: |
RUST_TOOLCHAIN=${{ env.toolchain }}
platforms: linux/amd64
platforms: |
linux/arm64
linux/amd64
push: ${{ github.repository == 'cloud-hypervisor/rust-hypervisor-firmware' && github.event_name == 'push' }}
tags: rusthypervisorfirmware/dev:latest

Expand Down

0 comments on commit edeabe7

Please sign in to comment.