From aa0187adc6fde5270d79ebe0624197a2971e4477 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 6 Mar 2024 23:46:36 -0700 Subject: [PATCH] Build and test against 1.21 and 1.22 --- .github/workflows/build_and_test.yml | 41 ++++++++++++++-------------- .github/workflows/golangci-lint.yml | 7 +++-- go.mod | 2 +- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 1212169..befb032 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -7,6 +7,7 @@ on: push: tags: branches: + - main pull_request: branches: @@ -19,31 +20,31 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: [ '1.21' ] + go-version: [ '1.21', '1.22' ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go-version }} + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} - - name: Display Go version - run: go version + - name: Display Go version ${{ matrix.go-version }} + run: go version - - name: Install dependencies - run: | - go mod download - go get -t -u golang.org/x/tools/cmd/cover + - name: Install dependencies ${{ matrix.go-version }} + run: | + go get -t -u golang.org/x/tools/cmd/cover + go mod download - - name: Build - run: go build -v ./... + - name: Build ${{ matrix.go-version }} + run: go build -v ./... - - name: Test - run: go test -v -race -coverprofile=coverage.out -covermode=atomic + - name: Test ${{ matrix.go-version }} + run: go test -v -race -coverprofile=coverage.out -covermode=atomic - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Upload coverage reports to Codecov ${{ matrix.go-version }} + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 51d6bbc..00a7701 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -20,7 +20,7 @@ jobs: with: go-version: 'stable' cache: false - - name: golangci-lint + - name: Github-action golangci-lint uses: golangci/golangci-lint-action@v3 with: # Require: The version of golangci-lint to use. @@ -35,7 +35,7 @@ jobs: # # Note: By default, the `.golangci.yml` file should be at the root of the repository. # The location of the configuration file can be changed by using `--config=` - # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 + # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true @@ -52,3 +52,6 @@ jobs: # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. # install-mode: "goinstall" + + - name: Manual golangci-lint + run: golangci-lint run ./... diff --git a/go.mod b/go.mod index 4b49430..490e1ef 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/veqryn/slog-dedup -go 1.21.1 +go 1.21 require modernc.org/b/v2 v2.1.0