|
| 1 | +name: E2E Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - rel/** |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + platform: |
| 10 | + description: 'Platform to test' |
| 11 | + required: true |
| 12 | + default: 'both' |
| 13 | + type: choice |
| 14 | + options: |
| 15 | + - android |
| 16 | + - ios |
| 17 | + - both |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +concurrency: |
| 23 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +jobs: |
| 27 | + build-android: |
| 28 | + if: >- |
| 29 | + github.event_name == 'push' || |
| 30 | + github.event.inputs.platform == 'android' || |
| 31 | + github.event.inputs.platform == 'both' |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v6 |
| 36 | + |
| 37 | + - name: Set up Java |
| 38 | + uses: actions/setup-java@v5 |
| 39 | + with: |
| 40 | + distribution: temurin |
| 41 | + java-version: '17' |
| 42 | + |
| 43 | + - name: Set up demo |
| 44 | + uses: ./.github/actions/setup-demo |
| 45 | + with: |
| 46 | + onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }} |
| 47 | + onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }} |
| 48 | + |
| 49 | + - name: Build release APK |
| 50 | + working-directory: examples/demo/android |
| 51 | + run: ./gradlew assembleRelease |
| 52 | + |
| 53 | + - name: Upload APK |
| 54 | + uses: actions/upload-artifact@v7 |
| 55 | + with: |
| 56 | + name: demo-apk |
| 57 | + path: examples/demo/android/app/build/outputs/apk/release/app-release.apk |
| 58 | + retention-days: 1 |
| 59 | + compression-level: 0 |
| 60 | + |
| 61 | + build-ios: |
| 62 | + if: >- |
| 63 | + github.event_name == 'push' || |
| 64 | + github.event.inputs.platform == 'ios' || |
| 65 | + github.event.inputs.platform == 'both' |
| 66 | + runs-on: macos-latest |
| 67 | + steps: |
| 68 | + - name: Checkout |
| 69 | + uses: actions/checkout@v6 |
| 70 | + |
| 71 | + - name: Set up demo |
| 72 | + uses: ./.github/actions/setup-demo |
| 73 | + with: |
| 74 | + onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }} |
| 75 | + onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }} |
| 76 | + install-pods: 'true' |
| 77 | + |
| 78 | + - name: Cache Xcode DerivedData |
| 79 | + uses: actions/cache@v5 |
| 80 | + with: |
| 81 | + path: examples/demo/ios/build |
| 82 | + key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/ios/Podfile.lock') }} |
| 83 | + restore-keys: deriveddata-${{ runner.os }}- |
| 84 | + |
| 85 | + - name: Set up iOS codesigning |
| 86 | + uses: OneSignal/sdk-shared/.github/actions/setup-ios-demo-codesigning@main |
| 87 | + with: |
| 88 | + p12-base64: ${{ secrets.APPIUM_IOS_DEV_CERT_P12_BASE64 }} |
| 89 | + p12-password: ${{ secrets.APPIUM_IOS_DEV_CERT_PASSWORD }} |
| 90 | + asc-key-id: ${{ secrets.APPIUM_APP_STORE_CONNECT_KEY_ID }} |
| 91 | + asc-issuer-id: ${{ secrets.APPIUM_APP_STORE_CONNECT_ISSUER_ID }} |
| 92 | + asc-private-key: ${{ secrets.APPIUM_APP_STORE_CONNECT_PRIVATE_KEY }} |
| 93 | + |
| 94 | + - name: Build signed IPA |
| 95 | + working-directory: examples/demo/ios |
| 96 | + run: | |
| 97 | + xcodebuild archive \ |
| 98 | + -workspace demo.xcworkspace \ |
| 99 | + -scheme demo \ |
| 100 | + -configuration Release \ |
| 101 | + -sdk iphoneos \ |
| 102 | + -destination 'generic/platform=iOS' \ |
| 103 | + -archivePath build/demo.xcarchive \ |
| 104 | + -derivedDataPath build \ |
| 105 | + CODE_SIGN_STYLE=Manual \ |
| 106 | + COMPILER_INDEX_STORE_ENABLE=NO |
| 107 | + xcodebuild -exportArchive \ |
| 108 | + -archivePath build/demo.xcarchive \ |
| 109 | + -exportOptionsPlist ExportOptions.plist \ |
| 110 | + -exportPath build/ipa |
| 111 | +
|
| 112 | + - name: Verify aps-environment in IPA |
| 113 | + working-directory: examples/demo/ios |
| 114 | + run: | |
| 115 | + IPA=$(ls build/ipa/*.ipa | head -n1) |
| 116 | + unzip -oq "$IPA" -d /tmp/ipa |
| 117 | + APP=$(ls -d /tmp/ipa/Payload/*.app | head -n1) |
| 118 | + codesign -d --entitlements - "$APP" 2>&1 | tee /tmp/entitlements.txt |
| 119 | + if ! grep -q 'aps-environment' /tmp/entitlements.txt; then |
| 120 | + echo "::error::Built IPA is missing aps-environment entitlement; push subscription will not work" |
| 121 | + exit 1 |
| 122 | + fi |
| 123 | +
|
| 124 | + - name: Upload IPA |
| 125 | + uses: actions/upload-artifact@v7 |
| 126 | + with: |
| 127 | + name: demo-ipa |
| 128 | + path: examples/demo/ios/build/ipa/demo.ipa |
| 129 | + retention-days: 1 |
| 130 | + compression-level: 0 |
| 131 | + |
| 132 | + e2e-android: |
| 133 | + needs: build-android |
| 134 | + uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main |
| 135 | + secrets: inherit |
| 136 | + with: |
| 137 | + platform: android |
| 138 | + app-artifact: demo-apk |
| 139 | + app-filename: app-release.apk |
| 140 | + sdk-type: react-native |
| 141 | + build-name: react-native-android-${{ github.ref_name }}-${{ github.run_number }} |
| 142 | + |
| 143 | + e2e-ios: |
| 144 | + needs: build-ios |
| 145 | + uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main |
| 146 | + secrets: inherit |
| 147 | + with: |
| 148 | + platform: ios |
| 149 | + app-artifact: demo-ipa |
| 150 | + app-filename: demo.ipa |
| 151 | + sdk-type: react-native |
| 152 | + build-name: react-native-ios-${{ github.ref_name }}-${{ github.run_number }} |
0 commit comments