na-mainloop: Drop unneeded cargo-apk
setup and add xbuild
docs
#43
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
name: ci | |
on: | |
push: | |
pull_request: | |
env: | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: "-C debuginfo=0 --deny warnings" | |
RUSTDOCFLAGS: -Dwarnings | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust_version: [stable] | |
cargo_ndk_args: [-t arm64-v8a -t armeabi-v7a -t x86_64 -t x86 -o app/src/main/jniLibs/] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: hecrj/setup-rust-action@v1 | |
with: | |
rust-version: ${{ matrix.rust_version }} | |
- name: Install LLVM | |
run: sudo apt-get update && sudo apt-get install llvm | |
- name: Build na-mainloop with xbuild | |
working-directory: na-mainloop | |
run: | | |
cargo install xbuild | |
# Showcase that x builds out-of-the-box with no external dependencies | |
x build --platform android --arch arm64 | |
- name: Install Rust targets | |
run: > | |
rustup target add | |
aarch64-linux-android | |
armv7-linux-androideabi | |
x86_64-linux-android | |
i686-linux-android | |
- name: Install cargo-ndk | |
run: cargo install cargo-ndk | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Setup shared Cargo target | |
# Each example is in a separate workspace but we want to use | |
# a shared target to speed up builds of all examples | |
run: mkdir shared-target | |
- name: Build na-mainloop example | |
working-directory: na-mainloop | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build agdk-mainloop example | |
working-directory: agdk-mainloop | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build na-subclass-jni | |
working-directory: na-subclass-jni | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build na-winit-wgpu | |
working-directory: na-winit-wgpu | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build na-winit-glutin | |
working-directory: na-winit-glutin | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build agdk-winit-glutin | |
working-directory: na-winit-glutin | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build agdk-cpal | |
working-directory: agdk-cpal | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build agdk-oboe | |
working-directory: agdk-oboe | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build na-egui example | |
working-directory: na-egui | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build agdk-egui example | |
working-directory: agdk-egui | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
- name: Build agdk-eframe example | |
working-directory: agdk-eframe | |
run: > | |
CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
./gradlew build && | |
find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
# We don't currently build the OpenXR examples on Android because I | |
# haven't found a nice nice way to pull in libopenxr_loader binaries that | |
# we can link against. Normally I would use the binaries as part of the | |
# Oculus SDK | |
# | |
# TODO: maybe we can look at using the 'prefab' `.aar`s from Khronos here: | |
# https://search.maven.org/artifact/org.khronos.openxr/openxr_loader_for_android | |
# | |
#- name: Build na-openxr-info example | |
# working-directory: na-openxr-info | |
# run: > | |
# CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build --features=android && | |
# ./gradlew build && | |
# find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
#- name: Build na-openxr-wgpu | |
# working-directory: na-openxr-wgpu | |
# run: > | |
# CARGO_TARGET_DIR=$GITHUB_WORKSPACE/shared-target cargo ndk ${{ matrix.cargo_ndk_args }} build && | |
# ./gradlew build && | |
# find $GITHUB_WORKSPACE/shared-target -iname '*.so' -exec rm {} \; | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt | |
- name: Format | |
run: | | |
for dir in agdk-* na-*; do | |
cd $GITHUB_WORKSPACE/$dir | |
cargo fmt --all -- --check | |
done |