Skip to content

Commit a772503

Browse files
buamesbuames
authored andcommitted
ci: Add github actions for test & pull request
1 parent 92d30f8 commit a772503

File tree

3 files changed

+53
-7
lines changed

3 files changed

+53
-7
lines changed

.github/workflows/pr.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: PR
2+
on: pull_request
3+
jobs:
4+
conventional:
5+
name: Conventional Title
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v1
9+
- name: Setup node
10+
uses: actions/setup-node@v1
11+
- name: Install dependencies
12+
run: yarn install --ignore-engines --frozen-lockfile
13+
- name: Validate conventional title
14+
uses: beemojs/conventional-pr-action@v1
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Test
2+
on:
3+
push:
4+
branches:
5+
- '*'
6+
- '*/*'
7+
- '!master'
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
node: [10, 12]
14+
fail-fast: true
15+
name: Jest & EsLint @ Node ${{ matrix.node }}
16+
steps:
17+
- uses: actions/checkout@master
18+
- name: Setup node
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node }}
22+
- name: Install dependencies
23+
run: yarn install --ignore-engines --frozen-lockfile
24+
- name: Build all files
25+
run: yarn run build
26+
- name: Run eslint
27+
run: yarn run lint --quiet
28+
- name: Run test
29+
run: yarn run jest

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@
1010
],
1111
"scripts": {
1212
"prune": "rm -rf ./{,*/,**/*/}{node_modules,coverage,*.lock,*.log,*.tsbuildinfo}",
13-
"build": "ts-node --transpile-only ./build/index.ts",
14-
"test": "jest --colors --logHeapUsage",
15-
"test:coverage": "yarn run jest --coverage",
13+
"build": "ts-node ./build/index.ts",
14+
"test": "yarn build && yarn run lint && yarn run jest",
15+
"jest": "jest --colors --logHeapUsage",
16+
"jest:coverage": "yarn run jest --coverage",
1617
"lint": "eslint . --ext js,ts --max-warnings=0 --report-unused-disable-directives",
17-
"prettier": "prettier \"**/*.{js,ts,md,json}\" --write",
18-
"version:canary": "yarn version --prerelease --preid canary",
19-
"version": "conventional-changelog -p conventional-changelog-beemo -i CHANGELOG.md -s"
18+
"pretty": "prettier \"**/*.{js,ts,md,json}\" --write",
19+
"changelog": "conventional-changelog -p conventional-changelog-beemo -i CHANGELOG.md -s",
20+
"version:canary": "yarn version --prerelease --preid canary"
2021
},
2122
"lint-staged": {
2223
"**/*.{js,ts,md,json}": [
23-
"yarn run prettier"
24+
"yarn run pretty"
2425
],
2526
"**/*.{js,ts}": [
2627
"yarn run lint --fix"

0 commit comments

Comments
 (0)