Colota - Android GPS Location tracker
Restructure CI workflows: split builds into parallel jobs, remove redundancy
Max Dietrich09432edc7bd7
diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.ymlindex 8525a4f6..f20aaa31 100644--- a/.github/workflows/build-check.yml+++ b/.github/workflows/build-check.yml@@ -4,10 +4,8 @@ on:pull_request:branches: [main, develop]paths:- - 'apps/mobile/android/**'+ - 'apps/mobile/**'- '!fastlane/**'- - 'apps/mobile/src/**'- - '!apps/mobile/src/**/__tests__/**'- 'packages/shared/**'- 'package-lock.json'@@ -19,8 +17,8 @@ permissions:contents: readjobs:- build:- name: Build Debug APKs+ test:+ name: Lint & Testruns-on: ubuntu-lateststeps:@@ -46,18 +44,85 @@ jobs:- name: Build shared packagerun: npm run build -w @colota/shared+ - name: Run ESLint+ run: npm run lint -w @colota/mobile++ - name: Run TypeScript check+ run: npx -w @colota/mobile tsc --noEmit++ - name: Run tests+ run: npm test -w @colota/mobile+- name: Run Kotlin unit testsrun: |cd apps/mobile/androidchmod +x gradlew./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon+ build-gms:+ name: Build GMS Debug APK+ needs: test+ runs-on: ubuntu-latest++ steps:+ - name: Checkout code+ uses: actions/checkout@v4++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: '20'+ cache: 'npm'++ - name: Setup Java+ uses: actions/setup-java@v4+ with:+ distribution: 'temurin'+ java-version: '17'+ cache: 'gradle'++ - name: Install dependencies+ run: npm ci++ - name: Build shared package+ run: npm run build -w @colota/shared+- name: Build GMS Debug APKrun: |cd apps/mobile/android+ chmod +x gradlew./gradlew assembleGmsDebug --no-daemon+ build-foss:+ name: Build FOSS Debug APK+ needs: test+ runs-on: ubuntu-latest++ steps:+ - name: Checkout code+ uses: actions/checkout@v4++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: '20'+ cache: 'npm'++ - name: Setup Java+ uses: actions/setup-java@v4+ with:+ distribution: 'temurin'+ java-version: '17'+ cache: 'gradle'++ - name: Install dependencies+ run: npm ci++ - name: Build shared package+ run: npm run build -w @colota/shared+- name: Build FOSS Debug APKrun: |cd apps/mobile/android- ./gradlew clean assembleFossDebug --no-daemon+ chmod +x gradlew+ ./gradlew assembleFossDebug --no-daemondiff --git a/.github/workflows/build-latest-release.yml b/.github/workflows/build-latest-release.ymlindex 731b1fc7..769f763c 100644--- a/.github/workflows/build-latest-release.yml+++ b/.github/workflows/build-latest-release.yml@@ -12,7 +12,6 @@ on:- '.github/workflows/docs-*'- '.github/workflows/build-release.yml'- '**/__tests__/**'- - '.github/workflows/lint-test.yml'- '.github/workflows/pr-labeler.yml'- '.github/workflows/dependency-updates.yml'- 'fastlane/**'@@ -35,18 +34,26 @@ jobs:with:node-version: '20'cache: 'npm'+ - uses: actions/setup-java@v4+ with:+ distribution: 'temurin'+ java-version: '17'+ cache: 'gradle'- run: npm ci- run: npm run build -w @colota/shared- run: npm run lint -w @colota/mobile- run: npx -w @colota/mobile tsc --noEmit- run: npm test -w @colota/mobile+ - name: Run Kotlin unit tests+ run: |+ cd apps/mobile/android+ chmod +x gradlew+ ./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon- build-and-release:- name: Build & Update Latest+ build-gms:+ name: Build GMS Release APKneeds: testruns-on: ubuntu-latest- permissions:- contents: writesteps:- name: Checkout code@@ -97,21 +104,106 @@ jobs:test -n "${{ secrets.KEY_ALIAS }}" || exit 1test -n "${{ secrets.KEY_PASSWORD }}" || exit 1- - name: Run Kotlin unit tests+ - name: Build GMS Release APKsrun: |cd apps/mobile/androidchmod +x gradlew- ./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon+ ./gradlew assembleGmsRelease --no-daemon- - name: Build GMS Release APKs+ - name: Upload GMS APKs+ uses: actions/upload-artifact@v4+ with:+ name: gms-release-apks+ path: apps/mobile/android/app/build/outputs/apk/gms/release/*.apk++ - name: Secure Cleanup+ if: always()run: |- cd apps/mobile/android- ./gradlew assembleGmsRelease --no-daemon+ rm -f apps/mobile/android/app/release.keystore+ rm -f apps/mobile/android/gradle.properties++ build-foss:+ name: Build FOSS Release APK+ needs: test+ runs-on: ubuntu-latest++ steps:+ - name: Checkout code+ uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Setup Node & Java+ uses: actions/setup-node@v4+ with:+ node-version: '20'+ cache: 'npm'+ - uses: actions/setup-java@v4+ with:+ distribution: 'temurin'+ java-version: '17'+ cache: 'gradle'++ - name: Install dependencies+ run: npm ci++ - name: Build shared package+ run: npm run build -w @colota/shared++ - name: Pin dev server IP for reproducible builds+ run: |+ sed -i 's/getHostIpAddress(),/project.properties["reactNativeDevServerIp"]?.toString() ?: "localhost",/' \+ node_modules/@react-native/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt++ - name: Append signing config to gradle.properties+ run: |+ cat <<EOF >> apps/mobile/android/gradle.properties+ MYAPP_UPLOAD_STORE_FILE=release.keystore+ MYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}+ MYAPP_UPLOAD_KEY_ALIAS=${{ secrets.KEY_ALIAS }}+ MYAPP_UPLOAD_KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}+ EOF++ - name: Decode keystore+ env:+ KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}+ run: echo $KEYSTORE_BASE64 | base64 -d > apps/mobile/android/app/release.keystore++ - name: Validate signing inputs+ run: |+ test -f apps/mobile/android/app/release.keystore || (echo "Keystore missing" && exit 1)+ test -n "${{ secrets.KEYSTORE_PASSWORD }}" || exit 1+ test -n "${{ secrets.KEY_ALIAS }}" || exit 1+ test -n "${{ secrets.KEY_PASSWORD }}" || exit 1- name: Build FOSS Release APKsrun: |cd apps/mobile/android- ./gradlew clean assembleFossRelease --no-daemon+ chmod +x gradlew+ ./gradlew assembleFossRelease --no-daemon++ - name: Upload FOSS APKs+ uses: actions/upload-artifact@v4+ with:+ name: foss-release-apks+ path: apps/mobile/android/app/build/outputs/apk/foss/release/*.apk++ - name: Secure Cleanup+ if: always()+ run: |+ rm -f apps/mobile/android/app/release.keystore+ rm -f apps/mobile/android/gradle.properties++ release:+ name: Publish Latest Release+ needs: [build-gms, build-foss]+ runs-on: ubuntu-latest+ permissions:+ contents: write++ steps:+ - name: Checkout code+ uses: actions/checkout@v4- name: Update Latest Tagrun: |@@ -120,6 +212,18 @@ jobs:git tag -f latestgit push -f origin latest+ - name: Download GMS APKs+ uses: actions/download-artifact@v4+ with:+ name: gms-release-apks+ path: apks/gms++ - name: Download FOSS APKs+ uses: actions/download-artifact@v4+ with:+ name: foss-release-apks+ path: apks/foss+- name: Publish to GitHub Releaseuses: softprops/action-gh-release@v2with:@@ -130,25 +234,16 @@ jobs:Built from commit: `${{ github.sha }}`### GMS (Google Play Services)- **app-gms-arm64-v8a-release.apk** — Modern 64-bit devices (recommended)- **app-gms-armeabi-v7a-release.apk** — Older 32-bit devices+ **app-gms-arm64-v8a-release.apk** - Modern 64-bit devices (recommended)+ **app-gms-armeabi-v7a-release.apk** - Older 32-bit devices### FOSS (F-Droid / no Google Play Services)- **app-foss-arm64-v8a-release.apk** — Modern 64-bit devices (recommended)- **app-foss-armeabi-v7a-release.apk** — Older 32-bit devices+ **app-foss-arm64-v8a-release.apk** - Modern 64-bit devices (recommended)+ **app-foss-armeabi-v7a-release.apk** - Older 32-bit devicesdraft: falseprerelease: truefiles: |- apps/mobile/android/app/build/outputs/apk/gms/release/app-gms-arm64-v8a-release.apk- apps/mobile/android/app/build/outputs/apk/gms/release/app-gms-armeabi-v7a-release.apk- apps/mobile/android/app/build/outputs/apk/foss/release/app-foss-arm64-v8a-release.apk- apps/mobile/android/app/build/outputs/apk/foss/release/app-foss-armeabi-v7a-release.apk+ apks/gms/*.apk+ apks/foss/*.apkenv:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}-- - name: Secure Cleanup- if: always()- run: |- echo "Cleaning up sensitive files..."- rm -f apps/mobile/android/app/release.keystore- rm -f apps/mobile/android/gradle.propertiesdiff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.ymlindex 4708d6f0..8cd69772 100644--- a/.github/workflows/build-release.yml+++ b/.github/workflows/build-release.yml@@ -27,18 +27,26 @@ jobs:with:node-version: '20'cache: 'npm'+ - uses: actions/setup-java@v4+ with:+ distribution: 'temurin'+ java-version: '17'+ cache: 'gradle'- run: npm ci- run: npm run build -w @colota/shared- run: npm run lint -w @colota/mobile- run: npx -w @colota/mobile tsc --noEmit- run: npm test -w @colota/mobile+ - name: Run Kotlin unit tests+ run: |+ cd apps/mobile/android+ chmod +x gradlew+ ./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon- build:- name: Build Release APKs+ build-gms:+ name: Build GMS Release APKneeds: testruns-on: ubuntu-latest- permissions:- contents: writesteps:- name: Checkout code@@ -89,29 +97,115 @@ jobs:test -n "${{ secrets.KEY_ALIAS }}" || exit 1test -n "${{ secrets.KEY_PASSWORD }}" || exit 1- - name: Run Kotlin unit tests+ - name: Build GMS Release APKsrun: |cd apps/mobile/androidchmod +x gradlew- ./gradlew testGmsDebugUnitTest testFossDebugUnitTest --no-daemon+ ./gradlew assembleGmsRelease --no-daemon- - name: Build GMS Release APKs+ - name: Upload GMS APKs+ uses: actions/upload-artifact@v4+ with:+ name: gms-release-apks+ path: apps/mobile/android/app/build/outputs/apk/gms/release/*.apk++ - name: Secure Cleanup+ if: always()run: |- cd apps/mobile/android- ./gradlew assembleGmsRelease --no-daemon+ rm -f apps/mobile/android/app/release.keystore+ rm -f apps/mobile/android/gradle.properties++ build-foss:+ name: Build FOSS Release APK+ needs: test+ runs-on: ubuntu-latest++ steps:+ - name: Checkout code+ uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Setup Node & Java+ uses: actions/setup-node@v4+ with:+ node-version: '20'+ cache: 'npm'+ - uses: actions/setup-java@v4+ with:+ distribution: 'temurin'+ java-version: '17'+ cache: 'gradle'++ - name: Install dependencies+ run: npm ci++ - name: Build shared package+ run: npm run build -w @colota/shared++ - name: Pin dev server IP for reproducible builds+ run: |+ sed -i 's/getHostIpAddress(),/project.properties["reactNativeDevServerIp"]?.toString() ?: "localhost",/' \+ node_modules/@react-native/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt++ - name: Append signing config to gradle.properties+ run: |+ cat <<EOF >> apps/mobile/android/gradle.properties+ MYAPP_UPLOAD_STORE_FILE=release.keystore+ MYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}+ MYAPP_UPLOAD_KEY_ALIAS=${{ secrets.KEY_ALIAS }}+ MYAPP_UPLOAD_KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}+ EOF++ - name: Decode keystore+ env:+ KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}+ run: echo $KEYSTORE_BASE64 | base64 -d > apps/mobile/android/app/release.keystore++ - name: Validate signing inputs+ run: |+ test -f apps/mobile/android/app/release.keystore || (echo "Keystore missing" && exit 1)+ test -n "${{ secrets.KEYSTORE_PASSWORD }}" || exit 1+ test -n "${{ secrets.KEY_ALIAS }}" || exit 1+ test -n "${{ secrets.KEY_PASSWORD }}" || exit 1- name: Build FOSS Release APKsrun: |cd apps/mobile/android- ./gradlew clean assembleFossRelease --no-daemon+ chmod +x gradlew+ ./gradlew assembleFossRelease --no-daemon- - name: Upload APKs+ - name: Upload FOSS APKsuses: actions/upload-artifact@v4with:- name: release-apks- path: |- apps/mobile/android/app/build/outputs/apk/gms/release/*.apk- apps/mobile/android/app/build/outputs/apk/foss/release/*.apk+ name: foss-release-apks+ path: apps/mobile/android/app/build/outputs/apk/foss/release/*.apk++ - name: Secure Cleanup+ if: always()+ run: |+ rm -f apps/mobile/android/app/release.keystore+ rm -f apps/mobile/android/gradle.properties++ release:+ name: Publish GitHub Release+ needs: [build-gms, build-foss]+ runs-on: ubuntu-latest+ permissions:+ contents: write++ steps:+ - name: Download GMS APKs+ uses: actions/download-artifact@v4+ with:+ name: gms-release-apks+ path: apks/gms++ - name: Download FOSS APKs+ uses: actions/download-artifact@v4+ with:+ name: foss-release-apks+ path: apks/foss- name: Upload APKs to GitHub Releaseuses: softprops/action-gh-release@v2@@ -119,12 +213,5 @@ jobs:draft: trueprerelease: ${{ contains(github.ref, '-') }}files: |- apps/mobile/android/app/build/outputs/apk/gms/release/*.apk- apps/mobile/android/app/build/outputs/apk/foss/release/*.apk-- - name: Secure Cleanup- if: always()- run: |- echo "Cleaning up sensitive files..."- rm -f apps/mobile/android/app/release.keystore- rm -f apps/mobile/android/gradle.properties+ apks/gms/*.apk+ apks/foss/*.apkdiff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.ymldeleted file mode 100644index 4772434d..00000000--- a/.github/workflows/lint-test.yml+++ /dev/null@@ -1,49 +0,0 @@-name: Lint & Test--on:- push:- branches: [ main, develop ]- paths:- - 'apps/mobile/**'- - 'packages/shared/**'- - 'package-lock.json'- pull_request:- branches: [ main, develop ]- paths:- - 'apps/mobile/**'- - 'packages/shared/**'- - 'package-lock.json'- workflow_dispatch:--permissions:- contents: read--jobs:- lint-and-test:- name: Lint & Test- runs-on: ubuntu-latest-- steps:- - name: Checkout code- uses: actions/checkout@v4-- - name: Setup Node.js- uses: actions/setup-node@v4- with:- node-version: '20'- cache: 'npm'-- - name: Install dependencies- run: npm ci-- - name: Build shared package- run: npm run build -w @colota/shared-- - name: Run ESLint- run: npm run lint -w @colota/mobile-- - name: Run TypeScript check- run: npx -w @colota/mobile tsc --noEmit-- - name: Run tests- run: npm test -w @colota/mobile -- --coverage\ No newline at end of file