-
Notifications
You must be signed in to change notification settings - Fork 21
101 lines (96 loc) · 3.18 KB
/
tests.yaml
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
name: CI
on:
push:
branches: [ master ]
release:
types: [ published ]
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # https://crontab.guru/every-week
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm test
test:
needs: build
runs-on: ubuntu-latest
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 ]
bundle-args: [ '--bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res' ]
include:
- os: macos-latest
platform: ios
pm: npm
bundle-args: --bundle-output ios/main.jsbundle
- os: macos-latest
platform: ios
pm: yarn
bundle-args: --bundle-output ios/main.jsbundle
steps:
- uses: actions/checkout@v4
with:
path: react-native-hcaptcha
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- run: npm run example -- --pm ${{ matrix.pm }}
working-directory: react-native-hcaptcha
- id: rn-version
working-directory: react-native-hcaptcha-example
run: |
RN_VERSION=$(cat package.json | jq ".dependencies.\"react-native\"" -r)
echo "value=${RN_VERSION}" >> $GITHUB_OUTPUT
- run: yarn react-native bundle --entry-file index.js --platform ${{ matrix.platform }} --dev false ${{ matrix.bundle-args }}
working-directory: react-native-hcaptcha-example
- run: cat package.json
working-directory: react-native-hcaptcha-example
- run: yarn test --config ./jest.config.js
working-directory: react-native-hcaptcha-example
- run: npx --yes check-peer-dependencies --yarn --runOnlyOnRootDependencies
working-directory: react-native-hcaptcha-example
create-an-issue:
runs-on: ubuntu-latest
needs: test
if: always() && github.event == 'schedule' && needs.test.result == 'failure'
steps:
- uses: actions/checkout@v4
- 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: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
assignees: CAMOBAP
update_existing: true
filename: .github/examples-issue-template.md
release:
if: github.event_name == 'release'
needs: [test-npm, test-yarn]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: npm release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm ci
npm publish