E2E Tests #40
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: E2E Tests | |
| on: | |
| push: | |
| branches: | |
| - rel/** | |
| workflow_dispatch: | |
| inputs: | |
| platform: | |
| description: 'Platform to test' | |
| required: true | |
| default: 'both' | |
| type: choice | |
| options: | |
| - android | |
| - ios | |
| - both | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-android: | |
| if: >- | |
| github.event_name == 'push' || | |
| github.event.inputs.platform == 'android' || | |
| github.event.inputs.platform == 'both' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Flutter | |
| uses: ./.github/actions/setup-flutter | |
| with: | |
| working-directory: examples/demo | |
| - name: Set up Android build | |
| uses: ./.github/actions/setup-android-build | |
| - name: Create demo .env | |
| uses: ./.github/actions/create-demo-env | |
| with: | |
| onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }} | |
| onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }} | |
| - name: Build release APK | |
| working-directory: examples/demo | |
| run: flutter build apk --release | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: demo-apk | |
| path: examples/demo/build/app/outputs/flutter-apk/app-release.apk | |
| retention-days: 1 | |
| compression-level: 0 | |
| build-ios: | |
| if: >- | |
| github.event_name == 'push' || | |
| github.event.inputs.platform == 'ios' || | |
| github.event.inputs.platform == 'both' | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Flutter | |
| uses: ./.github/actions/setup-flutter | |
| with: | |
| working-directory: examples/demo | |
| - name: Set up iOS build | |
| uses: ./.github/actions/setup-ios-build | |
| - name: Create demo .env | |
| uses: ./.github/actions/create-demo-env | |
| with: | |
| onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }} | |
| onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }} | |
| - name: Set up iOS codesigning | |
| uses: OneSignal/sdk-shared/.github/actions/setup-ios-demo-codesigning@main | |
| with: | |
| p12-base64: ${{ secrets.APPIUM_IOS_DEV_CERT_P12_BASE64 }} | |
| p12-password: ${{ secrets.APPIUM_IOS_DEV_CERT_PASSWORD }} | |
| asc-key-id: ${{ secrets.APPIUM_APP_STORE_CONNECT_KEY_ID }} | |
| asc-issuer-id: ${{ secrets.APPIUM_APP_STORE_CONNECT_ISSUER_ID }} | |
| asc-private-key: ${{ secrets.APPIUM_APP_STORE_CONNECT_PRIVATE_KEY }} | |
| - name: Build signed IPA | |
| working-directory: examples/demo | |
| run: | | |
| flutter build ipa --release \ | |
| --export-options-plist=ios/ExportOptions.plist \ | |
| --split-debug-info=build/symbols | |
| cp build/ios/ipa/*.ipa build/ios/ipa/Runner.ipa | |
| - name: Verify aps-environment in IPA | |
| working-directory: examples/demo | |
| run: | | |
| unzip -oq build/ios/ipa/Runner.ipa -d /tmp/ipa | |
| APP=$(ls -d /tmp/ipa/Payload/*.app | head -n1) | |
| codesign -d --entitlements - "$APP" 2>&1 | tee /tmp/entitlements.txt | |
| if ! grep -q 'aps-environment' /tmp/entitlements.txt; then | |
| echo "::error::Built IPA is missing aps-environment entitlement; push subscription will not work" | |
| exit 1 | |
| fi | |
| - name: Upload IPA | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: demo-ipa | |
| path: examples/demo/build/ios/ipa/Runner.ipa | |
| 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-release.apk | |
| sdk-type: flutter | |
| build-name: flutter-android-${{ github.ref_name }}-${{ github.run_number }} | |
| e2e-ios: | |
| needs: build-ios | |
| uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main | |
| secrets: inherit | |
| with: | |
| platform: ios | |
| app-artifact: demo-ipa | |
| app-filename: Runner.ipa | |
| sdk-type: flutter | |
| build-name: flutter-ios-${{ github.ref_name }}-${{ github.run_number }} |