Skip to content

Commit

Permalink
chore: update CI and optimze efficiency (#1168)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuangmingLuo authored Aug 9, 2024
1 parent 226f0e8 commit a64f390
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 40 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ jobs:
- name: Check License Header
uses: apache/skywalking-eyes/[email protected]

- 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:
Expand All @@ -35,3 +38,19 @@ 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
cache: false # don't use cache for self-hosted runners

- name: Golangci Lint
# https://golangci-lint.run/
uses: golangci/golangci-lint-action@v6
with:
version: latest
53 changes: 20 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-test:
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 ./...

Expand All @@ -48,31 +42,28 @@ 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 ./...

hz-test-unix:
strategy:
matrix:
version: [ '1.21' ]
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 }}
go-version: stable
cache: false # don't use cache for self-hosted runners

- name: Setup Environment
run: |
Expand All @@ -91,17 +82,13 @@ jobs:
hz-test-windows:
strategy:
matrix:
version: [ '1.21']
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 }}
go-version: stable

- name: Get changed files
id: changed-files
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/vulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a64f390

Please sign in to comment.