CI: sync pipeline with restic

This commit is contained in:
Michael Eischer 2025-02-07 22:31:08 +01:00
parent 9fc5066fc4
commit 82c5a314f9

View file

@ -7,9 +7,13 @@ on:
# run tests for all pull requests # run tests for all pull requests
pull_request: pull_request:
merge_group:
permissions:
contents: read
env: env:
latest_go: "1.21.x" latest_go: "1.23.x"
GO111MODULE: on GO111MODULE: on
jobs: jobs:
@ -17,10 +21,8 @@ jobs:
strategy: strategy:
matrix: matrix:
go: go:
- 1.18.x - 1.23.x
- 1.19.x - 1.22.x
- 1.20.x
- 1.21.x
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Go ${{ matrix.go }} name: Go ${{ matrix.go }}
@ -28,25 +30,21 @@ jobs:
GOPROXY: https://proxy.golang.org GOPROXY: https://proxy.golang.org
steps: steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go }} - name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: ${{ matrix.go }} 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 - name: Build with build.go
run: | run: |
go run build.go --goos linux go run build.go --goos linux
go run build.go --goos windows go run build.go --goos windows
go run build.go --goos darwin go run build.go --goos darwin
- name: Run tests - name: Run local Tests
run: | run: |
go test ./... go test ./...
@ -61,23 +59,25 @@ jobs:
lint: lint:
name: lint name: lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
# allow annotating code in the PR
checks: write
steps: steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go ${{ env.latest_go }} - name: Set up Go ${{ env.latest_go }}
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: ${{ env.latest_go }} go-version: ${{ env.latest_go }}
- name: Check out code
uses: actions/checkout@v4
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v6 uses: golangci/golangci-lint-action@v6
with: with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. # 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 version: v1.63.4
# Optional: show only new issues if it's a pull request. The default value is `false`. args: --verbose --timeout 5m
only-new-issues: true
args: --verbose --timeout 10m
# only run golangci-lint for pull requests, otherwise ALL hints get # only run golangci-lint for pull requests, otherwise ALL hints get
# reported. We need to slowly address all issues until we can enable # reported. We need to slowly address all issues until we can enable
@ -89,3 +89,18 @@ jobs:
echo "check if go.mod and go.sum are up to date" echo "check if go.mod and go.sum are up to date"
go mod tidy go mod tidy
git diff --exit-code go.mod go.sum 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) }}