react-native-vision-camera/.github/workflows/validate-js.yml
Marc Rousavy a2293e858d
fix: Fix TypeScript relative imports (#358)
* fix: Fix TypeScript relative imports

* Decouple `example` from tsconfig

* fix ESLint config

* add lint-ci script

* move example running to workflow

* test ts

* test eslint

* test ts

* fix ESLint formatter

* Revert "fix ESLint formatter"

This reverts commit 21aca0dcdb54d4ce98b33d2b4f1decc18bc82e85.

* Revert "test ts"

This reverts commit becc346ad3d097b7d3570ebc8b5bf80390aadf87.

* Revert "test eslint"

This reverts commit 9c9f0b81bf3aa57188f550a34b2a8151e364f3b0.

* Revert "test ts"

This reverts commit 3cbe7200608910087b43e0d9cdae0917b0b4215e.
2021-08-16 10:45:41 +02:00

107 lines
3.1 KiB
YAML

name: Validate JS
on:
push:
branches:
- main
paths:
- '.github/workflows/validate-js.yml'
- 'src/**'
- '*.json'
- '*.js'
- '*.lock'
- 'example/src/**'
- 'example/*.json'
- 'example/*.js'
- 'example/*.lock'
- 'example/*.tsx'
pull_request:
paths:
- '.github/workflows/validate-js.yml'
- 'src/**'
- '*.json'
- '*.js'
- '*.lock'
- 'example/src/**'
- 'example/*.json'
- 'example/*.js'
- 'example/*.lock'
- 'example/*.tsx'
jobs:
compile:
name: Compile JS (tsc)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install reviewdog
uses: reviewdog/action-setup@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example
- 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 }}
- 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
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example
- name: Run ESLint
run: yarn lint -f @jamesacarr/github-actions
- name: Run ESLint with auto-fix
run: yarn lint --fix
- name: Run ESLint in example/
run: cd example && yarn lint -f @jamesacarr/github-actions && cd ..
- name: Run ESLint in example/ with auto-fix
run: cd example && yarn lint --fix && cd ..
- name: Verify no files have changed after auto-fix
run: git diff --exit-code HEAD