Open-source Android PDF and document toolkit with PDF tools, Office viewing, XLSX editing, scanning, and image editing. Built with Kotlin and Jetpack Compose.
Rust androiddocument-scannerdocximage-editorjetpack-composekotlinliquid-glassofflineopen-sourcepdfpdf-compressorpdf-editorpdf-mergerpdf-readerpdf-splitterpdf-toolspdf-viewerpptxspreadsheet-editorxlsx
CI: build pull requests, release every ABI, ask the maintainer for review
chethan616d683748f520b
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERSnew file mode 100644index 0000000..2feb5a0--- /dev/null+++ b/.github/CODEOWNERS@@ -0,0 +1,3 @@+# Every pull request asks the maintainer for a review. With "Require review from Code Owners" on+# the main branch (Settings ▸ Branches), nothing merges without that approval.+* @Chethan616diff --git a/.github/pull_request_template.md b/.github/pull_request_template.mdnew file mode 100644index 0000000..f94c07a--- /dev/null+++ b/.github/pull_request_template.md@@ -0,0 +1,16 @@+## What this changes++<!-- What the change does and why. Link the issue it closes: "Closes #123". -->++## How it was checked++<!-- The device and Android version you tried it on, or the tests you ran. -->++## Checklist++- [ ] The change does one thing (unrelated fixes go in their own pull request)+- [ ] `cargo test -p artefact-mobile` passes if the engine was touched+- [ ] The app builds (`./gradlew assembleDebug -Partefact.abis=arm64-v8a`) and was tried on a device or emulator+- [ ] New text is in `res/values/strings.xml`, not hard-coded+- [ ] Screenshots or a short recording are attached for anything visible+- [ ] I agree to license this contribution under the project's licences (MIT / Apache-2.0)diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlnew file mode 100644index 0000000..ed5ac30--- /dev/null+++ b/.github/workflows/ci.yml@@ -0,0 +1,89 @@+# Checks for every pull request and every push to main: the engine's bridge is linted and tested,+# and the app is built (a debug APK, kept as the run's artifact) and its unit tests run. A pull+# request from a fork runs with no secrets: nothing here needs any.+name: CI++on:+ pull_request:+ push:+ branches: [main]+ workflow_dispatch:++permissions:+ contents: read++concurrency:+ group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ # a newer push to the same pull request replaces the run in progress+ cancel-in-progress: true++env:+ CARGO_TERM_COLOR: always+ CARGO_INCREMENTAL: 0++jobs:+ engine:+ name: Engine (Rust)+ runs-on: ubuntu-24.04+ steps:+ - uses: actions/checkout@v7++ # the Rust release rust-toolchain.toml names+ - name: Install Rust+ working-directory: engine+ run: rustup toolchain install && rustup component add rustfmt clippy++ - uses: Swatinem/rust-cache@v2+ with:+ key: ci-engine+ workspaces: engine -> target++ - name: Format+ working-directory: engine+ run: cargo fmt -p artefact-mobile -- --check++ - name: Lint+ working-directory: engine+ run: cargo clippy -p artefact-mobile --all-targets --locked -- -D warnings++ - name: Test+ working-directory: engine+ run: cargo test -p artefact-mobile --locked++ app:+ name: App (Android)+ # Ubuntu's hosted image includes the Gradle version the release workflow pins+ runs-on: ubuntu-24.04+ steps:+ - uses: actions/checkout@v7++ - uses: actions/setup-java@v6+ with:+ distribution: temurin+ java-version: '21'++ - name: Install Rust+ working-directory: engine+ run: rustup toolchain install++ - uses: Swatinem/rust-cache@v2+ with:+ key: ci-android+ workspaces: engine -> target++ - name: Install cargo-ndk and the Android NDK+ run: |+ cargo install cargo-ndk --version 4.1.2 --locked+ yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;29.0.14206865" >/dev/null++ # one ABI is enough to prove the app builds (x86_64: the emulator's)+ - name: Build and unit-test+ working-directory: android+ run: gradle assembleDebug testDebugUnitTest -Partefact.abis=x86_64 --no-daemon --no-configuration-cache++ - uses: actions/upload-artifact@v7+ with:+ name: debug-apk+ path: android/app/build/outputs/apk/debug/*.apk+ if-no-files-found: error+ retention-days: 7diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 567d789..e6ad608 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -1,6 +1,7 @@# Release pipeline: pushing a version tag (v0.0.1-beta, v0.2.0, v1.0.0-rc.1, …) builds the APKs-# (one for 64-bit ARM phones, one for 32-bit ARM ones) signed with the release key and makes them a-# draft GitHub release named after the tag, with an empty "What's Changed" section. Fill that in on+# (one per ABI: arm64-v8a, armeabi-v7a, x86, x86_64, and a universal one holding all four) signed+# with the release key and makes them a draft GitHub release named after the tag, with an empty+# "What's Changed" section. GitHub adds the source archives and each file's SHA-256. Fill that in on# GitHub and publish the draft: it becomes the latest release (betas too: while the app is in beta,# every release is one).#@@ -93,9 +94,10 @@ jobs:echo "::warning::No release key: this dry run is signed with the debug key"fi- # one APK per ABI (each about half the size of one holding both): 64-bit ARM for most- # phones (Artefact-v<version>.apk), 32-bit ARM for older and low-end ones- # (Artefact-v<version>-armeabi-v7a.apk)+ # one APK per ABI, Artefact-v<version>-<abi>.apk (arm64-v8a for most phones, armeabi-v7a for+ # older and low-end ones, x86 and x86_64 for emulators and Chromebooks), then+ # Artefact-v<version>-universal.apk holding all four. Cargo keeps each ABI's library, so the+ # universal build compiles nothing again.- name: Buildworking-directory: androidenv:@@ -105,11 +107,12 @@ jobs:CLEARPDF_UPLOAD_KEY_PASSWORD: ${{ secrets.CLEARPDF_UPLOAD_KEY_PASSWORD }}run: |mkdir -p "$GITHUB_WORKSPACE/dist"- for abi in arm64-v8a armeabi-v7a; do- gradle assembleRelease "-Partefact.abis=$abi" "-Partefact.version=$VERSION" --no-daemon --no-configuration-cache- suffix=""; [ "$abi" = arm64-v8a ] || suffix="-$abi"- cp app/build/outputs/apk/release/app-release.apk "$GITHUB_WORKSPACE/dist/Artefact-v$VERSION$suffix.apk"+ for abi in arm64-v8a armeabi-v7a x86 x86_64 universal; do+ abis="$abi"; [ "$abi" = universal ] && abis="arm64-v8a,armeabi-v7a,x86,x86_64"+ gradle assembleRelease "-Partefact.abis=$abis" "-Partefact.version=$VERSION" --no-daemon --no-configuration-cache+ cp app/build/outputs/apk/release/app-release.apk "$GITHUB_WORKSPACE/dist/Artefact-v$VERSION-$abi.apk"done+ (cd "$GITHUB_WORKSPACE/dist" && sha256sum ./*.apk)- name: APKrun: |diff --git a/README.md b/README.mdindex 80e4b60..1647733 100644--- a/README.md+++ b/README.md@@ -122,7 +122,8 @@ Open the release page and download the APK that matches your device:|---|---|| `-arm64-v8a.apk` | Most current 64-bit ARM phones and tablets || `-armeabi-v7a.apk` | 32-bit ARM devices |-| `-x86_64.apk` | x86-based emulators and devices |+| `-x86_64.apk` | 64-bit x86 emulators and devices |+| `-x86.apk` | 32-bit x86 emulators and devices || `-universal.apk` | A larger package containing all supported ABIs |The APK installs over ClearPDF and keeps your data.diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.ktsindex 9857fcb..6697886 100644--- a/android/app/build.gradle.kts+++ b/android/app/build.gradle.kts@@ -19,7 +19,7 @@ val minApi = 29// workflow builds a release. The version code follows from it (0.0.1-beta → 101, 0.0.1-beta.2 →// 102, 0.0.1 → 199, 0.1.0-beta → 10001), so a pre-release comes before its release and every// release before the next version's pre-releases; times ten plus the ABI of a one-ABI build-// (armeabi-v7a 1, arm64-v8a 2, x86_64 3; 0 for several), so each APK of a release has its own code+// (armeabi-v7a 1, arm64-v8a 2, x86_64 3, x86 4; 0 for several, the universal APK), so each APK of a release has its own code// (F-Droid needs that). ClearPDF 2.x shipped codes up to 95, so 3.x codes always sort above them.val appVersion: String = providers.gradleProperty("artefact.version").get()val appVersionCode: Int = run {@@ -41,6 +41,7 @@ val appVersionCode: Int = run {"armeabi-v7a" -> 1"arm64-v8a" -> 2"x86_64" -> 3+ "x86" -> 4else -> 0}base * 10 + abidiff --git a/engine/rust-toolchain.toml b/engine/rust-toolchain.tomlindex 1108532..5f67ee0 100644--- a/engine/rust-toolchain.toml+++ b/engine/rust-toolchain.toml@@ -1,4 +1,4 @@# The Rust release every build uses (CI and a contributor's machine), with the Android targets.[toolchain]channel = "1.99.0"-targets = ["aarch64-linux-android", "armv7-linux-androideabi", "x86_64-linux-android"]+targets = ["aarch64-linux-android", "armv7-linux-androideabi", "x86_64-linux-android", "i686-linux-android"]