Skip to content

Node.js CI - Test Upcoming #136

Node.js CI - Test Upcoming

Node.js CI - Test Upcoming #136

name: Node.js CI - Test Upcoming
on:
push:
branches:
# Treat the below branches as special case for working on workflows
- actions-**
- upcoming-**
schedule:
# run this Action every 14 days
- cron: "0 * */14 * *"
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-18.04
strategy:
matrix:
node-version: [12.x]
steps:
- name: Checkout Source Files
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set Environment variables
run: |
cp sample.env .env
echo 'SHOW_UPCOMING_CHANGES=true' >> .env
cat .env
- name: Lint Source Files
run: |
npm ci
npm run ensure-env --if-present
npm run lint --if-present
test:
name: Test
needs: lint
runs-on: ubuntu-18.04
strategy:
matrix:
node-version: [12.x]
steps:
- name: Checkout Source Files
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set Environment variables
run: |
cp sample.env .env
echo 'SHOW_UPCOMING_CHANGES=true' >> .env
cat .env
- name: Install Dependencies
run: |
npm ci
npm run ensure-env --if-present
- name: Run Tests
run: npm test