Skip to content

Commit e7b9d29

Browse files
authored
1 parent 5403f81 commit e7b9d29

File tree

11 files changed

+1022
-57
lines changed

11 files changed

+1022
-57
lines changed

.github/workflows/release-please.yml

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ jobs:
99
runs-on: ubuntu-latest
1010
outputs:
1111
package-common-released: ${{ steps.release.outputs['packages/shared/common--release_created'] }}
12+
package-sdk-client-released: ${{ steps.release.outputs['packages/shared/sdk-client--release_created'] }}
1213
package-sdk-server-released: ${{ steps.release.outputs['packages/shared/sdk-server--release_created'] }}
1314
package-sdk-server-edge-released: ${{ steps.release.outputs['packages/shared/sdk-server-edge--release_created'] }}
1415
package-akamai-edgeworker-sdk-released: ${{ steps.release.outputs['packages/shared/akamai-edgeworker-sdk--release_created'] }}
1516
package-cloudflare-released: ${{ steps.release.outputs['packages/sdk/cloudflare--release_created'] }}
17+
package-react-native-released: ${{ steps.release.outputs['packages/sdk/react-native--release_created'] }}
1618
package-server-node-released: ${{ steps.release.outputs['packages/sdk/server-node--release_created'] }}
1719
package-vercel-released: ${{ steps.release.outputs['packages/sdk/vercel--release_created'] }}
1820
package-akamai-base-released: ${{ steps.release.outputs['packages/sdk/akamai-base--release_created'] }}
@@ -41,7 +43,7 @@ jobs:
4143
node-version: 16.x
4244
registry-url: 'https://registry.npmjs.org'
4345
- uses: ./actions/install-npm-version
44-
with:
46+
with:
4547
npm_version: 9.5.0
4648
- id: release-common
4749
name: Full release of packages/shared/common
@@ -50,6 +52,29 @@ jobs:
5052
workspace_path: packages/shared/common
5153
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
5254

55+
release-sdk-client:
56+
runs-on: ubuntu-latest
57+
needs: ['release-please']
58+
permissions:
59+
id-token: write
60+
contents: write
61+
if: ${{ needs.release-please.outputs.package-sdk-client-released }}
62+
steps:
63+
- uses: actions/checkout@v3
64+
- uses: actions/setup-node@v3
65+
with:
66+
node-version: 18.x
67+
registry-url: 'https://registry.npmjs.org'
68+
- uses: ./actions/install-npm-version
69+
with:
70+
npm_version: 10.2.3
71+
- id: release-sdk-client
72+
name: Full release of packages/shared/sdk-client
73+
uses: ./actions/full-release
74+
with:
75+
workspace_path: packages/shared/sdk-client
76+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
77+
5378
release-sdk-server:
5479
runs-on: ubuntu-latest
5580
needs: ['release-please']
@@ -64,9 +89,9 @@ jobs:
6489
node-version: 16.x
6590
registry-url: 'https://registry.npmjs.org'
6691
- uses: ./actions/install-npm-version
67-
with:
92+
with:
6893
npm_version: 9.5.0
69-
- id: release-common
94+
- id: release-sdk-server
7095
name: Full release of packages/shared/sdk-server
7196
uses: ./actions/full-release
7297
with:
@@ -87,9 +112,9 @@ jobs:
87112
node-version: 16.x
88113
registry-url: 'https://registry.npmjs.org'
89114
- uses: ./actions/install-npm-version
90-
with:
115+
with:
91116
npm_version: 9.5.0
92-
- id: release-common
117+
- id: release-sdk-server-edge
93118
name: Full release of packages/shared/sdk-server-edge
94119
uses: ./actions/full-release
95120
with:
@@ -110,9 +135,9 @@ jobs:
110135
node-version: 16.x
111136
registry-url: 'https://registry.npmjs.org'
112137
- uses: ./actions/install-npm-version
113-
with:
138+
with:
114139
npm_version: 9.5.0
115-
- id: release-common
140+
- id: release-akamai-edgeworker-sdk
116141
name: Full release of packages/shared/akamai-edgeworker-sdk
117142
uses: ./actions/full-release
118143
with:
@@ -133,15 +158,38 @@ jobs:
133158
node-version: 16.x
134159
registry-url: 'https://registry.npmjs.org'
135160
- uses: ./actions/install-npm-version
136-
with:
161+
with:
137162
npm_version: 9.5.0
138-
- id: release-common
163+
- id: release-cloudflare
139164
name: Full release of packages/sdk/cloudflare
140165
uses: ./actions/full-release
141166
with:
142167
workspace_path: packages/sdk/cloudflare
143168
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
144169

170+
release-react-native:
171+
runs-on: ubuntu-latest
172+
needs: ['release-please']
173+
permissions:
174+
id-token: write
175+
contents: write
176+
if: ${{ needs.release-please.outputs.package-react-native-released }}
177+
steps:
178+
- uses: actions/checkout@v3
179+
- uses: actions/setup-node@v3
180+
with:
181+
node-version: 18.x
182+
registry-url: 'https://registry.npmjs.org'
183+
- uses: ./actions/install-npm-version
184+
with:
185+
npm_version: 10.2.3
186+
- id: release-react-native
187+
name: Full release of packages/sdk/react-native
188+
uses: ./actions/full-release
189+
with:
190+
workspace_path: packages/sdk/react-native
191+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
192+
145193
release-server-node:
146194
runs-on: ubuntu-latest
147195
needs: ['release-please']
@@ -156,9 +204,9 @@ jobs:
156204
node-version: 16.x
157205
registry-url: 'https://registry.npmjs.org'
158206
- uses: ./actions/install-npm-version
159-
with:
207+
with:
160208
npm_version: 9.5.0
161-
- id: release-common
209+
- id: release-server-node
162210
name: Full release of packages/sdk/server-node
163211
uses: ./actions/full-release
164212
with:
@@ -179,9 +227,9 @@ jobs:
179227
node-version: 16.x
180228
registry-url: 'https://registry.npmjs.org'
181229
- uses: ./actions/install-npm-version
182-
with:
230+
with:
183231
npm_version: 9.5.0
184-
- id: release-common
232+
- id: release-vercel
185233
name: Full release of packages/sdk/vercel
186234
uses: ./actions/full-release
187235
with:
@@ -202,9 +250,9 @@ jobs:
202250
node-version: 16.x
203251
registry-url: 'https://registry.npmjs.org'
204252
- uses: ./actions/install-npm-version
205-
with:
253+
with:
206254
npm_version: 9.5.0
207-
- id: release-common
255+
- id: release-akamai-base
208256
name: Full release of packages/sdk/akamai-base
209257
uses: ./actions/full-release
210258
with:
@@ -225,9 +273,9 @@ jobs:
225273
node-version: 16.x
226274
registry-url: 'https://registry.npmjs.org'
227275
- uses: ./actions/install-npm-version
228-
with:
276+
with:
229277
npm_version: 9.5.0
230-
- id: release-common
278+
- id: release-akamai-edgekv
231279
name: Full release of packages/sdk/akamai-edgekv
232280
uses: ./actions/full-release
233281
with:
@@ -248,13 +296,13 @@ jobs:
248296
node-version: 16.x
249297
registry-url: 'https://registry.npmjs.org'
250298
- uses: ./actions/install-npm-version
251-
with:
299+
with:
252300
npm_version: 9.5.0
253301
- run: |
254302
sudo apt-get update
255303
sudo apt-get install redis-server
256304
sudo service redis-server start
257-
- id: release-common
305+
- id: release-node-server-sdk-redis
258306
name: Full release of packages/store/node-server-sdk-redis
259307
uses: ./actions/full-release
260308
with:
@@ -275,11 +323,11 @@ jobs:
275323
node-version: 16.x
276324
registry-url: 'https://registry.npmjs.org'
277325
- uses: ./actions/install-npm-version
278-
with:
326+
with:
279327
npm_version: 9.5.0
280328
- run: |
281329
sudo docker run -d -p 8000:8000 amazon/dynamodb-local
282-
- id: release-common
330+
- id: release-node-server-sdk-dynamodb
283331
name: Full release of packages/store/node-server-sdk-dynamodb
284332
uses: ./actions/full-release
285333
with:
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/** @type {Detox.DetoxConfig} */
2+
module.exports = {
3+
testRunner: {
4+
args: {
5+
$0: 'jest',
6+
config: 'e2e/jest.config.js',
7+
},
8+
jest: {
9+
setupTimeout: 120000,
10+
},
11+
},
12+
apps: {
13+
'ios.debug': {
14+
type: 'ios.app',
15+
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/reactnativeexample.app',
16+
build:
17+
'xcodebuild -workspace ios/reactnativeexample.xcworkspace -scheme reactnativeexample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build',
18+
},
19+
'ios.release': {
20+
type: 'ios.app',
21+
binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/reactnativeexample.app',
22+
build:
23+
'xcodebuild -workspace ios/reactnativeexample.xcworkspace -scheme reactnativeexample -configuration Release -sdk iphonesimulator -derivedDataPath ios/build',
24+
},
25+
'android.debug': {
26+
type: 'android.apk',
27+
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
28+
build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
29+
reversePorts: [8081],
30+
},
31+
'android.release': {
32+
type: 'android.apk',
33+
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
34+
build: 'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release',
35+
},
36+
},
37+
devices: {
38+
simulator: {
39+
type: 'ios.simulator',
40+
device: {
41+
type: 'iPhone 15',
42+
},
43+
},
44+
attached: {
45+
type: 'android.attached',
46+
device: {
47+
adbName: '.*',
48+
},
49+
},
50+
emulator: {
51+
type: 'android.emulator',
52+
device: {
53+
avdName: 'Pixel_3a_API_33_arm64-v8a',
54+
},
55+
},
56+
},
57+
configurations: {
58+
'ios.sim.debug': {
59+
device: 'simulator',
60+
app: 'ios.debug',
61+
},
62+
'ios.sim.release': {
63+
device: 'simulator',
64+
app: 'ios.release',
65+
},
66+
'android.att.debug': {
67+
device: 'attached',
68+
app: 'android.debug',
69+
},
70+
'android.att.release': {
71+
device: 'attached',
72+
app: 'android.release',
73+
},
74+
'android.emu.debug': {
75+
device: 'emulator',
76+
app: 'android.debug',
77+
},
78+
'android.emu.release': {
79+
device: 'emulator',
80+
app: 'android.release',
81+
},
82+
},
83+
};

packages/sdk/react-native/example/README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## LaunchDarkly React Native SDK example app
1+
# LaunchDarkly React Native SDK example app
22

3-
To run the example app:
3+
## Quickstart
44

55
1. At the js-core repo root:
66

@@ -28,3 +28,35 @@ yarn && yarn ios-go
2828
# android
2929
yarn && yarn android-release
3030
```
31+
32+
## Running Detox e2e tests
33+
34+
1. Install the required tools on OS X:
35+
36+
```shell
37+
npm install detox-cli --global
38+
brew tap wix/brew
39+
brew install applesimutils
40+
```
41+
42+
2. Detox uses the example app to run tests. The example app needs a mobile key set in an `.env` file
43+
at the same level as this README. Ensure this file exists and add your mobile key to that `.env` file:
44+
45+
```shell
46+
MOBILE_KEY=abcdef12456
47+
```
48+
49+
3. For the above mobile key, ensure two boolean flags exist `my-boolean-flag-1`
50+
and `my-boolean-flag-2` and they evaluate to true for `test-user`. Make sure these flags have client-side SDK availability checked for mobile sdks.
51+
52+
4. In the example folder, on a terminal:
53+
54+
```shell
55+
yarn && yarn expo-prebuild && yarn start
56+
```
57+
58+
5. Still in the example folder but on another terminal:
59+
60+
```shell
61+
yarn detox-ios
62+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** @type {import('@jest/types').Config.InitialOptions} */
2+
module.exports = {
3+
preset: 'react-native',
4+
rootDir: '..',
5+
testMatch: ['<rootDir>/e2e/**/*.test.ts'],
6+
testTimeout: 120000,
7+
maxWorkers: 1,
8+
globalSetup: 'detox/runners/jest/globalSetup',
9+
globalTeardown: 'detox/runners/jest/globalTeardown',
10+
reporters: ['detox/runners/jest/reporter'],
11+
testEnvironment: 'detox/runners/jest/testEnvironment',
12+
verbose: true,
13+
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { by, device, element, expect, waitFor } from 'detox';
2+
3+
describe('Example', () => {
4+
beforeAll(async () => {
5+
await device.launchApp({
6+
newInstance: true,
7+
launchArgs: {
8+
detoxURLBlacklistRegex: '\\("^https://clientstream.launchdarkly.com/meval"\\)',
9+
},
10+
});
11+
});
12+
13+
// For speed, all tests are sequential and dependent.
14+
// beforeEach(async () => {
15+
// await device.reloadReactNative();
16+
// });
17+
18+
test('app loads and renders correctly', async () => {
19+
await expect(element(by.text(/welcome to launchdarkly/i))).toBeVisible();
20+
await expect(element(by.text(/my-boolean-flag-1: false/i))).toBeVisible();
21+
});
22+
23+
test('identify', async () => {
24+
await element(by.id('userKey')).typeText('test-user');
25+
await element(by.text(/identify/i)).tap();
26+
27+
await waitFor(element(by.text(/my-boolean-flag-1: true/i)))
28+
.toBeVisible()
29+
.withTimeout(2000);
30+
});
31+
32+
test('variation', async () => {
33+
await element(by.id('flagKey')).replaceText('my-boolean-flag-2');
34+
await element(by.text(/get flag value/i)).tap();
35+
36+
await waitFor(element(by.text(/my-boolean-flag-2: true/i)))
37+
.toBeVisible()
38+
.withTimeout(2000);
39+
});
40+
});

0 commit comments

Comments
 (0)