Skip to content

Commit ad597ae

Browse files
authored
Create GitHub action for CI (#30)
1 parent d96a8bd commit ad597ae

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI Shariff-Plus
2+
3+
on:
4+
push:
5+
branches: [ "develop" ]
6+
pull_request:
7+
branches: [ "develop" ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
npm:
15+
name: Install JS/CSS dependencies
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: latest
22+
- uses: actions/cache@v4
23+
id: cache-npm
24+
with:
25+
path: node_modules
26+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json', 'src/**') }}
27+
- name: Run npm ci
28+
if: steps.cache-npm.outputs.cache-hit != 'true'
29+
run: npm ci
30+
31+
test:
32+
name: Check Javascript & CSS code style and run test
33+
runs-on: ubuntu-latest
34+
needs: [npm]
35+
steps:
36+
- uses: actions/checkout@v5
37+
- uses: actions/setup-node@v4
38+
with:
39+
node-version: latest
40+
- uses: actions/cache/restore@v4
41+
with:
42+
path: node_modules
43+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json', 'src/**') }}
44+
- name: Check code style and run unit test
45+
run: npm run test
46+
47+
build:
48+
name: Build distribution
49+
runs-on: ubuntu-latest
50+
needs: [npm]
51+
steps:
52+
- uses: actions/checkout@v5
53+
- uses: actions/setup-node@v4
54+
with:
55+
node-version: latest
56+
- uses: actions/cache/restore@v4
57+
with:
58+
path: node_modules
59+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json', 'src/**') }}
60+
- name: Run build
61+
run: npm run build

0 commit comments

Comments
 (0)