-
Notifications
You must be signed in to change notification settings - Fork 10
87 lines (78 loc) · 2.24 KB
/
ci.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: ci
on: [push, pull_request]
jobs:
fmt_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm run format:check
- run: npm run lint
postgres:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm test -t pg-adapter
mysql_and_mysql2:
runs-on: ubuntu-latest
services:
mysql:
image: bitnami/mysql
ports:
- 3306:3306
env:
MYSQL_DATABASE: casbin
MYSQL_ROOT_PASSWORD: password
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v2
- run: npm i
- run: |
npm test -t mysql-adapter
npm test -t mysql2-adapter
sqlite3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm test -t sqlite3-adapter
mssql:
runs-on: ubuntu-latest
steps:
- name: run sqlserver
env:
SA_PASSWORD: Passw0rd
run: |
docker run --name sqlserver -it -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD='$SA_PASSWORD'' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest
echo 'awaiting sqlserver bootup' && sleep 15
sqlcmd -S 127.0.0.1 -U sa -P $SA_PASSWORD -Q 'CREATE DATABASE casbin'
- uses: actions/checkout@v2
- run: npm i
- run: npm test -t mssql-adapter
finish:
needs: [fmt_lint, postgres, mysql_and_mysql2, sqlite3, mssql]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm i
- run: npm run build
- name: Release
if: github.event_name == 'push' && github.repository == 'node-casbin/basic-adapter'
run: npx semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}