Skip to content

Commit

Permalink
chore: add lint and benchmark to GitHub Actions and update travis
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
  • Loading branch information
nodece committed Jul 16, 2020
1 parent aabe6ce commit 5447225
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
37 changes: 31 additions & 6 deletions .github/workflows/default.yml
Expand Up @@ -16,14 +16,39 @@ jobs:
with:
go-version: ${{ matrix.go }}

- name: Get dependencies
run: go get -v -t -d ./...
- name: Run go test
run: make test

- name: Test
run: go test -v .
benchmark:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ 1.11, 1.12, 1.13, 1.14]
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Test Race
run: go test -race -v .
- name: Run go test bench
run: make benchmark

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

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

- name: golangci-lint
uses: golangci/golangci-lint-action@v1
with:
version: v1.28

semantic-release:
runs-on: ubuntu-latest
Expand Down
16 changes: 16 additions & 0 deletions Makefile
@@ -0,0 +1,16 @@
default: lint test

test:
go test -race -v .

benchmark:
go test -bench=.

lint:
golangci-lint run --verbose

release:
export PATH="$(yarn global bin):$PATH"
yarn global add semantic-release
semantic-release

4 changes: 2 additions & 2 deletions rbac_api_with_domains_test.go
Expand Up @@ -137,8 +137,8 @@ func TestRoleAPIWithDomains(t *testing.T) {
testGetRoles(t, e, []string{}, "non_exist", "domain2")
testGetRolesInDomain(t, e, "non_exist", "domain2", []string{})

e.AddRoleForUserInDomain("alice", "admin", "domain1")
e.DeleteRolesForUserInDomain("bob", "domain1")
_, _ = e.AddRoleForUserInDomain("alice", "admin", "domain1")
_, _ = e.DeleteRolesForUserInDomain("bob", "domain1")

testGetRoles(t, e, []string{"admin"}, "alice", "domain1")
testGetRolesInDomain(t, e, "alice", "domain1", []string{"admin"})
Expand Down

0 comments on commit 5447225

Please sign in to comment.