Skip to content

Commit 3c49ce2

Browse files
authored
Merge pull request #37 from Zxilly/master
refactor: Migrate from Travis CI to GitHub Actions
2 parents 7485fd9 + 3a63719 commit 3c49ce2

File tree

7 files changed

+101
-27
lines changed

7 files changed

+101
-27
lines changed

.github/semantic.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Always validate the PR title AND all the commits
2+
titleAndCommits: true

.github/workflows/ci.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: CI
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Set up Node.js
12+
uses: actions/[email protected]
13+
14+
- name: Install Dependency
15+
run: yarn install
16+
17+
- name: Run Lint
18+
run: yarn run lint
19+
20+
- name: Run Fix
21+
run: yarn run fix
22+
23+
coverage:
24+
needs: [ lint ]
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Setup MySQL
30+
uses: mirromutth/[email protected]
31+
with:
32+
mysql database: casbin
33+
mysql root password: password
34+
35+
- name: Set up Node.js
36+
uses: actions/[email protected]
37+
with:
38+
node-version: ^14
39+
40+
- name: Install Dependency
41+
run: yarn install
42+
43+
- name: Run Coverage
44+
run: yarn run coverage
45+
46+
- name: Coveralls
47+
uses: coverallsapp/github-action@master
48+
with:
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
parallel: true
51+
52+
test:
53+
needs: [ lint ]
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
node: [ ^12, ^13, ^14, ^15 ]
58+
steps:
59+
- uses: actions/checkout@v2
60+
61+
- name: Setup MySQL
62+
uses: mirromutth/[email protected]
63+
with:
64+
mysql database: casbin
65+
mysql root password: password
66+
67+
- name: Set up Node.js
68+
uses: actions/[email protected]
69+
with:
70+
node-version: ${{ matrix.node }}
71+
72+
- name: Install Dependency
73+
run: yarn install
74+
75+
- name: Run Unit test
76+
run: yarn run test
77+
78+
semantic-release:
79+
needs: [ lint,test,coverage ]
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v2
83+
84+
- name: Run semantic-release
85+
if: github.repository == 'node-casbin/typeorm-adapter' && github.event_name == 'push'
86+
run: |
87+
yarn install --no-lockfile
88+
yarn run prepublish
89+
yarn run release
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TypeORM Adapter
33
[![NPM version][npm-image]][npm-url]
44
[![NPM download][download-image]][download-url]
55
[![codebeat badge](https://codebeat.co/badges/7b938f17-ac89-4ee9-b3cc-787b5e94720d)](https://codebeat.co/projects/github-com-node-casbin-typeorm-adapter-master)
6-
[![Build Status](https://travis-ci.com/node-casbin/typeorm-adapter.svg?branch=master)](https://travis-ci.com/node-casbin/typeorm-adapter)
6+
[![GitHub Actions](https://github.com/node-casbin/typeorm-adapter/workflows/main/badge.svg)](https://github.com/node-casbin/typeorm-adapter/actions)
77
[![Coverage Status](https://coveralls.io/repos/github/node-casbin/typeorm-adapter/badge.svg?branch=master)](https://coveralls.io/github/node-casbin/typeorm-adapter?branch=master)
88
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/casbin/lobby)
99

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
"typings": "lib/index.d.ts",
77
"scripts": {
88
"precommit": "lint-staged",
9-
"prepublish": "yarn run lint && yarn run test && yarn build",
9+
"prepublish": "yarn run lint && yarn build",
1010
"build": "rimraf lib && tsc",
11+
"coverage": "jest --coverage",
1112
"lint": "tslint \"src/**/*.ts\"",
1213
"fix": "tslint \"src/**/*.ts\" --fix",
13-
"test": "jest --runInBand"
14+
"test": "jest --runInBand",
15+
"release": "npx -p semantic-release -p @semantic-release/git -p @semantic-release/changelog semantic-release"
1416
},
1517
"devDependencies": {
1618
"@types/jest": "^23.3.5",

test/adapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test(
3636
host: 'localhost',
3737
port: 3306,
3838
username: 'root',
39-
password: '',
39+
password: 'password',
4040
database: 'casbin',
4141
dropSchema: true,
4242
});

test/existent-connection-adapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ test(
3737
host: 'localhost',
3838
port: 3306,
3939
username: 'root',
40-
password: '',
40+
password: 'password',
4141
database: 'casbin',
4242
entities: [CasbinRule],
4343
synchronize: true,

0 commit comments

Comments
 (0)