mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
94 lines
2.5 KiB
YAML
94 lines
2.5 KiB
YAML
##
|
|
# Run tests
|
|
##
|
|
name: Tests
|
|
on:
|
|
pull_request:
|
|
push:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Run tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Publish Test Report (canned, also see if two stack)
|
|
uses: ctrf-io/github-test-reporter@v1
|
|
with:
|
|
report-path: 'ctrf-report.json'
|
|
title: 'Unit & Integration Test Results'
|
|
suite-folded-report: true
|
|
|
|
- name: Install Node.js, NPM and Yarn
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v4
|
|
id: cache
|
|
with:
|
|
path: node_modules
|
|
key: node-modules-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
# supposedly our current cache includes native modules like Realm
|
|
# that have compiled binaries specific to the environment where they were installed
|
|
# which might not be the same as the github actions environment
|
|
# so we need to rebuild them
|
|
- name: Rebuild native modules
|
|
if: steps.cache.outputs.cache-hit == 'true'
|
|
run: npm rebuild
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: npm install
|
|
|
|
# Need this for linting Ruby
|
|
- name: Install Ruby and gems
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
bundler-cache: true
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Unit tests
|
|
# run regardless of previous linting / testing steps
|
|
if: ${{ success() || failure() }}
|
|
run: |
|
|
npm run test:unit
|
|
mv artifacts/ctrf-report.json artifacts/unit-ctrf-report.json
|
|
|
|
- name: Integration tests
|
|
# run regardless of previous linting / testing steps
|
|
if: ${{ success() || failure() }}
|
|
run: |
|
|
npm run test:integration
|
|
mv artifacts/ctrf-report.json artifacts/integration-ctrf-report.json
|
|
|
|
- name: Publish Test Report
|
|
if: ${{ success() || failure() }}
|
|
uses: ctrf-io/github-test-reporter@v1
|
|
with:
|
|
report-path: 'artifacts/*.json'
|
|
title: 'Unit & Integration Test Results'
|
|
suite-folded-report: true
|
|
|
|
# notify:
|
|
# name: Notify Slack
|
|
# needs: test
|
|
# if: ${{ success() || failure() }}
|
|
# runs-on: ubuntu-latest
|
|
# steps:
|
|
# - uses: iRoachie/slack-github-actions@v2.3.0
|
|
# if: env.SLACK_WEBHOOK_URL != null
|
|
# env:
|
|
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILDS_WEBHOOK_URL }}
|
|
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|