Skip to content

Commit

Permalink
Removes cargo-apk, ndk-build + ndk-examples as part of rust-mobile#372
Browse files Browse the repository at this point in the history
…modularization

The cargo-apk, ndk-build + ndk-examples subdirectores have been split into a
stand-alone repository at: https://github.com/rust-mobile/cargo-apk

This is being done as part of the modularization effort described in
issue rust-mobile#372

The stand-alone repository was filtered like this:

```
git clone https://github.com/newren/git-filter-repo
git clone https://github.com/rust-windowing/android-ndk-rs.git ndk-glue
cd ndk-glue
py ../git-filter-repo/git-filter-repo \
    --path cargo-apk --path ndk-build \
    --path ndk-examples --path-rename ndk-examples:examples \
    --path LICENSE-APACHE --path LICENSE-MIT \
    --path Cargo.toml --path rustfmt.toml \
    --path .github --path .gitignore
```

The last commit in this repo that is included within the
stand-alone repository is 9b4dbfa

The CI for this repo is considerably simpler now that the examples
have been moved to the `cargo-apk` repository since it now just checks
that the `ndk` and `ndk-sys` crates successfully cross compile without
running a hello_world example under an emulator.

Runtime tests could be re-added in the future, but especially while
there is no significant test coverage from the examples it's more
valuable to keep those for testing `cargo-apk` packaging and simplify
testing in this repo.
  • Loading branch information
rib committed Dec 9, 2022
1 parent 2c8db67 commit 4918b6a
Show file tree
Hide file tree
Showing 28 changed files with 19 additions and 3,447 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/android_test.sh

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
crate:
- { name: "ndk-sys", target: "armv7-linux-androideabi" }
- { name: "ndk", target: "armv7-linux-androideabi" }
- { name: "ndk-build", target: "x86_64-unknown-linux-gnu" }
- { name: "cargo-apk", target: "x86_64-unknown-linux-gnu" }
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand Down
133 changes: 19 additions & 114 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
# Use one of our supported targets to lint all crates including
# the target-specific `ndk` in one go.
# This assumes our host-tools (cargo-apk and dependencies)
# also compile cleanly under this target.
# Use a cross-compilation target (that's typical for Android) to lint everything
args: --all --all-targets --all-features --target aarch64-linux-android -- -Dwarnings

check_msrv:
Expand All @@ -47,7 +44,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: check
# See comment above about using one of our supported targets.
# Use a cross-compilation target (that's typical for Android) to lint everything
args: --workspace --all-targets --all-features --target aarch64-linux-android

build:
Expand All @@ -57,123 +54,39 @@ jobs:
os: [ubuntu-latest]
rust-channel: ['stable', 'nightly']
rust-target:
- 'armv7-linux-androideabi'
- 'aarch64-linux-android'
- 'i686-linux-android'
- 'x86_64-linux-android'
- { triple: 'armv7-linux-androideabi', abi: armeabi-v7a }
- { triple: 'aarch64-linux-android', abi: atm64-v8a }
- { triple: 'i686-linux-android', abi: x86 }
- { triple: 'x86_64-linux-android', abi: x86_64 }
include:
- os: windows-latest
rust-channel: 'stable'
rust-target: 'aarch64-linux-android'
rust-target: { triple: 'aarch64-linux-android', abi: atm64-v8a }
- os: windows-latest
rust-channel: 'stable'
rust-target: 'x86_64-linux-android'
rust-target: { triple: 'x86_64-linux-android', abi: x86_64 }

runs-on: ${{ matrix.os }}
name: Build apk
name: Cross-compile

steps:
- uses: actions/checkout@v2

- name: Installing Rust ${{ matrix.rust-channel }} w/ ${{ matrix.rust-target }}
- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Install cargo-ndk
run: cargo install cargo-ndk

- name: Installing Rust ${{ matrix.rust-channel }} w/ ${{ matrix.rust-target.triple }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust-channel }}
target: ${{ matrix.rust-target }}
target: ${{ matrix.rust-target.triple }}
override: true

- name: Install cargo-apk
run:
cargo install --path cargo-apk

- name: Cargo check for target ${{ matrix.rust-target }}
run: cargo check -p ndk --target ${{ matrix.rust-target }} --all-features

- name: Cargo apk build for target ${{ matrix.rust-target }}
run: cargo apk build -p ndk-examples --target ${{ matrix.rust-target }} --examples

- uses: actions/upload-artifact@v2
# Only need this for CI, unless users are interested in downloading
# a ready-made app that does nothing but printing "hello world".
if: ${{ matrix.rust-target == 'x86_64-linux-android' }}
name: Upload hello_world apk
with:
name: hello_world_${{ matrix.os }}_${{ matrix.rust-target }}
path: ./target/debug/apk/examples/hello_world.apk

android_emulator:
name: hello_world example on emulator
needs: build
runs-on: macos-latest
strategy:
matrix:
source_os: [ubuntu-latest, windows-latest, local]
env:
api-level: 29
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
arch: x86_64
# the `googleapis` emulator target is considerably slower on CI.
target: default
profile: Nexus 6

steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/download-artifact@v2
name: Download hello_world APK
if: ${{ matrix.source_os != 'local' }}
id: download
with:
name: hello_world_${{ matrix.source_os }}_x86_64-linux-android

- name: Install `cargo-apk` and add `x86_64-linux-android` target
if: ${{ matrix.source_os == 'local' }}
run: |
cargo install --path cargo-apk
rustup target add x86_64-linux-android
- name: AVD cache
uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
# Bump the trailing number when making changes to the emulator setup below
key: avd-${{ env.api-level }}-1

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.api-level }}
arch: ${{ env.arch }}
target: ${{ env.target }}
profile: ${{ env.profile }}
emulator-options: ${{ env.emulator-options }}
disable-animations: true
force-avd-creation: false
script: echo "Generated AVD snapshot for caching."

- name: Start hello_world example
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.api-level }}
arch: ${{ env.arch }}
target: ${{ env.target }}
profile: ${{ env.profile }}
emulator-options: -no-snapshot-save ${{ env.emulator-options }}
disable-animations: true
force-avd-creation: false
script: ./.github/workflows/android_test.sh "${{ steps.download.outputs.download-path }}"

- name: Upload emulator logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: log
path: ~/logcat.log
- name: Compile for ${{ matrix.rust-target.triple }}
run: cargo ndk -t ${{ matrix.rust-target.abi }} build

build-host:
strategy:
Expand Down Expand Up @@ -202,14 +115,6 @@ jobs:
run:
cargo test -p ndk --all-features

- name: Test ndk-build
run:
cargo test -p ndk-build --all-features

- name: Test cargo-apk
run:
cargo test -p cargo-apk --all-features

docs:
strategy:
fail-fast: false
Expand Down
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
[workspace]
members = [
"ndk",
"ndk-build",
"ndk-examples",
"ndk-sys",
"cargo-apk",
]
105 changes: 0 additions & 105 deletions cargo-apk/CHANGELOG.md

This file was deleted.

24 changes: 0 additions & 24 deletions cargo-apk/Cargo.toml

This file was deleted.

Loading

0 comments on commit 4918b6a

Please sign in to comment.