Skip to content

Commit 5360e45

Browse files
committed
ci(gh-actions): create CI action for testing and linting
1 parent 2cf826e commit 5360e45

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
check:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: ['10', '12', '14']
12+
name: "[v${{ matrix.node-version }}] lint and test"
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v2-beta
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
# Check if cache exists, based on the hash of the lockfile
24+
- name: Cache node_modules
25+
id: cache-node_modules
26+
uses: actions/cache@v2
27+
with:
28+
path: node_modules
29+
key: ${{ runner.os }}-node-${{matrix.node-version}}-${{ hashFiles('**/package-lock.json') }}
30+
restore-keys: |
31+
${{ runner.os }}-node-${{matrix.node-version}}-
32+
${{ runner.os }}-node-
33+
${{ runner.os }}-
34+
35+
# If there is no cache available, we run npm installation in CI mode
36+
- name: Install dependencies
37+
if: steps.cache-node_modules.outputs.cache-hit != 'true'
38+
run: npm ci
39+
40+
- name: Lint
41+
run: npm run lint
42+
43+
- name: Run tests
44+
run: npm run test
45+
46+
# Build and check if it builds ok.
47+
- name: Build
48+
env:
49+
BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE }}
50+
run: npm run build

0 commit comments

Comments
 (0)