mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
68 lines
1.5 KiB
YAML
68 lines
1.5 KiB
YAML
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:
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
go:
|
|
- 1.14.x
|
|
- 1.15.x
|
|
- 1.16.x
|
|
- 1.17.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@v2
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Check out code
|
|
uses: actions/checkout@v2
|
|
|
|
- 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 ./...
|
|
|
|
lint:
|
|
name: lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v2
|
|
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.41
|
|
args: --verbose --timeout 5m
|
|
|
|
- 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
|