Merge pull request #697 from NASA-IMPACT/update/yarn- #1385
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: Lint and Test | |
on: [push] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
env: | |
NODE_ENV: test | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Read .nvmrc | |
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | |
id: nvm | |
- name: Use Node.js ${{ steps.nvm.outputs.NVMRC }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ steps.nvm.outputs.NVMRC }} | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install | |
run: yarn install | |
- name: Lint | |
run: yarn lint | |
test: | |
runs-on: ubuntu-latest | |
env: | |
NODE_ENV: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Read .nvmrc | |
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | |
id: nvm | |
- name: Use Node.js ${{ steps.nvm.outputs.NVMRC }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ steps.nvm.outputs.NVMRC }} | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install | |
run: yarn install | |
- name: Test | |
run: yarn test |