From e0ea472615b154e427d714ee84dd9170b2cce3cf Mon Sep 17 00:00:00 2001 From: closetool Date: Sat, 17 Apr 2021 15:04:17 +0800 Subject: [PATCH] fix: add github action and semantic release Signed-off-by: closetool --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 13 ----------- README.md | 3 +-- 3 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1661bf1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +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 + + 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 ./... + env: + PG_CONN: postgresql://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable + + semantic-release: + needs: [test] + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v2 + - name: Run semantic-release + uses: go-semantic-release/action@v1 + if: github.repository == 'casbin/casbin-pg-adapter' && github.event_name == 'push' + with: + github-token: ${{ secrets.GH_TOKEN }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fb274b8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go -sudo: false -go: - - 1.13.x - - tip -env: - - PG_CONN=postgresql://postgres:@localhost:5432/postgres?sslmode=disable -services: - - postgresql -before_install: - - go get github.com/mattn/goveralls -script: - - $HOME/gopath/bin/goveralls -service=travis-ci diff --git a/README.md b/README.md index 2f49342..4d9eeee 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Go-pg Adapter -[![Build Status](https://travis-ci.com/casbin/casbin-pg-adapter.svg?branch=master)](https://travis-ci.com/casbin/casbin-pg-adapter) -[![Coverage Status](https://coveralls.io/repos/github/casbin/casbin-pg-adapter/badge.svg?branch=master)](https://coveralls.io/github/casbin/casbin-pg-adapter?branch=master) +[![Go](https://github.com/casbin/casbin-pg-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/casbin/casbin-pg-adapter/actions/workflows/ci.yml) Go-pg Adapter is the [Go-pg](https://github.com/go-pg/pg) adapter for [Casbin](https://github.com/casbin/casbin). With this library, Casbin can load policy from PostgreSQL or save policy to it.