From 84058dd97eebbc97522734ed5f2ee5aabd8e107f Mon Sep 17 00:00:00 2001 From: Ali Rahbar <72822222+crypto-a@users.noreply.github.com> Date: Thu, 11 Sep 2025 09:59:44 -0400 Subject: [PATCH 1/8] Add CI build workflow for Go projects --- .github/workflows/ci-build.yaml | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/ci-build.yaml diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml new file mode 100644 index 0000000..e7409eb --- /dev/null +++ b/.github/workflows/ci-build.yaml @@ -0,0 +1,41 @@ +name: CI Build + +on: + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22.x' + cache: true + + - name: Download deps + run: go mod download + + - name: Test + run: go test ./... -v + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22.x' + cache: true + + - name: Golangci-lint + uses: golangci/golangci-lint-action@v6.0.1 + with: + version: v1.59.0 + args: --timeout=5m From b453f74f6bfa9f6ea53af395c944f634d6c3babd Mon Sep 17 00:00:00 2001 From: Ali Rahbar <72822222+crypto-a@users.noreply.github.com> Date: Thu, 11 Sep 2025 11:56:56 -0400 Subject: [PATCH 2/8] Add step to download Go module dependencies --- .github/workflows/ci-build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index e7409eb..968f017 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -33,6 +33,9 @@ jobs: with: go-version: '1.22.x' cache: true + + - name: Download deps + run: go mod download - name: Golangci-lint uses: golangci/golangci-lint-action@v6.0.1 From 5a6ff26c7e7f3b83ccea9779595d0742afafccb3 Mon Sep 17 00:00:00 2001 From: Ali Rahbar <72822222+crypto-a@users.noreply.github.com> Date: Thu, 11 Sep 2025 11:57:34 -0400 Subject: [PATCH 3/8] Update .github/workflows/ci-build.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/ci-build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 968f017..9d549fb 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -33,7 +33,6 @@ jobs: with: go-version: '1.22.x' cache: true - - name: Download deps run: go mod download From c0fe4f0862127296f03967480ea7621f0ca1b481 Mon Sep 17 00:00:00 2001 From: Ali Rahbar <72822222+crypto-a@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:08:35 -0400 Subject: [PATCH 4/8] fix: Update Go version in CI workflow to 1.24.x --- .github/workflows/ci-build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 9d549fb..b9945d2 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -14,7 +14,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22.x' + go-version: '1.24.x' cache: true - name: Download deps @@ -31,7 +31,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22.x' + go-version: '1.24.x' cache: true - name: Download deps run: go mod download From a45f7c5fe46f448861b80b0935cd83939de0cde6 Mon Sep 17 00:00:00 2001 From: Ali Rahbar <72822222+crypto-a@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:13:22 -0400 Subject: [PATCH 5/8] fix: Update golangci-lint action to latest version --- .github/workflows/ci-build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index b9945d2..9cf8a31 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -33,11 +33,12 @@ jobs: with: go-version: '1.24.x' cache: true + - name: Download deps run: go mod download - name: Golangci-lint - uses: golangci/golangci-lint-action@v6.0.1 + uses: golangci/golangci-lint-action@latest with: version: v1.59.0 args: --timeout=5m From 0aa352d8d336cfdb45c8f143c539c9f6e0177f78 Mon Sep 17 00:00:00 2001 From: Ali Rahbar <72822222+crypto-a@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:15:36 -0400 Subject: [PATCH 6/8] fix: Upgrade golangci-lint action to v6.0.1 Update golangci-lint action version and add cache options. --- .github/workflows/ci-build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 9cf8a31..6c441de 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -38,7 +38,10 @@ jobs: run: go mod download - name: Golangci-lint - uses: golangci/golangci-lint-action@latest + uses: golangci/golangci-lint-action@v6.0.1 with: version: v1.59.0 args: --timeout=5m + + skip-pkg-cache: true + skip-build-cache: true From b1d8166272e7fa05eee5826995e50279ae02a827 Mon Sep 17 00:00:00 2001 From: Ali Rahbar <72822222+crypto-a@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:18:29 -0400 Subject: [PATCH 7/8] fix: Refactor CI workflow for golangci-lint update Updated golangci-lint action to version 8 and removed redundant steps. --- .github/workflows/ci-build.yaml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 6c441de..b891f07 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -33,15 +33,8 @@ jobs: with: go-version: '1.24.x' cache: true - - - name: Download deps - run: go mod download - - name: Golangci-lint - uses: golangci/golangci-lint-action@v6.0.1 + - name: golangci-lint + uses: golangci/golangci-lint-action@v8 with: - version: v1.59.0 - args: --timeout=5m - - skip-pkg-cache: true - skip-build-cache: true + version: v2.1 From e433464a7c939a8f9bbe6c373a86c0ad56c162a5 Mon Sep 17 00:00:00 2001 From: Ali Rahbar <72822222+crypto-a@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:22:57 -0400 Subject: [PATCH 8/8] feat: Add CI badge to README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2ff4182..430ab4b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # template-go + +[![CI Build](https://github.com/scadable/template-go/actions/workflows/ci-build.yaml/badge.svg)](https://github.com/scadable/template-go/actions/workflows/ci-build.yaml) + template used for go projects