From 817ac36ce24af81b05e663a9d4f90e479b76d52a Mon Sep 17 00:00:00 2001 From: John Guo Date: Thu, 19 Dec 2024 10:11:55 +0800 Subject: [PATCH] ci: use latest go version for unit testing cases of contribution components (#4062) --- .github/workflows/ci-main.sh | 3 --- .github/workflows/ci-main.yml | 21 ++++++++++++++------- .github/workflows/ci-sub.yml | 11 ++++++++--- cmd/gf/go.work | 1 - 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci-main.sh b/.github/workflows/ci-main.sh index 7171edab4e6..21891888024 100644 --- a/.github/workflows/ci-main.sh +++ b/.github/workflows/ci-main.sh @@ -1,8 +1,5 @@ #!/usr/bin/env bash -# Define the latest Go version requirement -LATEST_GO_VERSION="1.23" - coverage=$1 # find all path that contains go.mod. diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index ecbd084c67f..888476f77d9 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -28,10 +28,21 @@ concurrency: env: TZ: "Asia/Shanghai" - + # for unit testing cases of some components that only execute on the latest go version. + LATEST_GO_VERSION: "1.23" jobs: code-test: + strategy: + matrix: + # 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥 + # When adding new go version to the list, make sure: + # 1. Update the `LATEST_GO_VERSION` env variable. + # 2. Update the `Report Coverage` action. + # 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥 + go-version: [ "1.20", "1.21", "1.22", "1.23" ] + goarch: [ "386", "amd64" ] + runs-on: ubuntu-20.04 # Service containers to run with `code-test` @@ -185,11 +196,6 @@ jobs: ports: - 2181:2181 - strategy: - matrix: - go-version: [ "1.20", "1.21", "1.22", "1.23" ] - goarch: [ "386", "amd64" ] - steps: # TODO: szenius/set-timezone update to node16 # sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime @@ -256,7 +262,8 @@ jobs: - name: Report Coverage uses: codecov/codecov-action@v4 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + # Only report coverage on the latest go version and amd64 arch + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.go-version == '1.23' && matrix.goarch == 'amd64' }} with: flags: go-${{ matrix.go-version }}-${{ matrix.goarch }} token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/ci-sub.yml b/.github/workflows/ci-sub.yml index 56d9bb6eba3..5b98814ef36 100644 --- a/.github/workflows/ci-sub.yml +++ b/.github/workflows/ci-sub.yml @@ -29,17 +29,22 @@ concurrency: env: TZ: "Asia/Shanghai" - + # for unit testing cases of some components that only execute on the latest go version. + LATEST_GO_VERSION: "1.23" jobs: code-test: - runs-on: ubuntu-latest - strategy: matrix: + # 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥 + # When adding new go version to the list, make sure: + # 1. Update the `LATEST_GO_VERSION` env variable. + # 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥 go-version: [ "1.20", "1.21", "1.22", "1.23" ] goarch: [ "386", "amd64" ] + runs-on: ubuntu-latest + steps: - name: Setup Timezone uses: szenius/set-timezone@v2.0 diff --git a/cmd/gf/go.work b/cmd/gf/go.work index 1fbd6cb9a7c..19bee584aad 100644 --- a/cmd/gf/go.work +++ b/cmd/gf/go.work @@ -16,6 +16,5 @@ replace ( github.com/gogf/gf/contrib/drivers/oracle/v2 => ../../contrib/drivers/oracle github.com/gogf/gf/contrib/drivers/pgsql/v2 => ../../contrib/drivers/pgsql github.com/gogf/gf/contrib/drivers/sqlite/v2 => ../../contrib/drivers/sqlite - github.com/gogf/gf/contrib/drivers/dm/v2 => ../../contrib/drivers/dm github.com/gogf/gf/v2 => ../../ )