build: added initial ci #32
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
name: Check | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
RUST_VERSION: "nightly" | |
jobs: | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Cache cargo resources | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: deps | |
cache-on-failure: true | |
- run: cargo fmt --all -- --check | |
clippy: | |
name: Clippy | |
strategy: | |
matrix: | |
include: | |
- target: aarch64-linux-android | |
runner: ubuntu-latest | |
- target: aarch64-apple-darwin | |
runner: macos-latest | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
targets: ${{ matrix.target }} | |
components: clippy | |
- name: Cache cargo resources | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: deps | |
cache-on-failure: true | |
- run: cargo clippy --target=${{ matrix.target }} | |
audit: | |
name: Audit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache cargo resources | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: deps | |
cache-on-failure: true | |
- run: cargo audit | |
check: | |
name: Check | |
strategy: | |
matrix: | |
include: | |
- target: aarch64-linux-android | |
runner: macos-latest | |
- target: aarch64-apple-darwin | |
runner: macos-latest | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
targets: ${{ matrix.target }} | |
- name: Cache cargo resources | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: deps | |
cache-on-failure: true | |
- run: cargo check --target=${{ matrix.target }} | |
test-android: | |
name: Test Android | |
# macos is used here as it allows for | |
# hardware acceleration on the Android emulator | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
targets: x86_64-linux-android | |
- name: Install Cargo APK | |
run: cargo install cargo-apk | |
- name: Cargo apk build | |
run: cargo apk build --target x86_64-linux-android --manifest-path ./examples/android/Cargo.toml | |
- name: Cache cargo resources | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: deps | |
cache-on-failure: true | |
- name: Run Android Emulator and test | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 31 | |
arch: x86_64 | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
force-avd-creation: false | |
script: ./.github/workflows/android_test.sh ./examples/android/target/debug/apk/android.apk | |
- name: Upload emulator logs | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() }} | |
with: | |
name: log | |
path: ~/logcat.log |