build: Update build script to enable cross compiling for Android #1015
Workflow file for this run
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
on: [push, pull_request, merge_group] | |
name: Continuous integration | |
jobs: | |
ci: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
rust: | |
- stable | |
- beta | |
- nightly | |
env: | |
# 20 MiB stack | |
RUST_MIN_STACK: 20971520 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set stack size | |
if: startsWith(matrix.os, 'windows') | |
run: echo "RUSTFLAGS=-C link-arg=/STACK:20971520" >> $env:GITHUB_ENV | |
- name: Install LLVM and Clang | |
if: startsWith(matrix.os, 'windows') | |
uses: KyleMayes/[email protected] | |
with: | |
version: "13.0" | |
directory: ${{ runner.temp }}/llvm | |
- name: Set LIBCLANG_PATH | |
if: startsWith(matrix.os, 'windows') | |
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV | |
- name: Set OPENSSL_ROOT_DIR | |
if: startsWith(matrix.os, 'windows') | |
run: echo "OPENSSL_ROOT_DIR=C:/Program Files/OpenSSL" >> $env:GITHUB_ENV | |
- name: Set OPENSSL_ROOT_DIR | |
if: startsWith(matrix.os, 'macos') | |
run: echo "OPENSSL_ROOT_DIR=/opt/homebrew/Cellar/[email protected]/1.1.1w" >> $GITHUB_ENV | |
- name: Install Rust | |
run: | | |
rustup set auto-self-update disable | |
rustup toolchain install ${{ matrix.rust }} --profile minimal --component rustfmt --component clippy | |
rustup default ${{ matrix.rust }} | |
echo CARGO_TERM_COLOR=always >> $GITHUB_ENV | |
echo CARGO_INCREMENTAL=0 >> $GITHUB_ENV | |
echo RUST_BACKTRACE=1 >> $GITHUB_ENV | |
shell: bash | |
- uses: Swatinem/rust-cache@v2 | |
- name: Cargo build | |
run: cargo build | |
- name: Cargo test | |
run: cargo test | |
- name: Cargo test --no-default-features | |
run: cargo test --no-default-features | |
- name: Cargo test --no-default-features --features serde,kems,sigs,std | |
run: cargo test --no-default-features --features serde,kems,sigs,std --manifest-path oqs/Cargo.toml | |
- name: Cargo test --no-default-features --features serde,kems,sigs | |
run: cargo test --no-default-features --features serde,kems,sigs --manifest-path oqs/Cargo.toml | |
- name: Cargo test --no-default-features --features non_portable,kems,sigs,std | |
run: cargo test --no-default-features --features non_portable,kems,sigs,std --manifest-path oqs/Cargo.toml | |
- name: Cargo fmt | |
run: cargo fmt --all -- --check | |
- name: Cargo clippy | |
run: cargo clippy | |
- name: Install cargo ndk and rust compiler for android targets | |
run: | | |
cargo install --locked cargo-ndk | |
rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android | |
- name: Cargo build android | |
if: ${{ ! startsWith(matrix.os, 'windows') }} | |
run: | | |
cargo ndk --bindgen -t x86_64 -t x86 -t armeabi-v7a -t arm64-v8a -o ./jniLibs rustc --crate-type cdylib -p oqs --no-default-features --features kems,sigs,std | |
# vim: set ft=yaml ts=2 sw=2 tw=0 et : |