Skip to content

Commit e81fe63

Browse files
Copilothsluoyz
andcommitted
Rewrite CI scripts and update README badges
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
1 parent 98587a7 commit e81fe63

5 files changed

Lines changed: 40 additions & 34 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Benchmarks
22

33
on: [push, pull_request]
44

5-
permissions:
6-
contents: read
7-
85
jobs:
96
benchmark:
107
runs-on: ubuntu-latest
@@ -13,10 +10,10 @@ jobs:
1310
matrix:
1411
node-version: [^18, ^20]
1512
steps:
16-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v2
1714

1815
- name: Set up Node.js
19-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@v2.1.5
2017
with:
2118
node-version: ${{ matrix.node-version }}
2219

.github/workflows/ci.yml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,32 @@ name: CI
22

33
on: [push, pull_request]
44

5-
permissions:
6-
contents: read
7-
85
jobs:
96
lint:
107
runs-on: ubuntu-latest
118
steps:
12-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v2
1310

1411
- name: Set up Node.js
15-
uses: actions/setup-node@v3
16-
with:
17-
node-version: ^20
12+
uses: actions/setup-node@v2.1.5
1813

1914
- name: Install Dependency
2015
run: yarn install
2116

2217
- name: Run Lint
2318
run: yarn run lint
2419

20+
- name: Run Fix
21+
run: yarn run fmt
22+
2523
coverage:
2624
needs: [lint]
2725
runs-on: ubuntu-latest
28-
permissions:
29-
contents: read
30-
pull-requests: write
3126
steps:
32-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v2
3328

3429
- name: Set up Node.js
35-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v2.1.5
3631
with:
3732
node-version: ^20
3833

@@ -46,15 +41,16 @@ jobs:
4641
uses: coverallsapp/github-action@master
4742
with:
4843
github-token: ${{ secrets.GITHUB_TOKEN }}
44+
parallel: true
4945

5046
test:
5147
needs: [lint]
5248
runs-on: ubuntu-latest
5349
strategy:
5450
matrix:
55-
node: [^20]
51+
node: [^18, ^20]
5652
steps:
57-
- uses: actions/checkout@v3
53+
- uses: actions/checkout@v2
5854

5955
- name: Set up Node.js
6056
uses: actions/setup-node@v3
@@ -67,5 +63,23 @@ jobs:
6763
- name: Run Unit test
6864
run: yarn run test
6965

70-
- name: Run Build
71-
run: yarn run build
66+
semantic-release:
67+
needs: [lint, test, coverage]
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v2
71+
72+
- name: Set up Node.js
73+
uses: actions/setup-node@v3
74+
with:
75+
node-version: ^20
76+
77+
- name: Run semantic-release
78+
if: github.repository == 'casbin/casbin-core' && github.event_name == 'push'
79+
run: |
80+
yarn install
81+
yarn run build
82+
yarn run release
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/platform_test.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Platform Test
22

33
on: [push, pull_request]
44

5-
permissions:
6-
contents: read
7-
85
jobs:
96
reactjs:
107
runs-on: ubuntu-latest
@@ -13,10 +10,10 @@ jobs:
1310
matrix:
1411
node-version: [^20]
1512
steps:
16-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v2
1714

1815
- name: Set up Node.js
19-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@v2.1.5
2017
with:
2118
node-version: ${{ matrix.node-version }}
2219

@@ -39,10 +36,10 @@ jobs:
3936
matrix:
4037
node-version: [^20]
4138
steps:
42-
- uses: actions/checkout@v3
39+
- uses: actions/checkout@v2
4340

4441
- name: Set up Node.js
45-
uses: actions/setup-node@v3
42+
uses: actions/setup-node@v2.1.5
4643
with:
4744
node-version: ${{ matrix.node-version }}
4845

@@ -62,10 +59,10 @@ jobs:
6259
matrix:
6360
node-version: [^20]
6461
steps:
65-
- uses: actions/checkout@v3
62+
- uses: actions/checkout@v2
6663

6764
- name: Set up Node.js
68-
uses: actions/setup-node@v3
65+
uses: actions/setup-node@v2.1.5
6966
with:
7067
node-version: ${{ matrix.node-version }}
7168

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
[![Coverage Status](https://coveralls.io/repos/github/casbin/casbin-core/badge.svg?branch=main)](https://coveralls.io/github/casbin/casbin-core?branch=main)
55
[![NPM version][npm-image]][npm-url]
66
[![NPM download][download-image]][download-url]
7-
[![install size](https://packagephobia.now.sh/badge?p=casbin-core)](https://packagephobia.now.sh/result?p=casbin-core)
8-
[![codebeat badge](https://codebeat.co/badges/c17c9ee1-da42-4db3-8047-9574ad2b23b1)](https://codebeat.co/projects/github-com-casbin-casbin-core-main)
9-
[![Release](https://img.shields.io/github/release/casbin/casbin-core.svg)](https://github.com/casbin/casbin-core/releases/latest)
107
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)
118

129
[npm-image]: https://img.shields.io/npm/v/casbin-core.svg?style=flat-square

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"commit": "git-cz",
2020
"clean": "rimraf lib es dist",
2121
"coverage": "jest --coverage",
22-
"prepare": "husky install"
22+
"prepare": "husky install",
23+
"release": "semantic-release"
2324
},
2425
"devDependencies": {
2526
"@commitlint/cli": "^16.3.0",

0 commit comments

Comments
 (0)