diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88397c03..bfe48098 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,9 +3,33 @@ name: Build on: [push, pull_request] jobs: + + go-tests: + name: Running Go tests + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_DATABASE: casdoor + MYSQL_ROOT_PASSWORD: 123456 + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '^1.16.5' + - name: Tests + run: | + go test -v $(go list ./...) -tags skipCi + working-directory: ./ + frontend: name: Front-end runs-on: ubuntu-latest + needs: [ go-tests ] steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 @@ -14,10 +38,10 @@ jobs: - run: yarn install && CI=false yarn run build working-directory: ./web - backend: name: Back-end runs-on: ubuntu-latest + needs: [ go-tests ] steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 diff --git a/object/syncer_user_test.go b/object/syncer_user_test.go index 58ab63a9..a2665b50 100644 --- a/object/syncer_user_test.go +++ b/object/syncer_user_test.go @@ -1,5 +1,4 @@ // Copyright 2021 The casbin Authors. All Rights Reserved. -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -11,6 +10,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +build !skipCi package object @@ -21,11 +21,10 @@ import ( func TestGetUsers(t *testing.T) { InitConfig() - syncers := GetSyncers("admin") syncer := syncers[0] syncer.initAdapter() - users := syncer.getOriginalUsers() + users, _ := syncer.getOriginalUsers() for _, user := range users { fmt.Printf("%v\n", user) } diff --git a/xlsx/xlsx_test.go b/xlsx/xlsx_test.go index 5383b902..df0a6a2d 100644 --- a/xlsx/xlsx_test.go +++ b/xlsx/xlsx_test.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +build !skipCi package xlsx @@ -19,4 +20,4 @@ import "testing" func TestReadSheet(t *testing.T) { ticket := ReadXlsxFile("../../tmpFiles/example") println(ticket) -} +} \ No newline at end of file