feat: improve UX when user is on a slow network #302
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ${{ 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/checkout@v4 | |
with: | |
path: react-native-hcaptcha | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: adopt | |
- run: | | |
# npm install -g ${{ matrix.pm }} react-native | |
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=$(cat package.json | jq ".dependencies.\"react-native\"" -r) | |
echo "value=${RN_VERSION}" >> $GITHUB_OUTPUT | |
- 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 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 | |
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 | |
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 |