Skip to content

Commit 6fc8c43

Browse files
authored
Merge pull request #43 from closetool/master
fix: add github action
2 parents 01aca29 + 7f5ee00 commit 6fc8c43

File tree

5 files changed

+86
-22
lines changed

5 files changed

+86
-22
lines changed

.github/workflows/ci.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Go
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
test:
8+
runs-on: ubuntu-latest
9+
10+
services:
11+
mysql:
12+
image: mysql
13+
env:
14+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
15+
MYSQL_DATABASE: casbin
16+
ports:
17+
- 3306:3306
18+
postgres:
19+
image: postgres
20+
env:
21+
POSTGRES_PASSWORD: postgres
22+
options: >-
23+
--health-cmd pg_isready
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
ports:
28+
- 5432:5432
29+
30+
steps:
31+
- name: Set up Go
32+
uses: actions/setup-go@v2
33+
with:
34+
go-version: 1.14
35+
36+
- uses: actions/checkout@v2
37+
- name: Run Unit tests
38+
run: go test -v -coverprofile=profile.cov ./...
39+
40+
- name: Install goveralls
41+
env:
42+
GO111MODULE: off
43+
run: go get github.com/mattn/goveralls
44+
45+
- name: Send coverage
46+
env:
47+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: goveralls -coverprofile=profile.cov -service=github
49+
50+
semantic-release:
51+
needs: [test]
52+
runs-on: ubuntu-latest
53+
steps:
54+
55+
- uses: actions/checkout@v2
56+
57+
- name: Run semantic-release
58+
if: github.repository == 'casbin/xorm-adapter' && github.event_name == 'push'
59+
run: |
60+
npm install --save-dev [email protected]
61+
npx semantic-release
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.releaserc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"debug": true,
3+
"branches": [
4+
"+([0-9])?(.{+([0-9]),x}).x",
5+
"master",
6+
{
7+
"name": "beta",
8+
"prerelease": true
9+
}
10+
],
11+
"plugins": [
12+
"@semantic-release/commit-analyzer",
13+
"@semantic-release/release-notes-generator",
14+
"@semantic-release/github"
15+
]
16+
}
17+

.travis.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Xorm Adapter
2-
[![Build Status](https://travis-ci.org/casbin/xorm-adapter.svg?branch=master)](https://travis-ci.org/casbin/xorm-adapter)
2+
[![Go](https://github.com/casbin/xorm-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/casbin/xorm-adapter/actions/workflows/ci.yml)
33
[![Coverage Status](https://coveralls.io/repos/github/casbin/xorm-adapter/badge.svg?branch=master)](https://coveralls.io/github/casbin/xorm-adapter?branch=master)
44
[![Go Report Card](https://goreportcard.com/badge/github.com/casbin/xorm-adapter)](https://goreportcard.com/report/github.com/casbin/xorm-adapter)
55
[![Godoc](https://godoc.org/github.com/casbin/xorm-adapter?status.svg)](https://godoc.org/github.com/casbin/xorm-adapter)

adapter_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,19 @@ func TestAdapters(t *testing.T) {
305305
// testSaveLoad(t, "mysql", "root:@tcp(127.0.0.1:3306)/abc", true)
306306

307307
testSaveLoad(t, "mysql", "root:@tcp(127.0.0.1:3306)/")
308-
testSaveLoad(t, "postgres", "user=postgres host=127.0.0.1 port=5432 sslmode=disable")
308+
testSaveLoad(t, "postgres", "user=postgres password=postgres host=127.0.0.1 port=5432 sslmode=disable")
309309

310310
testAutoSave(t, "mysql", "root:@tcp(127.0.0.1:3306)/")
311-
testAutoSave(t, "postgres", "user=postgres host=127.0.0.1 port=5432 sslmode=disable")
311+
testAutoSave(t, "postgres", "user=postgres password=postgres host=127.0.0.1 port=5432 sslmode=disable")
312312

313313
testFilteredPolicy(t, "mysql", "root:@tcp(127.0.0.1:3306)/")
314314

315315
testAddPolicies(t, "mysql", "root:@tcp(127.0.0.1:3306)/")
316-
testAddPolicies(t, "postgres", "user=postgres host=127.0.0.1 port=5432 sslmode=disable")
316+
testAddPolicies(t, "postgres", "user=postgres password=postgres host=127.0.0.1 port=5432 sslmode=disable")
317317

318318
testRemovePolicies(t, "mysql", "root:@tcp(127.0.0.1:3306)/")
319-
testRemovePolicies(t, "postgres", "user=postgres host=127.0.0.1 port=5432 sslmode=disable")
319+
testRemovePolicies(t, "postgres", "user=postgres password=postgres host=127.0.0.1 port=5432 sslmode=disable")
320320

321321
testUpdatePolicies(t, "mysql", "root:@tcp(127.0.0.1:3306)/")
322-
testUpdatePolicies(t, "postgres", "user=postgres host=127.0.0.1 port=5432 sslmode=disable")
322+
testUpdatePolicies(t, "postgres", "user=postgres password=postgres host=127.0.0.1 port=5432 sslmode=disable")
323323
}

0 commit comments

Comments
 (0)