From 5deb2c7dcb45418008a16c4b9d3cdf481b7e237e Mon Sep 17 00:00:00 2001 From: Clay Miller Date: Wed, 24 Feb 2021 15:19:52 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20Run=20'build'=20workflow=20on=20pull?= =?UTF-8?q?=20requests,=20since=20it=E2=80=99s=20a=20required=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/nodejs.yml | 52 ++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 4990994..0a9967c 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,16 +1,46 @@ name: Build -on: [push] + +on: + pull_request: + push: + branches: + - main + jobs: build: + name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - run: npm install - - run: npm run build - - run: npm test - env: - CI: true + - name: Get sources + uses: actions/checkout@v1 + + - name: Restore npm cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules- + + - name: Use Node.js 14 + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Test + run: npm run test + env: + CI: true