From aaa8724dbaa0a9a8c965729640e5900262a7f243 Mon Sep 17 00:00:00 2001 From: ngapps Date: Wed, 30 Sep 2026 23:54:59 +0200 Subject: [PATCH 1/3] Add CI workflow for Android build, tests, lint and iOS compile --- .github/workflows/ci.yml | 94 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ff70ab5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +name: CI + +on: + pull_request: + branches: [master] + push: + branches: [master] + workflow_dispatch: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +env: + GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx6g + +jobs: + android: + name: Android + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 21 + + - uses: gradle/actions/setup-gradle@v4 + + # google-services.json is gitignored; the Google Services plugin only needs a file + # with matching package names to build, so CI uses a stub without real keys. + - name: Create stub google-services.json + run: | + cat > app/google-services.json <<'EOF' + { + "project_info": { + "project_number": "000000000000", + "project_id": "metanmobile-ci", + "storage_bucket": "metanmobile-ci.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:000000000000:android:0000000000000000", + "android_client_info": { "package_name": "com.ngapp.metanmobile" } + }, + "api_key": [{ "current_key": "AIzaSyCI000000000000000000000000000000" }] + }, + { + "client_info": { + "mobilesdk_app_id": "1:000000000000:android:0000000000000001", + "android_client_info": { "package_name": "com.ngapp.metanmobile.debug" } + }, + "api_key": [{ "current_key": "AIzaSyCI000000000000000000000000000000" }] + } + ], + "configuration_version": "1" + } + EOF + + - name: Build + run: ./gradlew :app:assembleDebug + + - name: Unit tests + run: ./gradlew testDebugUnitTest testAndroidHostTest + + - name: Lint + run: ./gradlew lintDebug + + - name: Upload reports + if: failure() + uses: actions/upload-artifact@v4 + with: + name: android-reports + path: '**/build/reports/' + + ios: + name: iOS + runs-on: macos-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 21 + + - uses: gradle/actions/setup-gradle@v4 + + - name: Compile shared code for iOS + run: ./gradlew :composeApp:compileKotlinIosSimulatorArm64 From e2f4a846273006e8ae31370483e990f358a732f6 Mon Sep 17 00:00:00 2001 From: ngapps Date: Thu, 1 Oct 2026 00:00:16 +0200 Subject: [PATCH 2/3] CI: create stub secrets.properties --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff70ab5..47a531e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,17 @@ jobs: - uses: gradle/actions/setup-gradle@v4 + # secrets.properties is gitignored, but the Secrets Gradle plugin fails without it. + # Real ad unit ids fall back to test ids in core:ui, so placeholders are enough. + - name: Create stub secrets.properties + run: | + cat > secrets.properties <<'EOF' + MAPS_API_KEY=ci-placeholder + ADS_ID_KEY=ca-app-pub-3940256099942544~3347511713 + METAN_ECOGAS_API=https://example.com/ + GITHUB_BASE_URL=https://example.com/ + EOF + # google-services.json is gitignored; the Google Services plugin only needs a file # with matching package names to build, so CI uses a stub without real keys. - name: Create stub google-services.json @@ -90,5 +101,16 @@ jobs: - uses: gradle/actions/setup-gradle@v4 + # secrets.properties is gitignored, but the Secrets Gradle plugin fails without it. + # Real ad unit ids fall back to test ids in core:ui, so placeholders are enough. + - name: Create stub secrets.properties + run: | + cat > secrets.properties <<'EOF' + MAPS_API_KEY=ci-placeholder + ADS_ID_KEY=ca-app-pub-3940256099942544~3347511713 + METAN_ECOGAS_API=https://example.com/ + GITHUB_BASE_URL=https://example.com/ + EOF + - name: Compile shared code for iOS run: ./gradlew :composeApp:compileKotlinIosSimulatorArm64 From 912d624f1d77a3de20bce4b1d35b9931d0806d2c Mon Sep 17 00:00:00 2001 From: ngapps Date: Thu, 1 Oct 2026 07:39:09 +0200 Subject: [PATCH 3/3] Add OSS licenses dependency to app to fix lint MissingClass --- app/build.gradle.kts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e20db57..0d88769 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -100,6 +100,9 @@ dependencies { // Firebase Performance still uses lite generated protobuf messages at runtime. This was // previously brought in transitively by the Android-only DataStore proto module. implementation(libs.protobuf.kotlin.lite) + // OssLicensesMenuActivity/OssLicensesActivity are declared in this module's manifest, so the + // library has to be on app's own compile classpath (core:ui only has it as implementation). + implementation(libs.google.oss.licenses) implementation(projects.core.analytics) implementation(projects.core.common)