-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Download musl toolchain | ||
|
||
inputs: | ||
arch: | ||
description: 'Architecture' | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Cache musl | ||
id: cache-musl | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ inputs.arch }}-linux-musl-cross | ||
key: ${{ inputs.arch }}-linux-musl-cross | ||
- name: Download musl toolchain | ||
if: steps.cache-musl.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
MUSL_PATH=${{ inputs.arch }}-linux-musl-cross | ||
wget https://musl.cc/${MUSL_PATH}.tgz | ||
tar -xf ${MUSL_PATH}.tgz | ||
- uses: actions/cache/save@v3 | ||
if: steps.cache-musl.outputs.cache-hit != 'true' | ||
with: | ||
path: ${{ inputs.arch }}-linux-musl-cross | ||
key: ${{ inputs.arch }}-linux-musl-cross | ||
|
||
- name: Add to PATH environment variable | ||
shell: bash | ||
run: | | ||
echo "$PWD/${{ inputs.arch }}-linux-musl-cross/bin" >> $GITHUB_PATH | ||
- name: Verify installation | ||
shell: bash | ||
run: | | ||
${{ inputs.arch }}-linux-musl-gcc --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Download and build QEMU | ||
|
||
inputs: | ||
qemu-version: | ||
description: 'QEMU version' | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Cache QEMU | ||
id: cache-qemu | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: qemu_build | ||
key: qemu-${{ inputs.qemu-version }}-slirp-1 | ||
- name: Download and build QEMU | ||
if: steps.cache-qemu.outputs.cache-hit != 'true' | ||
env: | ||
QEMU_PATH: qemu-${{ inputs.qemu-version }} | ||
PREFIX: ${{ github.workspace }}/qemu_build | ||
shell: bash | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y ninja-build libslirp-dev | ||
wget https://download.qemu.org/$QEMU_PATH.tar.xz && tar -xJf $QEMU_PATH.tar.xz | ||
cd $QEMU_PATH \ | ||
&& ./configure --prefix=$PREFIX --target-list=x86_64-softmmu,riscv64-softmmu,aarch64-softmmu --enable-slirp \ | ||
&& make -j > /dev/null 2>&1 \ | ||
&& make install | ||
- uses: actions/cache/save@v3 | ||
if: steps.cache-qemu.outputs.cache-hit != 'true' | ||
with: | ||
path: qemu_build | ||
key: qemu-${{ inputs.qemu-version }}-slirp-1 | ||
|
||
- name: Install QEMU | ||
shell: bash | ||
run: | | ||
echo "$PWD/qemu_build/bin" >> $GITHUB_PATH | ||
- name: Verify installation | ||
shell: bash | ||
run: | | ||
qemu-system-x86_64 --version | ||
qemu-system-aarch64 --version | ||
qemu-system-riscv64 --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
arch: [riscv64] | ||
rust-toolchain: [nightly] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.rust-toolchain }} | ||
components: rust-src | ||
- uses: actions-rs/[email protected] | ||
with: | ||
crate: cargo-binutils | ||
version: latest | ||
use-tool-cache: true | ||
|
||
- uses: ./.github/workflows/actions/setup-musl | ||
with: | ||
arch: ${{ matrix.arch }} | ||
- name: Build ${{ github.repository }} | ||
run: | | ||
rustup target add riscv64gc-unknown-none-elf | ||
cargo build -vv --target riscv64gc-unknown-none-elf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Test CI | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
qemu-version: 8.2.0 | ||
rust-toolchain: nightly-2024-01-31 | ||
|
||
jobs: | ||
|
||
examples-test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
arch: [riscv64] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ env.rust-toolchain }} | ||
components: rust-src | ||
- uses: actions-rs/[email protected] | ||
with: | ||
crate: cargo-binutils | ||
version: latest | ||
use-tool-cache: true | ||
- uses: ./.github/workflows/actions/setup-qemu | ||
with: | ||
qemu-version: ${{ env.qemu-version }} | ||
- uses: ./.github/workflows/actions/setup-musl | ||
with: | ||
arch: ${{ matrix.arch }} | ||
- name: Run examples | ||
run: | | ||
cd examples | ||
make run |