From 4510df0907ca7f33d58dcb9ac6b5b66da50213ad Mon Sep 17 00:00:00 2001 From: Kyle Xiao Date: Mon, 11 Nov 2024 18:13:58 +0800 Subject: [PATCH] ci: updated the latest conf and use supported Go versions --- .github/workflows/pr-check.yml | 47 ++++++++++++++++++----------- .github/workflows/release-check.yml | 25 --------------- 2 files changed, 30 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/release-check.yml diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 798696ea..ff3e6863 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -6,13 +6,8 @@ jobs: compatibility-test: strategy: matrix: - go: [ 1.15, 1.22 ] - # - "ubuntu-latest" is for Linux with X64 CPU, hosted by GitHub, - # fewer CPUs but high speed international network - # - "ARM64" is for Linux with ARM64 CPU, hosted by bytedance, - # more CPUs but inside CN internet which may download go cache slowly. - # GitHub don't have free runner with ARM CPU. - os: [ ubuntu-latest, ARM64 ] + go: [ 1.18, 1.23 ] + os: [ X64, ARM64 ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -20,10 +15,12 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} + cache: false - name: Unit Test run: go test -timeout=2m -v -race -covermode=atomic -coverprofile=coverage.out ./... - name: Benchmark run: go test -bench=. -benchmem -run=none ./... + windows-test: runs-on: windows-latest steps: @@ -31,22 +28,38 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.22 + go-version: stable - name: Build Test run: go vet -v ./... - style-test: + + compliant: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: 1.16 + - name: Check License Header uses: apache/skywalking-eyes/header@v0.4.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Lint - run: | - test -z "$(gofmt -s -l .)" - go vet -stdmethods=false $(go list ./...) + + - name: Check Spell + uses: crate-ci/typos@v1.13.14 + + golangci-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 diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml deleted file mode 100644 index 0e75ca1e..00000000 --- a/.github/workflows/release-check.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Release Check - -on: - pull_request: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Check Source Branch - run: python2 -c "exit(0 if '${{ github.head_ref }}'.startswith('release') or '${{ github.head_ref }}'.startswith('hotfix') else 1)" - - - name: Check Version - run: | - # get version code, runner not support grep -E here - SOURCE_VERSION=`grep 'Version\s*=\s*\"v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\"' *.go | awk -F '\"' '{print $(NF-1)}'` - git checkout main - MASTER_VERSION=`grep 'Version\s*=\s*\"v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\"' *.go | awk -F '\"' '{print $(NF-1)}'` - git checkout ${{Head.SHA}} - # check version update - python2 -c "exit(0 if list(map(int,'${SOURCE_VERSION#v}'.split('.')[:3])) > list(map(int,'${MASTER_VERSION#v}'.split('.')[:3])) else 1)"