-
Notifications
You must be signed in to change notification settings - Fork 379
169 lines (150 loc) · 5.43 KB
/
e2e.yml
File metadata and controls
169 lines (150 loc) · 5.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
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 Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- name: Set up demo
uses: ./.github/actions/setup-demo
with:
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
- name: Resolve OneSignal Android SDK version
id: android-sdk-version
run: |
VERSION=$(grep "com.onesignal:OneSignal:" android/build.gradle | sed -E "s/.*OneSignal:([^\"']+).*/\1/")
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 }}
- name: Build release APK
working-directory: examples/demo/android
# -PciSingleAbi → arm64-v8a-only APK (~10 MB) instead of the
# ~30 MB universal APK. BrowserStack devices we test against
# are all arm64-v8a.
run: ./gradlew assembleRelease -PciSingleAbi --quiet --console=plain --warning-mode=summary
- name: Upload APK
uses: actions/upload-artifact@v7
with:
name: demo-apk
path: examples/demo/android/app/build/outputs/apk/release/app-arm64-v8a-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 demo
uses: ./.github/actions/setup-demo
with:
onesignal-app-id: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
onesignal-api-key: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
install-pods: 'true'
- name: Cache Xcode DerivedData
uses: actions/cache@v5
with:
path: examples/demo/ios/build
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/ios/Podfile.lock') }}
restore-keys: deriveddata-${{ runner.os }}-
- 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/ios
run: |
xcodebuild archive \
-workspace demo.xcworkspace \
-scheme demo \
-configuration Release \
-sdk iphoneos \
-destination 'generic/platform=iOS' \
-archivePath build/demo.xcarchive \
-derivedDataPath build \
-quiet \
-hideShellScriptEnvironment \
CODE_SIGN_STYLE=Manual \
COMPILER_INDEX_STORE_ENABLE=NO
xcodebuild -exportArchive \
-archivePath build/demo.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath build/ipa \
-quiet
- name: Verify aps-environment in IPA
working-directory: examples/demo/ios
run: |
IPA=$(ls build/ipa/*.ipa | head -n1)
unzip -oq "$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/ios/build/ipa/demo.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-arm64-v8a-release.apk
sdk-type: react-native
build-name: react-native-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: demo.ipa
sdk-type: react-native
build-name: react-native-ios-${{ github.ref_name }}-${{ github.run_number }}