Skip to content

Commit

Permalink
Enable cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
lemaitre-aneo committed Mar 23, 2024
1 parent e079c9d commit a6cb179
Showing 1 changed file with 60 additions and 17 deletions.
77 changes: 60 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,84 @@ jobs:
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-musl, os: linux, arch: amd64, runner: ubuntu-latest, cross: false }
- { target: x86_64-apple-darwin, os: darwin, arch: amd64, runner: macos-latest, cross: false }
- { target: x86_64-pc-windows-msvc, os: windows, arch: amd64, runner: windows-latest, cross: false }
runs-on: ${{ matrix.job.runner }}
target:
# BSDs
- { platform: aarch64-unknown-freebsd, os: linux, runner: ubuntu-latest }
- { platform: i686-unknown-freebsd, os: linux, runner: ubuntu-latest }
- { platform: x86_64-unknown-freebsd, os: linux, runner: ubuntu-latest }
- { platform: aarch64-unknown-netbsd, os: linux, runner: ubuntu-latest }
- { platform: x86_64-unknown-netbsd, os: linux, runner: ubuntu-latest }

# WASM
- { platform: wasm32-wasi, os: linux, runner: ubuntu-latest }

# Android
- { platform: aarch64-linux-android, os: linux, runner: ubuntu-latest }
- { platform: arm-linux-androideabi, os: linux, runner: ubuntu-latest }
- { platform: i686-linux-android, os: linux, runner: ubuntu-latest }
- { platform: x86_64-linux-android, os: linux, runner: ubuntu-latest }

# Linux Musl
- { platform: aarch64-unknown-linux-musl, os: linux, runner: ubuntu-latest }
- { platform: arm-unknown-linux-musleabi, os: linux, runner: ubuntu-latest }
- { platform: i586-unknown-linux-musl, os: linux, runner: ubuntu-latest }
- { platform: i686-unknown-linux-musl, os: linux, runner: ubuntu-latest }
- { platform: x86_64-unknown-linux-musl, os: linux, runner: ubuntu-latest }

# Linux GNU
- { platform: aarch64-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: arm-unknown-linux-gnueabi, os: linux, runner: ubuntu-latest }
- { platform: i586-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: i686-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: x86_64-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: mips-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: mips64-unknown-linux-gnuabi64, os: linux, runner: ubuntu-latest }
- { platform: powerpc-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: powerpc64-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: riscv32gc-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: riscv64gc-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: s390x-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: sparc-unknown-linux-gnu, os: linux, runner: ubuntu-latest }
- { platform: sparc64-unknown-linux-gnu, os: linux, runner: ubuntu-latest }

# MacOS
- { platform: aarch64-apple-darwin, os: darwin, runner: macos-latest }
- { platform: x86_64-apple-darwin, os: darwin, runner: macos-latest }

# Windows
- { platform: aarch64-pc-windows-msvc, os: windows, runner: windows-latest }
- { platform: i586-pc-windows-msvc, os: windows, runner: windows-latest }
- { platform: i686-pc-windows-msvc, os: windows, runner: windows-latest }
- { platform: x86_64-pc-windows-msvc, os: windows, runner: windows-latest }
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Protoc
uses: arduino/setup-protoc@v3
if: not ${{ matrix.job.cross }}
- name: Install Cross Compiler
if: matrix.job.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools gcc-multilib
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
#targets: ${{ matrix.target.platform }}
toolchain: 1.76.0
components: rust-src,rust-docs,rustfmt,clippy
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target.platform }}
- name: Setup Cache
uses: Swatinem/[email protected]
with:
shared-key: "build-${{ matrix.job.target }}"
shared-key: "build-${{ matrix.target.platform }}"
- name: Build
run: |
cargo build --locked --release --target ${{ matrix.job.target }}
cargo build --all --locked --release
- name: Test
run: |
cargo test --locked --release --target ${{ matrix.job.target }}
cargo test --all --locked --release
- name: Format
run: |
cargo fmt --check
cargo fmt --all --check
- name: Clippy
run: |
cargo clippy --no-deps -- -Dwarnings -Dunused-crate-dependencies
cargo clippy --all --no-deps -- -Dwarnings -Dunused-crate-dependencies

0 comments on commit a6cb179

Please sign in to comment.