-
Notifications
You must be signed in to change notification settings - Fork 32
48 lines (43 loc) · 1.39 KB
/
node.js.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Create Env File
run: touch isCI
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn test
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# 如果不加以下这行,发起 pr 后触发的 ci 拿到的 commit message 是“Merge ... into ...”而不是提交代码时输入的 commit message。
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: yarn
- name: commitlint
run: echo $(git log --format=%B -n 1) | npx commitlint --verbose
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: yarn
- run: yarn lint