From 249b85721b795a5bf21ab8c23cd47dcbbd6a038e Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Fri, 9 May 2025 15:56:06 -0400 Subject: [PATCH] [CONFIG] [Github Actions] lint and test actions splitted --- .github/workflows/go-lint.yml | 52 +++++++++++++++++++++++ .github/workflows/{go.yml => go-test.yml} | 13 ------ 2 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/go-lint.yml rename .github/workflows/{go.yml => go-test.yml} (72%) diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml new file mode 100644 index 0000000..80581fb --- /dev/null +++ b/.github/workflows/go-lint.yml @@ -0,0 +1,52 @@ +--- +name: Go CI Tests + +on: # yamllint disable-line rule:truthy + push: + branches: ["main"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["main"] + workflow_dispatch: + +env: + LOG_LEVEL: WARN + +jobs: + lint: + name: "Go CI LINT" + strategy: + fail-fast: false + matrix: + os: ["windows-2022", "ubuntu-24.04", "macos-14"] + go: ["1.22.x", "1.23.x", "1.24.x"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + check-latest: false + + - run: go version + + - name: Test Styling (gofmt) + run: gofmt -l . && echo '✔ Your code looks good.' + + # yamllint disable rule:line-length + - name: Test Styling (analysis/modernize) Analyzer modernize + if: ${{ ! startsWith(matrix.go, '1.22') }} + run: go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test ./... + # yamllint enable rule:line-length + + - name: Lint (go vet) + run: go vet -v ./... + + - name: Lint golangci-lint + uses: golangci/golangci-lint-action@v8 + with: + args: --timeout=10m + version: v2.1.0 + skip-cache: true diff --git a/.github/workflows/go.yml b/.github/workflows/go-test.yml similarity index 72% rename from .github/workflows/go.yml rename to .github/workflows/go-test.yml index dff5a2d..36abc47 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go-test.yml @@ -35,19 +35,6 @@ jobs: - name: Build run: go build -v ./... - - name: Lint (gofmt) - run: gofmt -l . && echo '✔ Your code looks good.' - - - name: Lint (go vet) - run: go vet -v ./... - - - name: Lint golangci-lint - uses: golangci/golangci-lint-action@v8 - with: - args: --timeout=10m - version: v2.1.0 - skip-cache: true - - name: Test run: | go test -v -coverprofile="coverage.out" ./exercises/...