From e96fc30020d162bd22b7c5dfdb4d3bc40db80441 Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Mon, 5 Feb 2024 18:39:18 -0500 Subject: [PATCH 1/3] ci: add Go unit test CI workflow --- .github/workflows/go_test.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/go_test.yml diff --git a/.github/workflows/go_test.yml b/.github/workflows/go_test.yml new file mode 100644 index 00000000..887b0403 --- /dev/null +++ b/.github/workflows/go_test.yml @@ -0,0 +1,22 @@ +name: Go Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '${{ github.workspace }}/go.mod' + + - name: Unit Test + run: go test -v -race ./... From 0edcdb504ef61c695a9a2172dbdbde37f7cca85d Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Mon, 5 Feb 2024 18:44:32 -0500 Subject: [PATCH 2/3] update go version --- .github/workflows/go_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go_test.yml b/.github/workflows/go_test.yml index 887b0403..bfb031c3 100644 --- a/.github/workflows/go_test.yml +++ b/.github/workflows/go_test.yml @@ -13,10 +13,11 @@ jobs: - name: Check out uses: actions/checkout@v3 + # Go uses the toolchain version in go.mod since 1.21 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '${{ github.workspace }}/go.mod' + go-version: '>=1.21.6' - name: Unit Test run: go test -v -race ./... From 50907e7b07670ea807b94ca68e215bf576cfe11b Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Mon, 5 Feb 2024 23:10:33 -0500 Subject: [PATCH 3/3] use go version in go.mod file --- .github/workflows/go_test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/go_test.yml b/.github/workflows/go_test.yml index bfb031c3..4bac5e82 100644 --- a/.github/workflows/go_test.yml +++ b/.github/workflows/go_test.yml @@ -13,11 +13,10 @@ jobs: - name: Check out uses: actions/checkout@v3 - # Go uses the toolchain version in go.mod since 1.21 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '>=1.21.6' + go-version-file: '${{ github.workspace }}/go.mod' - name: Unit Test run: go test -v -race ./...