-
Notifications
You must be signed in to change notification settings - Fork 378
ci: [SDK-4690] add Android E2E workflow #2652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0d6ff30
ci(e2e): add Android E2E workflow
fadi-george d1943a7
refactor(demo): move dialogs into section composables
fadi-george d09e35e
refactor(demo): move snackbar logic to UI layer
fadi-george f90caad
ci(e2e): drop unused onesignal-api-key input
fadi-george f84477a
docs(demo): clarify logging and silent action contract
fadi-george 6372a86
ci(e2e): harden workflow against injection and silent misconfig
fadi-george c3c00b4
refactor(demo): drop orphaned imports in Sections.kt
fadi-george 443fed4
docs(demo): fix two build.md drifts
fadi-george cb4e019
ci(e2e): include gradle.properties in Gradle cache key
fadi-george File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: 'Setup Demo' | ||
| description: 'Installs the JDK and Android toolchains, caches Gradle, and writes the demo local.properties file' | ||
| inputs: | ||
| onesignal-app-id: | ||
| description: 'OneSignal App ID written into examples/demo/local.properties' | ||
| required: true | ||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Set up Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '17' | ||
|
|
||
| - name: Set up Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
| with: | ||
| cmdline-tools-version: '10406996' | ||
| log-accepted-android-sdk-licenses: false | ||
|
|
||
| - name: Cache Gradle | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| # `*.gradle*` matches `build.gradle{,.kts}` etc. but NOT `gradle.properties` | ||
| # (no literal `.gradle` substring), so list `gradle.properties` explicitly. | ||
| key: ${{ runner.os }}-gradle-demo-${{ hashFiles('examples/demo/**/*.gradle*', 'examples/demo/**/gradle.properties', 'examples/demo/**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle-demo- | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| # Mirrors the Capacitor demo's `.env`: writes the override file before any | ||
| # build runs so the OneSignal App ID + channel id end up baked into | ||
| # BuildConfig. `examples/demo/app/build.gradle.kts` resolves each key in | ||
| # this order: `-PKEY=value` from the CLI > local.properties > built-in | ||
| # default, so writing to local.properties is the closest equivalent to | ||
| # the Capacitor `.env` flow. | ||
| - name: Write demo local.properties | ||
| shell: bash | ||
| working-directory: examples/demo | ||
| env: | ||
| ONESIGNAL_APP_ID: ${{ inputs.onesignal-app-id }} | ||
| run: | | ||
| { | ||
| echo "ONESIGNAL_APP_ID=${ONESIGNAL_APP_ID}" | ||
| echo "ONESIGNAL_ANDROID_CHANNEL_ID=7ec2ece9-c538-4656-9516-1316f48a005c" | ||
| } > local.properties | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - rel/** | ||
| workflow_dispatch: | ||
| inputs: | ||
| sdk-version: | ||
| description: 'OneSignal Android SDK version to wait for and build against (defaults to OneSignalSDK/gradle.properties).' | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-android: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # Fail fast on unset var. Otherwise `demoOverride()` collapses "" to | ||
| # null and the build silently uses the hardcoded default app ID. | ||
| - name: Validate APPIUM_ONESIGNAL_APP_ID | ||
| env: | ||
| ONESIGNAL_APP_ID: ${{ vars.APPIUM_ONESIGNAL_APP_ID }} | ||
| run: | | ||
| if [ -z "$ONESIGNAL_APP_ID" ]; then | ||
| echo "::error::APPIUM_ONESIGNAL_APP_ID is not set" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Set up demo | ||
| uses: ./.github/actions/setup-demo | ||
| with: | ||
| onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }} | ||
|
claude[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Resolve OneSignal Android SDK version | ||
| id: android-sdk-version | ||
| env: | ||
| INPUT_VERSION: ${{ github.event.inputs.sdk-version }} | ||
| run: | | ||
| if [ -n "$INPUT_VERSION" ]; then | ||
| VERSION="$INPUT_VERSION" | ||
| else | ||
| VERSION=$(grep -E '^SDK_VERSION=' OneSignalSDK/gradle.properties | cut -d '=' -f2) | ||
| fi | ||
| if [ -z "$VERSION" ]; then | ||
| echo "::error::Could not resolve OneSignal Android SDK version" | ||
| exit 1 | ||
| fi | ||
| echo "Resolved OneSignal Android SDK version: $VERSION" | ||
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Wait for OneSignal Android SDK on Maven Central | ||
| uses: OneSignal/sdk-shared/.github/actions/wait-for-maven-artifact@main | ||
| with: | ||
| version: ${{ steps.android-sdk-version.outputs.version }} | ||
|
|
||
| # gms+debug: BrowserStack devices have GMS, debug enables UiAutomator2 | ||
| # attach. -PSDK_VERSION pins the Maven dep to the version we waited | ||
| # for. SDK_VERSION flows through env: to avoid script injection | ||
| # (workflow_dispatch input is user-controlled). | ||
| - name: Build debug APK | ||
| working-directory: examples/demo | ||
| env: | ||
| SDK_VERSION: ${{ steps.android-sdk-version.outputs.version }} | ||
| run: ./gradlew :app:assembleGmsDebug "-PSDK_VERSION=$SDK_VERSION" --console=plain --warning-mode=summary | ||
|
|
||
| - name: Upload APK | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: demo-apk | ||
| path: examples/demo/app/build/outputs/apk/gms/debug/app-gms-debug.apk | ||
| retention-days: 1 | ||
| compression-level: 0 | ||
|
|
||
| e2e-android: | ||
| needs: build-android | ||
| uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main | ||
| secrets: inherit | ||
| with: | ||
| platform: android | ||
| app-artifact: demo-apk | ||
| app-filename: app-gms-debug.apk | ||
| sdk-type: android | ||
| build-name: android-${{ github.ref_name }}-${{ github.run_number }} | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.