fix: add sqlx query cache for preferences table #65
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: Android | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| android-build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required to create releases | |
| container: | |
| image: ghcr.io/${{ github.repository }}/devcontainer:latest | |
| options: --privileged --user root | |
| env: | |
| # Reduce memory usage during linking to avoid OOM/bus errors on CI | |
| CARGO_BUILD_JOBS: 2 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: pnpm install --frozen-lockfile | |
| - name: Build frontend | |
| run: pnpm build | |
| - name: Setup Android signing keystore | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
| run: | | |
| if [ -n "$KEYSTORE_BASE64" ]; then | |
| echo "$KEYSTORE_BASE64" | base64 -d > /tmp/potasko-release.jks | |
| echo "Keystore decoded successfully" | |
| else | |
| echo "Warning: ANDROID_KEYSTORE_BASE64 secret not set, building unsigned" | |
| fi | |
| - name: Build Android APK (release) | |
| # Build only for arm64 to save disk space in CI | |
| env: | |
| KEYSTORE_PATH: /tmp/potasko-release.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| run: | | |
| if [ -f "/tmp/potasko-release.jks" ]; then | |
| echo "Building signed release APK" | |
| cargo tauri android build --target aarch64 | |
| else | |
| echo "Building debug APK (no keystore available)" | |
| cargo tauri android build --debug --target aarch64 | |
| fi | |
| - name: Verify 16KB page alignment | |
| run: | | |
| # Check for release APK first, fall back to debug | |
| APK=$(find src-tauri/gen/android -name "*.apk" -path "*/release/*" | head -1) | |
| if [ -z "$APK" ]; then | |
| APK=$(find src-tauri/gen/android -name "*.apk" -path "*/debug/*" | head -1) | |
| fi | |
| echo "Found APK: $APK" | |
| $ANDROID_HOME/build-tools/35.0.0/zipalign -c -P 16 -v 4 "$APK" \ | |
| | grep -E "(FAILED|Verification)" | |
| - name: Upload release APK | |
| if: hashFiles('src-tauri/gen/android/app/build/outputs/apk/**/release/*.apk') != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: potasko-release-apk | |
| path: src-tauri/gen/android/app/build/outputs/apk/**/release/*.apk | |
| - name: Upload release AAB | |
| if: hashFiles('src-tauri/gen/android/app/build/outputs/bundle/**Release/*.aab') != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: potasko-release-aab | |
| path: src-tauri/gen/android/app/build/outputs/bundle/**Release/*.aab | |
| - name: Upload debug APK (fallback) | |
| if: hashFiles('src-tauri/gen/android/app/build/outputs/apk/**/debug/*.apk') != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: potasko-debug-apk | |
| path: src-tauri/gen/android/app/build/outputs/apk/**/debug/*.apk | |
| - name: Rename APK for release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| APK=$(find src-tauri/gen/android -name "*.apk" -path "*/release/*" | head -1) | |
| if [ -z "$APK" ]; then | |
| APK=$(find src-tauri/gen/android -name "*.apk" -path "*/debug/*" | head -1) | |
| fi | |
| cp "$APK" "potasko-${VERSION}.apk" | |
| echo "Renamed APK to potasko-${VERSION}.apk" | |
| - name: Upload to release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: potasko-*.apk |