Skip to content

Commit

Permalink
Merge pull request #20 from Abingcbc/ci
Browse files Browse the repository at this point in the history
fix: ci and semantic release
  • Loading branch information
hsluoyz authored Jan 3, 2022
2 parents 37a5fc0 + 1e09743 commit 3745da0
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 21 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Go

on:
- push
- pull_request

jobs:

test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mysql:
image: mysql
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: casbin_test
ports:
- 3306:3306
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 ./...

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

- uses: actions/checkout@v2
- name: Run semantic-release
if: github.repository == 'casbin/beego-orm-adapter' && github.event_name == 'push'
run: |
npm install --save-dev semantic-release@17.2.4
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
package beegoormadapter

import (
"github.com/casbin/casbin/v2/persist"
"log"
"testing"

"github.com/casbin/casbin/v2"
"github.com/casbin/casbin/v2/persist"
"github.com/casbin/casbin/v2/util"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestAdapters(t *testing.T) {
testAutoSave(t, a)

// Postgres test
a, err = NewAdapter("pg", "postgres", "user=postgres host=127.0.0.1 port=5432 sslmode=disable dbname=casbin_test")
a, err = NewAdapter("pg", "postgres", "user=postgres password=postgres host=127.0.0.1 port=5432 sslmode=disable dbname=postgres")
if err != nil {
t.Fatal(err)
}
Expand All @@ -146,7 +146,7 @@ func TestAdapters(t *testing.T) {
}

func TestRemoveFilteredPolicy(t *testing.T) {
a, err := NewAdapter("default", "mysql", "root:@tcp(127.0.0.1:3306)/casbin_test")
a, err := NewAdapter("remove", "mysql", "root:@tcp(127.0.0.1:3306)/casbin_test")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 3745da0

Please sign in to comment.