Skip to content

Commit 2da7764

Browse files
committed
ci(ios): add demo app codesigning action
1 parent 002af32 commit 2da7764

2 files changed

Lines changed: 80 additions & 4 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: 'Setup iOS Demo Codesigning'
2+
description: 'Import the Appium signing cert and download provisioning profiles for the OneSignal demo app (main target + optional NSE and Widget) via the App Store Connect API. Call once per iOS build job in an SDK E2E workflow.'
3+
4+
inputs:
5+
p12-base64:
6+
description: 'Base64-encoded .p12 signing certificate'
7+
required: true
8+
p12-password:
9+
description: 'Password used when exporting the .p12'
10+
required: true
11+
asc-key-id:
12+
description: 'App Store Connect API Key ID'
13+
required: true
14+
asc-issuer-id:
15+
description: 'App Store Connect API Issuer ID'
16+
required: true
17+
asc-private-key:
18+
description: 'App Store Connect API private key (.p8) contents, as raw PKCS8 PEM text'
19+
required: true
20+
main-bundle-id:
21+
description: 'Main app bundle identifier'
22+
required: false
23+
default: 'com.onesignal.example'
24+
nse-bundle-id:
25+
description: 'Notification Service Extension bundle identifier. Leave empty to skip.'
26+
required: false
27+
default: 'com.onesignal.example.NSE'
28+
widget-bundle-id:
29+
description: 'Live Activity / Widget Extension bundle identifier. Leave empty to skip.'
30+
required: false
31+
default: 'com.onesignal.example.LA'
32+
profile-type:
33+
description: 'Provisioning profile type (IOS_APP_DEVELOPMENT, IOS_APP_ADHOC, IOS_APP_STORE)'
34+
required: false
35+
default: 'IOS_APP_DEVELOPMENT'
36+
37+
runs:
38+
using: composite
39+
steps:
40+
- name: Import signing certificate
41+
uses: apple-actions/import-codesign-certs@v6
42+
with:
43+
p12-file-base64: ${{ inputs.p12-base64 }}
44+
p12-password: ${{ inputs.p12-password }}
45+
keychain-password: ci-keychain
46+
47+
- name: Download provisioning profile (main)
48+
uses: apple-actions/download-provisioning-profiles@v5
49+
with:
50+
bundle-id: ${{ inputs.main-bundle-id }}
51+
profile-type: ${{ inputs.profile-type }}
52+
issuer-id: ${{ inputs.asc-issuer-id }}
53+
api-key-id: ${{ inputs.asc-key-id }}
54+
api-private-key: ${{ inputs.asc-private-key }}
55+
56+
- name: Download provisioning profile (NSE)
57+
if: inputs.nse-bundle-id != ''
58+
uses: apple-actions/download-provisioning-profiles@v5
59+
with:
60+
bundle-id: ${{ inputs.nse-bundle-id }}
61+
profile-type: ${{ inputs.profile-type }}
62+
issuer-id: ${{ inputs.asc-issuer-id }}
63+
api-key-id: ${{ inputs.asc-key-id }}
64+
api-private-key: ${{ inputs.asc-private-key }}
65+
66+
- name: Download provisioning profile (Widget)
67+
if: inputs.widget-bundle-id != ''
68+
uses: apple-actions/download-provisioning-profiles@v5
69+
with:
70+
bundle-id: ${{ inputs.widget-bundle-id }}
71+
profile-type: ${{ inputs.profile-type }}
72+
issuer-id: ${{ inputs.asc-issuer-id }}
73+
api-key-id: ${{ inputs.asc-key-id }}
74+
api-private-key: ${{ inputs.asc-private-key }}

appium/tests/helpers/app.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,19 @@ export async function waitForAppReady(opts: { skipLogin?: boolean } = {}) {
189189
// Want to login the user so we can clean up/delete its data on the next rerun.
190190
// `loggedIn` is module-local (worker-scoped) on purpose: each WDIO worker
191191
// runs in its own Node process and drives one device, so the cache reflects
192-
// that device's state. Sharing across workers (e.g. via sharedStore) would
193-
// lie when running parallels on BrowserStack.
194-
const loggedIn = driver.sharedStore.get('loggedIn');
192+
// that device's state.
193+
// Browserstack runs each test in a new session, so we need to set the loggedIn flag to false.
194+
const loggedIn = !process.env.BROWSERSTACK_USERNAME ? driver.sharedStore.get('loggedIn') : false;
195195
if (!loggedIn) {
196196
const testUserId = getTestExternalId();
197197
const userIdEl = await scrollToEl('user_external_id_value', { direction: 'up' });
198198
const sessionUserId = await userIdEl.getText();
199199
if (sessionUserId !== testUserId) {
200200
await loginUser(testUserId);
201201
}
202-
driver.sharedStore.set('loggedIn', true);
202+
if (!process.env.BROWSERSTACK_USERNAME) {
203+
driver.sharedStore.set('loggedIn', true);
204+
}
203205
}
204206
}
205207

0 commit comments

Comments
 (0)