|
| 1 | +name: Debug Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.sha }}-${{ github.workflow }}-debug |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +env: |
| 11 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 12 | + GH_REPO: ${{ github.repository }} |
| 13 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 14 | + CARGO_TERM_COLOR: always |
| 15 | + |
| 16 | +jobs: |
| 17 | + debug: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + contents: write |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v6 |
| 23 | + with: |
| 24 | + lfs: true |
| 25 | + |
| 26 | + - name: Set up JDK 21 |
| 27 | + uses: actions/setup-java@v5 |
| 28 | + with: |
| 29 | + java-version: "21" |
| 30 | + distribution: "temurin" |
| 31 | + cache: gradle |
| 32 | + |
| 33 | + - name: Read versions from files |
| 34 | + id: versions |
| 35 | + run: | |
| 36 | + echo "rust=$(cat app/src/main/rust/RUST_VERSION)" >> $GITHUB_OUTPUT |
| 37 | + echo "ndk=$(cat app/src/main/rust/NDK_VERSION)" >> $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + - uses: dtolnay/rust-toolchain@master |
| 40 | + with: |
| 41 | + toolchain: ${{ steps.versions.outputs.rust }} |
| 42 | + targets: aarch64-linux-android, x86_64-linux-android |
| 43 | + |
| 44 | + - uses: Swatinem/rust-cache@v2 |
| 45 | + with: |
| 46 | + workspaces: "./app/src/main/rust/" |
| 47 | + |
| 48 | + - name: Compile Rust lib |
| 49 | + run: | |
| 50 | + wget -q "https://dl.google.com/android/repository/android-ndk-${{ steps.versions.outputs.ndk }}-linux.zip" |
| 51 | + unzip -q "./android-ndk-${{ steps.versions.outputs.ndk }}-linux.zip" |
| 52 | + make SOURCE_DATE_EPOCH=0 NDK_PATH="$(pwd)/android-ndk-${{ steps.versions.outputs.ndk }}/toolchains/llvm/prebuilt/linux-x86_64/bin" -C app/src/main/rust build_install |
| 53 | +
|
| 54 | + - name: Build App |
| 55 | + run: | |
| 56 | + ./gradlew assembleDebug |
| 57 | +
|
| 58 | + mkdir -p packages |
| 59 | + # warning: do not use github.event syntax here |
| 60 | + # https://stackoverflow.com/questions/71458189/github-action-workflow-call-does-not-use-up-to-date-input-values |
| 61 | + mv app/build/outputs/apk/debug/app-debug.apk packages/gitnote-debug.apk |
| 62 | +
|
| 63 | + - uses: actions/upload-artifact@v6 |
| 64 | + with: |
| 65 | + name: gitnote-debug |
| 66 | + path: packages/* |
| 67 | + if-no-files-found: error |
0 commit comments