lint, type-check を GitHub Actions で実行 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check and Lint | |
on: pull_request | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- uses: actions/cache@v3 | |
id: node_modules_cache_id | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
- run: echo '${{ toJSON(steps.node_modules_cache_id.outputs) }}' | |
- if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }} | |
run: npm install | |
type-check: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- uses: actions/cache@v3 | |
id: node_modules_cache_id | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
- run: echo '${{ toJSON(steps.node_modules_cache_id.outputs) }}' | |
- if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }} | |
run: npm install | |
- name: Build app | |
run: npm run build | |
- name: Run type-check | |
run: npm run type-check | |
lint: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- uses: actions/cache@v3 | |
id: node_modules_cache_id | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
- run: echo '${{ toJSON(steps.node_modules_cache_id.outputs) }}' | |
- if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }} | |
run: npm run install | |
- name: Run lint | |
run: npm run lint |