-
Notifications
You must be signed in to change notification settings - Fork 6
217 lines (192 loc) · 7.21 KB
/
Copy pathe2e.yml
File metadata and controls
217 lines (192 loc) · 7.21 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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@v5
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
# Only maui-android is installable on Linux; maui-ios fails with
# "Workload ID maui-ios isn't supported on this platform". The iOS TFM
# is gated on macOS in OneSignalSDK.DotNet.csproj and demo.csproj, so
# restore won't try to walk it here.
- name: Install MAUI Android workload
run: dotnet workload install maui-android
- name: Create demo .env
working-directory: examples/demo
run: |
echo "ONESIGNAL_APP_ID=${{ vars.APPIUM_ONESIGNAL_APP_ID }}" > .env
echo "ONESIGNAL_API_KEY=${{ secrets.APPIUM_ONESIGNAL_API_KEY }}" >> .env
- name: Resolve OneSignal Android SDK version
id: android-sdk-version
run: |
VERSION=$(jq -r .android versions.json)
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 }}
# RuntimeIdentifier=android-arm64 ships native code only for arm64-v8a,
# which is what BrowserStack's modern Android device farm runs. This
# roughly halves the APK size (~30MB → ~19MB) versus the default
# multi-ABI build.
- name: Build release APK
working-directory: examples/demo
run: |
dotnet publish demo.csproj \
-f net10.0-android \
-c Release \
-p:AndroidPackageFormat=apk \
-p:RuntimeIdentifier=android-arm64
- name: Locate APK
id: apk
working-directory: examples/demo
run: |
APK=$(ls bin/Release/net10.0-android/android-arm64/*-Signed.apk | head -n1)
if [ -z "$APK" ]; then
echo "::error::No signed APK produced by dotnet publish"
exit 1
fi
cp "$APK" demo.apk
echo "path=examples/demo/demo.apk" >> "$GITHUB_OUTPUT"
- name: Upload APK
uses: actions/upload-artifact@v7
with:
name: demo-apk
path: ${{ steps.apk.outputs.path }}
retention-days: 1
compression-level: 0
build-ios:
if: >-
github.event_name == 'push' ||
github.event.inputs.platform == 'ios' ||
github.event.inputs.platform == 'both'
# The .NET 10 iOS workload currently pulls Microsoft.iOS.Sdk.net10.0_26.5,
# which rejects newer Xcode releases. Pin Xcode so setup-xcode does not
# select latest-stable after the runner image advances.
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.6'
# Both workloads are required even though only the iOS TFM is built,
# because NuGet restore walks every declared TargetFramework of the
# multi-targeted OneSignalSDK.DotNet.csproj, and its android TFM
# follows references into the android-only OneSignalSDK.DotNet.Android*
# projects which need the android workload.
- name: Install MAUI workloads
run: dotnet workload install maui-android maui-ios
- name: Create demo .env
working-directory: examples/demo
run: |
echo "ONESIGNAL_APP_ID=${{ vars.APPIUM_ONESIGNAL_APP_ID }}" > .env
echo "ONESIGNAL_API_KEY=${{ secrets.APPIUM_ONESIGNAL_API_KEY }}" >> .env
- 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 }}
# RuntimeIdentifier=ios-arm64 is required for a real device build that
# BrowserStack can install.
# Do NOT add -p:UseInterpreter=true here. It shrinks the IPA but breaks
# the Notification Service Extension (image notifications stop working)
# because the interpreter path drops the ObjC class registration for
# the NSE binding in OneSignalSDK.DotNet.iOS.
- name: Build signed IPA
working-directory: examples/demo
run: |
dotnet publish demo.csproj \
-f net10.0-ios \
-c Release \
-p:RuntimeIdentifier=ios-arm64 \
-p:ArchiveOnBuild=true
- name: Locate IPA
id: ipa
working-directory: examples/demo
run: |
IPA=$(ls bin/Release/net10.0-ios/ios-arm64/publish/*.ipa | head -n1)
if [ -z "$IPA" ]; then
echo "::error::No IPA produced by dotnet publish"
exit 1
fi
cp "$IPA" demo.ipa
echo "path=examples/demo/demo.ipa" >> "$GITHUB_OUTPUT"
- name: Verify aps-environment in IPA
working-directory: examples/demo
run: |
unzip -oq demo.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: ${{ steps.ipa.outputs.path }}
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: demo.apk
sdk-type: dotnet
build-name: dotnet-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: dotnet
build-name: dotnet-ios-${{ github.ref_name }}-${{ github.run_number }}