From 2d87d22ca161bf30e5a39466fcf079603a5e1dc5 Mon Sep 17 00:00:00 2001 From: Guangming Luo Date: Thu, 8 Aug 2024 19:43:06 +0800 Subject: [PATCH 1/2] build: update CI and optimze efficiency --- .github/workflows/pr-check.yml | 32 +++++++++++++++++++---- .github/workflows/tests.yml | 46 ++++++++++++++------------------- .github/workflows/vulncheck.yml | 4 +-- 3 files changed, 48 insertions(+), 34 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 16f214ef0..539295808 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -11,18 +11,21 @@ jobs: - name: Check License Header uses: apache/skywalking-eyes/header@v0.4.0 - - name: typos-action + - name: Check Spell uses: crate-ci/typos@master staticcheck: runs-on: [ self-hosted, X64 ] steps: - - uses: actions/checkout@v3 - + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.21 + go-version: stable + # For self-hosted, the cache path is shared across projects + # and it works well without the cache of github actions + # Enable it if we're going to use Github only + cache: false - uses: reviewdog/action-staticcheck@v1 with: @@ -35,3 +38,22 @@ jobs: fail_on_error: true # Set staticcheck flags staticcheck_flags: -checks=inherit,-SA1029,-SA5008 + + lint: + runs-on: [ self-hosted, X64 ] + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + # for self-hosted, the cache path is shared across projects + # and it works well without the cache of github actions + # Enable it if we're going to use Github only + cache: false + + - name: Golangci Lint + # https://golangci-lint.run/ + uses: golangci/golangci-lint-action@v6 + with: + version: latest \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1098aa013..9f6f9b2d8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,39 +6,33 @@ jobs: compat-test: strategy: matrix: - version: ["1.17", "1.18"] + version: ["1.17", "1.18", "1.19"] runs-on: [self-hosted, X64] steps: - - uses: actions/checkout@v3 - + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.version }} + cache: false # don't use cache for self-hosted runners # Just build tests without running them - name: Build Test run: go test -run=nope ./... - lint-and-ut: + unit-ut: strategy: matrix: - version: ["1.19", "1.20", "1.21", "1.22"] + version: ["1.20", "1.21", "1.22"] runs-on: [self-hosted, X64] steps: - - uses: actions/checkout@v3 - + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.version }} + cache: false # don't use cache for self-hosted runners - - name: Golangci Lint - # https://golangci-lint.run/ - uses: golangci/golangci-lint-action@v3 - with: - version: latest - skip-cache: true - name: Unit Test run: go test -race -covermode=atomic -coverprofile=coverage.txt ./... @@ -48,15 +42,15 @@ jobs: ut-windows: strategy: matrix: - version: ["1.19", "1.20", "1.21", "1.22"] + version: ["1.20", "1.21", "1.22"] runs-on: windows-latest steps: - - uses: actions/checkout@v3 - + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.version }} + cache: false # don't use cache for self-hosted runners - name: Unit Test run: go test -race -covermode=atomic ./... @@ -64,13 +58,12 @@ jobs: hz-test-unix: strategy: matrix: - version: [ '1.21' ] + version: stable runs-on: [ self-hosted, X64 ] steps: - - uses: actions/checkout@v3 - + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.version }} @@ -93,13 +86,12 @@ jobs: hz-test-windows: strategy: matrix: - version: [ '1.21'] + version: stable runs-on: windows-latest steps: - - uses: actions/checkout@v3 - + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.version }} diff --git a/.github/workflows/vulncheck.yml b/.github/workflows/vulncheck.yml index 9b88498b9..6cbeff848 100644 --- a/.github/workflows/vulncheck.yml +++ b/.github/workflows/vulncheck.yml @@ -22,9 +22,9 @@ jobs: uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: "stable" + go-version: stable check-latest: true cache: false From 8906337e4c0bd8c08c047ffc9197705e81f47dbe Mon Sep 17 00:00:00 2001 From: Guangming Luo Date: Thu, 8 Aug 2024 19:56:04 +0800 Subject: [PATCH 2/2] fix go version in test.yml --- .github/workflows/pr-check.yml | 5 +---- .github/workflows/tests.yml | 13 ++++--------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 539295808..a9c318f53 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -47,10 +47,7 @@ jobs: uses: actions/setup-go@v5 with: go-version: stable - # for self-hosted, the cache path is shared across projects - # and it works well without the cache of github actions - # Enable it if we're going to use Github only - cache: false + cache: false # don't use cache for self-hosted runners - name: Golangci Lint # https://golangci-lint.run/ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9f6f9b2d8..7c97b982e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ jobs: - name: Build Test run: go test -run=nope ./... - unit-ut: + unit-test: strategy: matrix: version: ["1.20", "1.21", "1.22"] @@ -56,16 +56,14 @@ jobs: run: go test -race -covermode=atomic ./... hz-test-unix: - strategy: - matrix: - version: stable runs-on: [ self-hosted, X64 ] steps: - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ matrix.version }} + go-version: stable + cache: false # don't use cache for self-hosted runners - name: Setup Environment run: | @@ -84,16 +82,13 @@ jobs: hz-test-windows: - strategy: - matrix: - version: stable runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ matrix.version }} + go-version: stable - name: Get changed files id: changed-files