Merge pull request #274 from restic/dependabot/go_modules/golang.org/… #317
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: | |
env: | |
latest_go: "1.21.x" | |
GO111MODULE: on | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go: | |
- 1.18.x | |
- 1.19.x | |
- 1.20.x | |
- 1.21.x | |
runs-on: ubuntu-latest | |
name: Go ${{ matrix.go }} | |
env: | |
GOPROXY: https://proxy.golang.org | |
steps: | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
go build ./cmd/rest-server | |
- 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 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 | |
steps: | |
- name: Set up Go ${{ env.latest_go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.latest_go }} | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
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.51 | |
# Optional: show only new issues if it's a pull request. The default value is `false`. | |
only-new-issues: true | |
args: --verbose --timeout 10m | |
# 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 |