From 23b4fe9090677ed19892026e458f1ddf2e154aa1 Mon Sep 17 00:00:00 2001 From: yu lin <735122171@qq.com> Date: Sun, 4 Feb 2024 14:57:26 +0800 Subject: [PATCH] Add CI to run Go unit test. (#1035) Signed-off-by: Syulin7 <735122171@qq.com> --- .github/workflows/unittests.yaml | 31 +++++++++++++++++++++++++++++++ Makefile | 3 +++ 2 files changed, 34 insertions(+) create mode 100644 .github/workflows/unittests.yaml diff --git a/.github/workflows/unittests.yaml b/.github/workflows/unittests.yaml new file mode 100644 index 000000000..590daade5 --- /dev/null +++ b/.github/workflows/unittests.yaml @@ -0,0 +1,31 @@ +name: Go Unit Test + +on: + - push + - pull_request + +jobs: + test: + name: Unit-Test + runs-on: ubuntu-latest + env: + GOPATH: ${{ github.workspace }}/go + defaults: + run: + working-directory: ${{ env.GOPATH }}/src/github.com/kubeflow/arena + + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + path: ${{ env.GOPATH }}/src/github.com/kubeflow/arena + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version-file: ${{ env.GOPATH }}/src/github.com/kubeflow/arena/go.mod + + - name: Run Go test + run: | + make test + diff --git a/Makefile b/Makefile index 852f312b8..14cca247c 100644 --- a/Makefile +++ b/Makefile @@ -140,5 +140,8 @@ ifeq ($(GOLANGCI_LINT),) endif golangci-lint run --timeout 5m --go 1.18 ./... +test: + go test ./... -coverprofile cover.out + build-dependabot: python3 hack/create_dependabot.py