Skip to content

feat: add reassure testing to control render count (#95) #419

feat: add reassure testing to control render count (#95)

feat: add reassure testing to control render count (#95) #419

Workflow file for this run

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@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:
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
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: react-native-hcaptcha
- uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: 17
distribution: adopt
- if: contains(matrix.os, 'macos')
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=$(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@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
release:
if: github.event_name == 'release'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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