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'
|
2021-02-23 04:41:31 -07:00
|
|
|
- 'src/**'
|
|
|
|
- '*.json'
|
2021-03-09 01:45:06 -07:00
|
|
|
- '*.js'
|
|
|
|
- '*.lock'
|
2021-02-23 04:19:07 -07:00
|
|
|
pull_request:
|
|
|
|
paths:
|
2021-02-23 06:29:59 -07:00
|
|
|
- '.github/workflows/validate-js.yml'
|
2021-02-23 04:41:31 -07:00
|
|
|
- 'src/**'
|
|
|
|
- '*.json'
|
2021-03-09 01:45:06 -07:00
|
|
|
- '*.js'
|
|
|
|
- '*.lock'
|
2021-02-23 04:19:07 -07:00
|
|
|
|
2021-02-23 03:58:30 -07:00
|
|
|
jobs:
|
2021-03-12 05:21:46 -07:00
|
|
|
compile:
|
|
|
|
name: Compile JS (tsc)
|
2021-02-23 06:39:54 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-02-23 06:43:23 -07:00
|
|
|
- uses: actions/checkout@v2
|
2021-02-23 06:46:11 -07:00
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
2021-03-08 09:51:47 -07:00
|
|
|
- name: Restore node_modules from cache
|
|
|
|
uses: actions/cache@v2
|
2021-02-23 06:46:11 -07:00
|
|
|
id: yarn-cache
|
2021-02-23 06:43:23 -07:00
|
|
|
with:
|
2021-02-23 06:46:11 -07:00
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
2021-02-23 06:43:23 -07:00
|
|
|
restore-keys: |
|
2021-02-23 06:46:11 -07:00
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
2021-03-08 09:51:47 -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
|
|
|
|
2021-02-23 06:27:16 -07:00
|
|
|
- name: Run TypeScript
|
2021-03-12 05:21:46 -07:00
|
|
|
uses: ypresto/typescript-error-reporter-action@6cb6a970f0783c19f55fb83079f7846a583c7543
|
|
|
|
|
|
|
|
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
|
2021-02-23 06:49:17 -07:00
|
|
|
|
2021-02-23 03:58:30 -07:00
|
|
|
- name: Run ESLint
|
2021-03-08 09:51:47 -07:00
|
|
|
uses: reviewdog/action-eslint@v1
|
|
|
|
with:
|
|
|
|
reporter: github-pr-review
|
|
|
|
eslint_flags: '--ext .js,.ts,.jsx,.tsx src'
|
2021-03-08 11:34:46 -07:00
|
|
|
fail_on_error: true
|
2021-03-12 05:21:46 -07:00
|
|
|
filter_mode: nofilter
|