@@ -95,32 +95,84 @@ jobs:
9595 path : react-native-hcaptcha
9696 - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
9797 with :
98- node-version : 22.11.0
99- - uses : actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
98+ node-version : 22
99+ - if : matrix.platform == 'android'
100+ uses : actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
100101 with :
101102 java-version : 17
102103 distribution : adopt
103- - if : contains( matrix.os, 'macos')
104+ - if : matrix.platform == 'ios'
104105 run : sudo xcode-select -s /Applications/Xcode_16.4.app
105- - run : |
106- npm run example -- --pm ${{ matrix.pm }}
106+ - run : npm run example -- --pm ${{ matrix.pm }}
107107 working-directory : react-native-hcaptcha
108108 env :
109109 YARN_ENABLE_IMMUTABLE_INSTALLS : false
110110 - id : rn-version
111111 working-directory : react-native-hcaptcha-example
112112 run : |
113- RN_VERSION=$(cat package.json | jq ".dependencies.\"react-native\"" -r )
113+ RN_VERSION=$(jq -r ".dependencies.\"react-native\"" package.json )
114114 echo "value=${RN_VERSION}" >> $GITHUB_OUTPUT
115- - run : cat package.json
116- working-directory : react-native-hcaptcha-example
117115 - run : yarn test --config ./jest.config.js
118116 working-directory : react-native-hcaptcha-example
119117 - run : npx react-native build-${{ matrix.platform }}
120118 working-directory : react-native-hcaptcha-example
121119 - run : npx --yes check-peer-dependencies --yarn --runOnlyOnRootDependencies
122120 working-directory : react-native-hcaptcha-example
123121
122+ e2e :
123+ needs : build
124+ permissions :
125+ contents : read
126+ runs-on : ${{ matrix.os }}
127+ concurrency :
128+ group : ' e2e-${{ matrix.platform }}-${{ github.head_ref || github.ref_name }}'
129+ cancel-in-progress : true
130+ strategy :
131+ fail-fast : false
132+ matrix :
133+ include :
134+ - os : ubuntu-latest
135+ platform : android
136+ - os : macos-latest
137+ platform : ios
138+ steps :
139+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
140+ - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
141+ with :
142+ node-version : 22
143+ - if : matrix.platform == 'android'
144+ uses : actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
145+ with :
146+ java-version : 17
147+ distribution : adopt
148+ - run : npm install
149+ - name : Generate E2E host app
150+ run : npm run test:e2e:setup -- --pm npm --platform ${{ matrix.platform }}
151+
152+ - if : matrix.platform == 'android'
153+ name : Run Android E2E tests
154+ uses : hCaptcha/hcaptcha-android-sdk/.github/actions/android-emulator-run@dc2e0fc978424322c977b68ae06f8dd54e571e22
155+ with :
156+ target : google_apis
157+ api-level : ' 34'
158+ profile : pixel_7
159+ script : npm run test:e2e:android
160+
161+ - if : matrix.platform == 'ios'
162+ name : Boot iOS simulator
163+ run : xcrun simctl bootstatus "iPhone 16" -b
164+
165+ - if : matrix.platform == 'ios'
166+ name : Run iOS E2E tests
167+ run : npm run test:e2e:ios
168+
169+ - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
170+ if : always()
171+ with :
172+ name : e2e-results-${{ matrix.platform }}
173+ path : __e2e__/__image_snapshots__/
174+ retention-days : 14
175+
124176 create-an-issue :
125177 permissions :
126178 contents : read
0 commit comments