react-native-vision-camera/.github/workflows/validate-js.yml

113 lines
3.5 KiB
YAML
Raw Permalink Normal View History

2021-02-23 06:29:59 -07:00
name: Validate JS
2021-02-23 04:19:07 -07:00
on:
push:
branches:
2021-02-23 06:00:32 -07:00
- main
2021-02-23 04:19:07 -07:00
paths:
2021-02-23 06:29:59 -07:00
- '.github/workflows/validate-js.yml'
- 'package/src/**'
- 'package/*.json'
- 'package/*.js'
- 'package/*.lock'
- 'package/example/src/**'
- 'package/example/*.json'
- 'package/example/*.js'
- 'package/example/*.lock'
- 'package/example/*.tsx'
2021-02-23 04:19:07 -07:00
pull_request:
paths:
2021-02-23 06:29:59 -07:00
- '.github/workflows/validate-js.yml'
- 'package/src/**'
- 'package/*.json'
- 'package/*.js'
- 'package/*.lock'
- 'package/example/src/**'
- 'package/example/*.json'
- 'package/example/*.js'
- 'package/example/*.lock'
- 'package/example/*.tsx'
2021-02-23 04:19:07 -07:00
2021-02-23 03:58:30 -07:00
jobs:
compile:
name: Compile JS (tsc)
2021-02-23 06:39:54 -07:00
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
2021-02-23 06:39:54 -07:00
steps:
2024-01-31 12:48:10 -07:00
- uses: actions/checkout@v4
2021-02-23 06:46:11 -07:00
2024-01-31 12:48:10 -07:00
- name: Install reviewdog
uses: reviewdog/action-setup@v1
2024-01-31 12:48:10 -07:00
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
2021-02-23 06:46:11 -07:00
2024-01-31 12:48:10 -07:00
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example
2021-02-23 06:49:17 -07:00
2024-01-31 12:48:10 -07:00
- name: Run TypeScript # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
run: |
yarn typescript | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2024-01-31 12:48:10 -07:00
- name: Run TypeScript in example/ # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
run: |
cd example && yarn typescript | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee && cd ..
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
lint:
name: Lint JS (eslint, prettier)
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
steps:
2024-01-31 12:48:10 -07:00
- uses: actions/checkout@v4
2024-01-31 12:48:10 -07:00
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
2024-01-31 12:48:10 -07:00
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example
2021-02-23 06:49:17 -07:00
2024-01-31 12:48:10 -07:00
- name: Run ESLint
run: yarn lint -f @jamesacarr/github-actions
2021-03-12 07:10:44 -07:00
2024-01-31 12:48:10 -07:00
- name: Run ESLint with auto-fix
run: yarn lint --fix
2021-03-12 07:10:44 -07:00
2024-01-31 12:48:10 -07:00
- name: Run ESLint in example/
run: cd example && yarn lint -f @jamesacarr/github-actions && cd ..
2024-01-31 12:48:10 -07:00
- name: Run ESLint in example/ with auto-fix
run: cd example && yarn lint --fix && cd ..
2024-01-31 12:48:10 -07:00
- name: Verify no files have changed after auto-fix
run: git diff --exit-code HEAD