Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Go

on: [push, pull_request]

jobs:

test:
runs-on: ubuntu-latest

services:
mysql:
image: mysql
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: casbin
ports:
- 3306:3306
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14

- uses: actions/checkout@v2
- name: Run Unit tests
run: go test -v -coverprofile=profile.cov ./...

- name: Install goveralls
env:
GO111MODULE: off
run: go get github.com/mattn/goveralls

- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=profile.cov -service=github

semantic-release:
needs: [test]
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2

- name: Run semantic-release
if: github.repository == 'casbin/xorm-adapter' && github.event_name == 'push'
run: |
npm install --save-dev semantic-release@17.2.4
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"debug": true,
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"master",
{
"name": "beta",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
}

16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Xorm Adapter
[![Build Status](https://travis-ci.org/casbin/xorm-adapter.svg?branch=master)](https://travis-ci.org/casbin/xorm-adapter)
[![Go](https://github.com/casbin/xorm-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/casbin/xorm-adapter/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/casbin/xorm-adapter/badge.svg?branch=master)](https://coveralls.io/github/casbin/xorm-adapter?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/casbin/xorm-adapter)](https://goreportcard.com/report/github.com/casbin/xorm-adapter)
[![Godoc](https://godoc.org/github.com/casbin/xorm-adapter?status.svg)](https://godoc.org/github.com/casbin/xorm-adapter)
Expand Down
10 changes: 5 additions & 5 deletions adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,19 @@ func TestAdapters(t *testing.T) {
// testSaveLoad(t, "mysql", "root:@tcp(127.0.0.1:3306)/abc", true)

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

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

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

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

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

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