Skip to content

Commit 7d4f8f6

Browse files
authored
chore: add github actions (#15)
1 parent 1afae39 commit 7d4f8f6

File tree

5 files changed

+135
-6
lines changed

5 files changed

+135
-6
lines changed

.github/workflows/nodejs.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- master
11+
pull_request:
12+
branches:
13+
- main
14+
- master
15+
schedule:
16+
- cron: '0 2 * * *'
17+
18+
jobs:
19+
build:
20+
runs-on: ${{ matrix.os }}
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
node-version: [16.x]
26+
os: [ubuntu-latest]
27+
28+
steps:
29+
- name: Checkout Git Source
30+
uses: actions/checkout@v2
31+
32+
- name: Use Node.js ${{ matrix.node-version }}
33+
uses: actions/setup-node@v1
34+
with:
35+
node-version: ${{ matrix.node-version }}
36+
37+
- name: Install Dependencies
38+
run: npm i -g npminstall && npminstall
39+
40+
- name: Continuous Integration
41+
run: npm run ci
42+
43+
- name: Code Coverage
44+
uses: codecov/codecov-action@v1
45+
with:
46+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Actions Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ${{ matrix.os }}
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
node-version: [16.x]
15+
os: [ubuntu-latest]
16+
17+
steps:
18+
- name: Checkout Git Source
19+
uses: actions/checkout@v2
20+
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
26+
- name: Install Dependencies
27+
run: npm i -g npminstall && npminstall
28+
29+
- name: Continuous integration
30+
run: |
31+
run: npm run ci
32+
33+
- name: Semantic Release
34+
run: |
35+
npm run semantic-release
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# react-cnode
1+
# React-CNode.js
22

3-
CNode 社区 React 版本
3+
> Frontend Powered By React For CNode.js
44
55
## Getting Started
66

@@ -13,5 +13,5 @@ $ yarn
1313
Start the dev server,
1414

1515
```bash
16-
$ yarn start
16+
$ yarn dev
1717
```

package.json

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
{
2-
"private": true,
2+
"name": "react-cnode",
3+
"description": "Frontend Powered By React For CNode.js",
4+
"version": "development",
5+
"private": false,
6+
"license": "MIT",
37
"scripts": {
48
"dev": "umi dev",
59
"build": "umi build",
610
"postinstall": "umi generate tmp",
711
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
12+
"ci": "npm run test",
813
"test": "umi-test",
9-
"test:coverage": "umi-test --coverage"
14+
"test:coverage": "umi-test --coverage",
15+
"semantic-release": "semantic-release"
1016
},
1117
"gitHooks": {
1218
"pre-commit": "lint-staged"
@@ -19,6 +25,37 @@
1925
"prettier --parser=typescript --write"
2026
]
2127
},
28+
"ci": {
29+
"type": "github",
30+
"os": {
31+
"github": "linux"
32+
},
33+
"version": "16.x"
34+
},
35+
"release": {
36+
"branche": "master",
37+
"tagFormat": "${version}",
38+
"plugins": [
39+
"@semantic-release/commit-analyzer",
40+
"@semantic-release/release-notes-generator",
41+
[
42+
"@semantic-release/changelog",
43+
{
44+
"changelogFile": "History.md"
45+
}
46+
],
47+
[
48+
"@semantic-release/github",
49+
{
50+
"assets": {
51+
"path": "dist",
52+
"label": "Assets Distribution"
53+
},
54+
"addReleases": "bottom"
55+
}
56+
]
57+
]
58+
},
2259
"dependencies": {
2360
"dotenv": "^10.0.0",
2461
"react": "17.x",
@@ -30,7 +67,9 @@
3067
"@ant-design/pro-layout": "^6.32.1",
3168
"@ant-design/pro-list": "^1.21.12",
3269
"@ant-design/pro-table": "^2.61.9",
70+
"@semantic-release/changelog": "^6.0.1",
3371
"@types/dotenv": "^8.2.0",
72+
"@types/jest": "^27.4.0",
3473
"@types/markdown-it": "^12.2.3",
3574
"@types/react": "^17.0.0",
3675
"@types/react-dom": "^17.0.0",
@@ -40,12 +79,14 @@
4079
"@umijs/test": "^3.5.20",
4180
"ahooks": "^3.1.3",
4281
"dayjs": "^1.10.7",
82+
"egg-ci": "^1.19.0",
4383
"lint-staged": "^10.0.7",
4484
"markdown-it": "^12.3.0",
4585
"prettier": "^2.2.0",
4686
"react-markdown-editor-lite": "^1.3.2",
87+
"semantic-release": "^18.0.1",
4788
"typescript": "^4.1.2",
4889
"umi": "^3.5.20",
4990
"yorkie": "^2.0.0"
5091
}
51-
}
92+
}

tests/util.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('util.test.ts', () => {
2+
it('demo', () => {
3+
expect(10).toEqual(10);
4+
});
5+
});

0 commit comments

Comments
 (0)