From f37c5b35575423fdcaeb6f744efe9a359ca7a5c7 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 2 Apr 2024 14:10:03 +0800 Subject: [PATCH] ci: refactor CI workflows and update actions - Update GitHub Actions to use newer versions (checkout to v4, codeql-action to v3, setup-go to v5, goreleaser-action to v5, golangci-lint-action to v4, codecov-action to v4) - Remove specific Go version pinning in favor of using the version specified in go.mod - Enable checking for the latest Go version in setup-go action - Replace `release --rm-dist` argument with `release --clean` in goreleaser action - Reorder steps and remove redundant checkout step in testing workflow Signed-off-by: Bo-Yi Wu --- .github/workflows/codeql.yml | 6 +++--- .github/workflows/docker.yml | 12 ++++++------ .github/workflows/goreleaser.yml | 16 ++++++++-------- .github/workflows/testing.yml | 19 +++++++++++-------- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1f1b0d7..f3ceec8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -51,4 +51,4 @@ jobs: # queries: ./path/to/local/query, your-org/your-repo/queries@main - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 872469f..360174b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,14 +14,14 @@ jobs: build-docker: runs-on: ubuntu-latest steps: - - name: Setup go - uses: actions/setup-go@v4 - with: - go-version: "^1.21" - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 with: - fetch-depth: 0 + go-version-file: go.mod + check-latest: true - name: Build binary run: | diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index c843afa..d8f7008 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -12,21 +12,21 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: "^1" + go-version-file: go.mod + check-latest: true - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d692934..a5ee73b 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -8,14 +8,17 @@ jobs: lint: runs-on: ubuntu-latest steps: - - name: Setup go - uses: actions/setup-go@v4 - with: - go-version: "^1.21" - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + check-latest: true + - name: Setup golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: version: latest args: --verbose @@ -32,7 +35,7 @@ jobs: options: --sysctl net.ipv6.conf.all.disable_ipv6=0 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: setup sshd server run: | @@ -44,4 +47,4 @@ jobs: make test - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4