-
Notifications
You must be signed in to change notification settings - Fork 26
204 lines (194 loc) · 6.9 KB
/
Copy pathtests.yaml
File metadata and controls
204 lines (194 loc) · 6.9 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: CI
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # https://crontab.guru/every-week
permissions:
contents: read
jobs:
build:
permissions:
contents: read
actions: write
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: npm install
- run: npm test
- run: npm run lint
- if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: npm run perf:baseline
- if: github.ref == 'refs/heads/master' && github.event_name == 'push'
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: .reassure
key: reassure-baseline-${{ github.sha }}
performance:
permissions:
contents: read
actions: read
issues: write
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: npm install
- uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: cache-reassure
with:
path: .reassure
key: reassure-baseline-${{ github.sha }}
restore-keys: reassure-baseline-
# TODO uncomment after merge to master and remove cache-hit == 'true' below
# fail-on-cache-miss: true
- if: steps.cache-reassure.outputs.cache-hit == 'true'
run: npm run perf:compare
- if: steps.cache-reassure.outputs.cache-hit == 'true'
uses: hCaptcha/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Performance Comparison Report
- if: steps.cache-reassure.outputs.cache-hit == 'true'
uses: hCaptcha/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
edit-mode: replace
body-path: .reassure/output.md
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
test:
needs: build
permissions:
contents: read
runs-on: ${{ matrix.os }}
outputs:
rn-version: ${{ steps.rn-version.outputs.value }}
concurrency:
group: '${{ github.workflow }}-${{ matrix.platform }}-${{ matrix.pm }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
strategy:
fail-fast: false
max-parallel: 5
matrix:
os: [ ubuntu-latest ]
platform: [ android ]
pm: [ npm, yarn ]
include:
- os: macos-latest
platform: ios
pm: npm
- os: macos-latest
platform: ios
pm: yarn
steps:
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: react-native-hcaptcha
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- if: matrix.platform == 'android'
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: 17
distribution: adopt
- if: matrix.platform == 'ios'
run: sudo xcode-select -s /Applications/Xcode_16.4.app
- run: npm run example -- --pm ${{ matrix.pm }}
working-directory: react-native-hcaptcha
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- id: rn-version
working-directory: react-native-hcaptcha-example
run: |
RN_VERSION=$(jq -r ".dependencies.\"react-native\"" package.json)
echo "value=${RN_VERSION}" >> $GITHUB_OUTPUT
- run: yarn test --config ./jest.config.js
working-directory: react-native-hcaptcha-example
- run: npx react-native build-${{ matrix.platform }}
working-directory: react-native-hcaptcha-example
- run: npx --yes check-peer-dependencies --yarn --runOnlyOnRootDependencies
working-directory: react-native-hcaptcha-example
e2e:
needs: build
permissions:
contents: read
runs-on: ${{ matrix.os }}
concurrency:
group: 'e2e-${{ matrix.platform }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: android
- os: macos-latest
platform: ios
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- if: matrix.platform == 'android'
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: 17
distribution: adopt
- run: npm install
- name: Generate E2E host app
run: npm run test:e2e:setup -- --pm npm --platform ${{ matrix.platform }}
- if: matrix.platform == 'android'
name: Run Android E2E tests
uses: hCaptcha/hcaptcha-android-sdk/.github/actions/android-emulator-run@dc2e0fc978424322c977b68ae06f8dd54e571e22
with:
target: google_apis
api-level: '34'
profile: pixel_7
script: npm run test:e2e:android
- if: matrix.platform == 'ios'
name: Boot iOS simulator
run: |
UDID=$(xcrun simctl list devices available --json | \
jq -r '.devices["com.apple.CoreSimulator.SimRuntime.iOS-18-5"][] | select(.name=="iPhone 16") | .udid')
echo "Booting iPhone 16 (iOS 18.5): $UDID"
xcrun simctl bootstatus "$UDID" -b
- if: matrix.platform == 'ios'
name: Run iOS E2E tests
run: npm run test:e2e:ios
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: e2e-results-${{ matrix.platform }}
path: __e2e__/__image_snapshots__/
retention-days: 14
create-an-issue:
permissions:
contents: read
issues: write
runs-on: ubuntu-latest
needs: test
if: always() && github.event_name == 'schedule' && needs.test.result == 'failure'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: |
RN_VERSION="${{ needs.test.outputs.rn-version }}"
GHA_RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo "RN_VERSION=${RN_VERSION}" >> $GITHUB_ENV
echo "GHA_RUN_URL=${GHA_RUN_URL}" >> $GITHUB_ENV
- uses: hCaptcha/create-an-issue@56fdd2d6f960e970fa9d5ca3cf3884b6ba5af477
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
assignees: CAMOBAP
update_existing: true
filename: .github/examples-issue-template.md