Bump minimum go version to 1.22 #377
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
# run tests on push to master, but not when other branches are pushed to | |
push: | |
branches: | |
- master | |
# run tests for all pull requests | |
pull_request: | |
merge_group: | |
permissions: | |
contents: read | |
env: | |
latest_go: "1.23.x" | |
GO111MODULE: on | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go: | |
- 1.23.x | |
- 1.22.x | |
runs-on: ubuntu-latest | |
name: Go ${{ matrix.go }} | |
env: | |
GOPROXY: https://proxy.golang.org | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Build with build.go | |
run: | | |
go run build.go --goos linux | |
go run build.go --goos windows | |
go run build.go --goos darwin | |
- name: Run local Tests | |
run: | | |
go test ./... | |
- name: Check changelog files with calens | |
run: | | |
echo "install calens" | |
go install github.com/restic/calens@latest | |
echo "check changelog files" | |
calens | |
lint: | |
name: lint | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
# allow annotating code in the PR | |
checks: write | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ env.latest_go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.latest_go }} | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | |
version: v1.63.4 | |
args: --verbose --timeout 5m | |
# only run golangci-lint for pull requests, otherwise ALL hints get | |
# reported. We need to slowly address all issues until we can enable | |
# linting the master branch :) | |
if: github.event_name == 'pull_request' | |
- name: Check go.mod/go.sum | |
run: | | |
echo "check if go.mod and go.sum are up to date" | |
go mod tidy | |
git diff --exit-code go.mod go.sum | |
analyze: | |
name: Analyze results | |
needs: [test, lint] | |
if: always() | |
permissions: # no need to access code | |
contents: none | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe | |
with: | |
jobs: ${{ toJSON(needs) }} |