Skip to content

Commit c585f56

Browse files
author
sam bacha
authored
Create nodejs.yml
1 parent 1eec606 commit c585f56

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/nodejs.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# GitHub Nodejs CI
2+
name: nodejs
3+
4+
on: [push, pull_request]
5+
6+
env:
7+
CI: true
8+
FORCE_COLOR: 2
9+
10+
11+
jobs:
12+
run:
13+
name: Node ${{ matrix.node }} on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
node: ["10.x", "12.x", "14.x"]
20+
os: ["ubuntu-latest"]
21+
22+
steps:
23+
- uses: actions/checkout@v2.3.4
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v2.1.4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
- name: Get yarn cache directory path
29+
id: yarn-cache-dir-path
30+
run: echo "::set-output name=dir::$(yarn cache dir)"
31+
32+
# Cache Optimization
33+
34+
- uses: actions/cache@v2.1.4
35+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
36+
with:
37+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
38+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-yarn-
41+
- name: yarn install, build, and test
42+
run: |
43+
yarn install
44+
env:
45+
CI: true

0 commit comments

Comments
 (0)