Skip to content

Commit

Permalink
add ci for ut (#34)
Browse files Browse the repository at this point in the history
Signed-off-by: gang.liu <[email protected]>
  • Loading branch information
izturn authored Aug 24, 2023
1 parent 670075f commit fb0d913
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 19 deletions.
67 changes: 49 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,64 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

name: Contour plugin CI
on:
push:
branches: [ "main" ]
branches:
- "main"
pull_request:
branches: [ "main" ]
branches:
- "main"
env:
GOLANG_VERSION: '1.21'

jobs:
unit-tests:
name: Unit tests running
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GOLANG_VERSION }}

build:
- name: Checkout code
uses: actions/[email protected]

- name: Unit tests running
run: |
go test -v ./...
linting:
name: Go code linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Checkout code
uses: actions/[email protected]

- name: Lint
# https://golangci-lint.run/
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --issues-exit-code=0 --timeout 10m
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --verbose --timeout 6m

build:
name: Build creation
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Build
run: make build
- name: Checkout code
uses: actions/[email protected]

- name: Build creation
run: |
go build -v
2 changes: 1 addition & 1 deletion pkg/plugin/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var testHandshake = goPlugin.HandshakeConfig{
}

func TestRunSuccessfully(t *testing.T) {
utils.InitLogger()
utils.InitLogger(slog.LevelDebug)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down

0 comments on commit fb0d913

Please sign in to comment.