-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (157 loc) · 6.04 KB
/
Copy pathe2e.yml
File metadata and controls
176 lines (157 loc) · 6.04 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
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: '21'
- 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 -E '^onesignal\s*=\s*"' android/gradle/libs.versions.toml | sed -E 's/.*"([^"]+)".*/\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 debug APK
working-directory: examples/demo/android
# Use the debug variant: Capacitor only calls
# WebView.setWebContentsDebuggingEnabled(true) when BuildConfig.DEBUG
# is true, which Appium needs to enter the WEBVIEW context (CSS /
# data-testid selectors). Release APKs error with
# "Failed to get sockets matching: @webview_devtools_remote_.*".
# -PciSingleAbi → arm64-v8a-only APK; BrowserStack devices are all
# arm64-v8a, so dropping other ABIs trims size with no test impact.
run: ./gradlew assembleDebug -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/debug/app-arm64-v8a-debug.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 }}
- name: Cache Xcode DerivedData
uses: actions/cache@v5
with:
path: examples/demo/ios/App/build
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/ios/App/CapApp-SPM/Package.swift', 'examples/demo/ios/App/App.xcodeproj/project.pbxproj') }}
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/App
# Release builds are fine for Appium because capacitor.config.ts sets
# `ios.webContentsDebuggingEnabled: true`, which forces
# WKWebView.isInspectable=true so the WEBVIEW_* context (and
# data-testid selectors) remain available in Release IPAs.
run: |
xcodebuild archive \
-project App.xcodeproj \
-scheme App \
-configuration Release \
-sdk iphoneos \
-destination 'generic/platform=iOS' \
-archivePath build/App.xcarchive \
-derivedDataPath build \
-quiet \
-hideShellScriptEnvironment \
CODE_SIGN_STYLE=Manual \
COMPILER_INDEX_STORE_ENABLE=NO
xcodebuild -exportArchive \
-archivePath build/App.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath build/ipa \
-quiet
- name: Verify aps-environment in IPA
working-directory: examples/demo/ios/App
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/App/build/ipa/App.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-debug.apk
sdk-type: capacitor
build-name: capacitor-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: App.ipa
sdk-type: capacitor
build-name: capacitor-ios-${{ github.ref_name }}-${{ github.run_number }}