Skip to content

Commit 5f34e78

Browse files
committed
feat: add native units ci
1 parent 7240b5a commit 5f34e78

File tree

6 files changed

+59
-3
lines changed

6 files changed

+59
-3
lines changed

.github/workflows/callable-get-package-list.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
packages:
77
description: The json encoded package list
88
value: ${{ jobs.get-package-list.outputs.packages }}
9+
nativePackages:
10+
description: The json encoded native package list
11+
value: ${{ jobs.get-package-list.outputs.nativePackages }}
912
jobs:
1013
get-package-list:
1114
name: Get packages list
@@ -31,11 +34,14 @@ jobs:
3134
- name: Dump Package List
3235
if: steps.cache-package-list.outputs.cache-hit != 'true'
3336
run: |
34-
echo "packages=$(yarn lerna ll | egrep -v "lerna|Done|yarn" | jq -R -s -c 'split("\n")[:-1] | map({name: split(" ")[0], path: split(" ")[-1]})')" > package-list.json
37+
yarn lerna ll | egrep -v "lerna|Done|yarn" | jq -R -s -c 'split("\n")[:-1] | map({name: split(" ")[0], path: split(" ")[-1]})' > package-list.json
3538
- name: Get Package List
3639
id: get_package_list
3740
run: |
38-
cat package-list.json >> $GITHUB_OUTPUT
39-
cat package-list.json
41+
echo "packages=$(cat package-list.json)" >> $GITHUB_OUTPUT
42+
# temporarily filter to only packages with runnable tests
43+
echo "nativePackages=$(jq -c 'map(select(.name | test("rtn-passkeys|react-native")))' package-list.json)" >> $GITHUB_OUTPUT
4044
outputs:
4145
packages: ${{ steps.get_package_list.outputs.packages }}
46+
# todo: expand native package list as other tests are made runnable
47+
nativePackages: ${{ steps.get_package_list.outputs.nativePackages }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Native Unit Tests
2+
3+
on: workflow_call
4+
5+
jobs:
6+
get-package-list:
7+
uses: ./.github/workflows/callable-get-package-list.yml
8+
unit_test:
9+
name: Native Unit Test - ${{ matrix.package.name }}
10+
runs-on: macos-latest
11+
needs: get-package-list
12+
strategy:
13+
matrix:
14+
package: ${{ fromJSON(needs.get-package-list.outputs.nativePackages) }}
15+
fail-fast: false
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
19+
with:
20+
path: amplify-js
21+
- name: Setup node and build the repository
22+
uses: ./amplify-js/.github/actions/node-and-build
23+
- name: Run iOS Tests
24+
working-directory: ./amplify-js
25+
env:
26+
TEST_PACKAGE: ${{ matrix.package.name }}
27+
run: |
28+
npx lerna exec --scope $TEST_PACKAGE yarn prepare:ios
29+
npx lerna exec --scope $TEST_PACKAGE yarn test:ios
30+
- name: Run Android Tests
31+
working-directory: ./amplify-js
32+
env:
33+
TEST_PACKAGE: ${{ matrix.package.name }}
34+
run: |
35+
npx lerna exec --scope $TEST_PACKAGE yarn prepare:android
36+
npx lerna exec --scope $TEST_PACKAGE yarn test:android

.github/workflows/callable-release-verification.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
needs:
2626
- prebuild-ubuntu
2727
uses: ./.github/workflows/callable-unit-tests.yml
28+
native-unit-tests:
29+
needs:
30+
- prebuild-macos
31+
uses: ./.github/workflows/callable-native-unit-tests.yml
2832
bundle-size-tests:
2933
needs: prebuild-ubuntu
3034
uses: ./.github/workflows/callable-bundle-size-tests.yml

.github/workflows/pr.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
needs:
2525
- prebuild
2626
uses: ./.github/workflows/callable-unit-tests.yml
27+
native-unit-tests:
28+
needs:
29+
- prebuild
30+
uses: ./.github/workflows/callable-native-unit-tests.yml
2731
bundle-size-tests:
2832
needs: prebuild
2933
uses: ./.github/workflows/callable-bundle-size-tests.yml

packages/rtn-push-notification/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"access": "public"
1212
},
1313
"scripts": {
14+
"prepare:ios": "echo 'no-op'",
15+
"prepare:android": "echo 'no-op'",
1416
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
17+
"test:ios": "echo 'no-op'",
1518
"test:android": "./android/gradlew test -p ./android",
1619
"build-with-test": "npm run clean && npm test && tsc",
1720
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",

packages/rtn-web-browser/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"access": "public"
1212
},
1313
"scripts": {
14+
"prepare:ios": "echo 'no-op'",
15+
"prepare:android": "echo 'no-op'",
1416
"test": "echo 'no-op'",
17+
"test:ios": "echo 'no-op'",
1518
"test:android": "./android/gradlew test -p ./android",
1619
"build-with-test": "npm run clean && npm test && tsc",
1720
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",

0 commit comments

Comments
 (0)