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.25.x" GO111MODULE: on jobs: test: strategy: matrix: include: - job_name: Linux go: 1.25.x os: ubuntu-latest check_changelog: true - job_name: Linux (race) go: 1.25.x os: ubuntu-latest test_opts: "-race" - job_name: Linux go: 1.24.x os: ubuntu-latest name: ${{ matrix.job_name }} Go ${{ matrix.go }} runs-on: ${{ matrix.os }} env: GOPROXY: https://proxy.golang.org steps: - name: Check out code uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v6 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 -cover ${{matrix.test_opts}} ./... - name: Check changelog files with calens run: | echo "install calens" go install github.com/restic/calens@latest echo "check changelog files" calens if: matrix.check_changelog 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@v6 - name: Set up Go ${{ env.latest_go }} uses: actions/setup-go@v6 with: go-version: ${{ env.latest_go }} - name: golangci-lint uses: golangci/golangci-lint-action@v9 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v2.4.0 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) }}