Merge SadGare's fork: FindMy 0.9.x, map providers, and working key alignment #11
This file contains hidden or 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: Generate APK (Debug) | |
| env: | |
| # The name of the main module repository | |
| main_project_module: app | |
| # The name of the App | |
| app_name: OpenTagViewer | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| # only run when Android-related stuff actually changed! | |
| - "app/**" | |
| - "gradle/**" | |
| - "build.gradle.kts" | |
| - "gradle.properties" | |
| - "gradlew" | |
| - "gradle.bat" | |
| - "local.defaults.properties" | |
| - "settings.gradle.kts" | |
| # The build shells out to these: the unicorn stub wheel is generated by | |
| # build_unicorn_stub_wheel.py, so a change here can break the build without | |
| # touching anything else in this list. | |
| - "scripts/**" | |
| pull_request: | |
| branches: [ "main" ] | |
| paths: | |
| - "app/**" | |
| - "gradle/**" | |
| - "build.gradle.kts" | |
| - "gradle.properties" | |
| - "gradlew" | |
| - "gradle.bat" | |
| - "local.defaults.properties" | |
| - "settings.gradle.kts" | |
| # The build shells out to these: the unicorn stub wheel is generated by | |
| # build_unicorn_stub_wheel.py, so a change here can break the build without | |
| # touching anything else in this list. | |
| - "scripts/**" | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| # Cheap and dependency-free, so it runs on its own and reports in seconds rather than | |
| # after an emulator boot. A string missing from a locale fails nothing on its own - the | |
| # build succeeds and the app looks correct to anyone reading the language it was written | |
| # in - so without this it is only ever found by a user seeing English. | |
| static-checks: | |
| name: Static checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Check every locale has every string | |
| run: python scripts/add_strings.py --check | |
| # add_strings.py gates the check above, so a bug in it would report green while | |
| # protecting nothing. | |
| - name: Test the string tooling | |
| run: | | |
| python -m pip install pytest | |
| python -m pytest scripts/test -v | |
| # pyright rather than mypy: the editors used on this project run Pylance, which is | |
| # pyright, and mypy's defaults are lenient enough to pass code Pylance flags. | |
| # | |
| # Scoped to the two clean trees. python/ (the macOS wizard) has pre-existing errors and | |
| # needs its own cleanup before it can be added. | |
| # | |
| # main.py imports findmy and NSKeyedUnArchiver, so those have to be installed first or | |
| # every one of them is reported as an unresolved import and the check means nothing. | |
| # | |
| # Run through pip rather than an action so this is the identical command CONTRIBUTING.md | |
| # tells contributors to run locally. | |
| - name: Type-check Python with pyright | |
| run: | | |
| python -m pip install pyright==1.1.411 | |
| python -m pip install -r app/src/test/python/requirements.txt | |
| python -m pyright app/src/main/python scripts | |
| # The Room v1 -> v2 migration can only be exercised on a real Android runtime, so it | |
| # lives in src/androidTest and needs an emulator. `./gradlew test` in the build job | |
| # below runs JVM unit tests only and would silently skip it - which matters because a | |
| # broken migration destroys every existing user's imported beacons and location | |
| # history, and only reproduces on upgrade, never on a fresh install. | |
| instrumented-tests: | |
| name: Instrumented tests (emulator) | |
| environment: 'Android Build' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set Up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Change wrapper permissions | |
| run: chmod +x ./gradlew | |
| - name: Create local.properties | |
| run: | | |
| echo "sdk.dir=$ANDROID_HOME" > local.properties | |
| - name: Inject secrets.properties | |
| run: | | |
| echo "MAPS_API_KEY=${{ secrets.MAPS_API_KEY || 'maps_key_default_value' }}" > secrets.properties | |
| # KVM is required for a hardware-accelerated emulator; without it the run times out. | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ | |
| | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Run instrumented tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 35 | |
| target: google_apis | |
| arch: x86_64 | |
| profile: pixel_6 | |
| ram-size: 4096M | |
| disable-animations: true | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| script: ./gradlew connectedDebugAndroidTest --console=plain | |
| - name: Upload test reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: instrumented-test-reports | |
| path: app/build/reports/androidTests/ | |
| if-no-files-found: ignore | |
| build: | |
| environment: 'Android Build' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set current date as env variable | |
| run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| # Set Repository Name As Env Variable | |
| - name: Set repository name as env variable | |
| run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV | |
| - name: Set Up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' # See 'Supported distributions' for available options | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Change wrapper permissions | |
| run: chmod +x ./gradlew | |
| - name: Create local.properties | |
| run: | | |
| echo "sdk.dir=$ANDROID_HOME" > local.properties | |
| - name: Inject secrets.properties | |
| run: | | |
| echo "MAPS_API_KEY=${{ secrets.MAPS_API_KEY || 'maps_key_default_value' }}" > secrets.properties | |
| # No stub wheel to validate any more: it is generated from app/stubs/unicorn/ by | |
| # generateUnicornStubWheel during the build, rather than being checked in. | |
| # Run Tests Build | |
| - name: Run gradle tests | |
| run: ./gradlew test | |
| # Covers app/src/main/python (the module Chaquopy packages into the APK). | |
| # Runs on plain CPython - it imports no Android or Java types. | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Chaquopy bridge test dependencies | |
| run: python -m pip install -r app/src/test/python/requirements.txt | |
| - name: Run Chaquopy bridge tests | |
| run: python -m pytest app/src/test/python -v | |
| # Create APK Debug | |
| - name: Build Debug APK - ${{ env.main_project_module }} module | |
| run: ./gradlew testDebugUnitTest assembleDebug | |
| # Upload Artifact Build | |
| # Noted For Output [main_project_module]/build/outputs/apk/debug/ | |
| - name: Upload APK Debug | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.date_today }} - ${{ env.app_name }} - ${{ env.repository_name }} - APK(s) debug generated | |
| path: ${{ env.main_project_module }}/build/outputs/apk/debug/ |