Skip to content

Commit 566f33a

Browse files
committed
Lint and test on pull request
1 parent a55e2cd commit 566f33a

File tree

3 files changed

+55
-3
lines changed

3 files changed

+55
-3
lines changed

.github/workflows/build-and-publish.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
name: Build
2-
on: [push]
2+
on:
3+
push:
4+
branches:
5+
- master
36
jobs:
47
build:
58
runs-on: ubuntu-latest
69
steps:
7-
- uses: actions/checkout@v1
10+
- uses: actions/checkout@v2
11+
- name: cache node modules
12+
uses: actions/cache@v1
13+
env:
14+
cache-name: cache-node-modules
15+
with:
16+
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
17+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('vueapp/package-lock.json') }}
18+
restore-keys: |
19+
${{ runner.os }}-${{ env.cache-name }}-
820
- name: npm install
9-
run: cd vueapp && npm i && cd ../
21+
run: cd vueapp && npm ci && cd ../
1022
- name: lint
1123
run: cd vueapp && npm run lint && cd ../
1224
- name: production build

.github/workflows/pull-request.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Pull Request
2+
on:
3+
pull_request:
4+
types: [opened, edited, synchronize, reopened]
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: cache node modules
11+
uses: actions/cache@v1
12+
env:
13+
cache-name: cache-node-modules
14+
with:
15+
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
16+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('vueapp/package-lock.json') }}
17+
restore-keys: |
18+
${{ runner.os }}-${{ env.cache-name }}-
19+
- name: npm install
20+
run: cd vueapp && npm ci && cd ../
21+
- name: check linting passes
22+
run: cd vueapp && npm run lint:nofix && cd ../
23+
test:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: cache node modules
28+
uses: actions/cache@v1
29+
env:
30+
cache-name: cache-node-modules
31+
with:
32+
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
33+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('vueapp/package-lock.json') }}
34+
restore-keys: |
35+
${{ runner.os }}-${{ env.cache-name }}-
36+
- name: npm install
37+
run: cd vueapp && npm ci && cd ../
38+
- name: unit tests
39+
run: cd vueapp && npm run test:unit && cd ../

vueapp/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"build": "vue-cli-service build",
88
"test:unit": "vue-cli-service test:unit",
99
"lint": "vue-cli-service lint",
10+
"lint:nofix": "vue-cli-service lint --no-fix --max-warnings 0",
1011
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
1112
},
1213
"dependencies": {

0 commit comments

Comments
 (0)