mirror of
https://github.com/restic/rest-server.git
synced 2026-09-25 21:41:25 -07:00
Rework CI tests
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
name: Style Checkers
|
|
||||||
on: [push, pull_request]
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Check
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v1
|
|
||||||
with:
|
|
||||||
go-version: 1.15.x
|
|
||||||
id: go
|
|
||||||
|
|
||||||
- name: Install golang-ci
|
|
||||||
run: |
|
|
||||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $HOME/bin latest
|
|
||||||
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
|
|
||||||
- name: Run golang-ci
|
|
||||||
run: |
|
|
||||||
export PATH=$HOME/bin:$PATH
|
|
||||||
golangci-lint run --enable goimports,govet,misspell,stylecheck
|
|
||||||
+43
-12
@@ -1,30 +1,40 @@
|
|||||||
name: Build and tests
|
name: test
|
||||||
on: [push, pull_request]
|
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:
|
jobs:
|
||||||
build:
|
test:
|
||||||
name: Build
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version:
|
go:
|
||||||
- 1.14.x
|
- 1.14.x
|
||||||
- 1.15.x
|
- 1.15.x
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
name: Go ${{ matrix.go }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GOPROXY: https://proxy.golang.org
|
GOPROXY: https://proxy.golang.org
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Set up Go ${{ matrix.go }}
|
||||||
- name: Set up Go ${{ matrix.go-version }}
|
uses: actions/setup-go@v2
|
||||||
uses: actions/setup-go@v1
|
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go-version }}
|
go-version: ${{ matrix.go }}
|
||||||
id: go
|
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
run: |
|
||||||
|
go build ./cmd/rest-server
|
||||||
|
|
||||||
|
- 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
|
||||||
@@ -32,5 +42,26 @@ jobs:
|
|||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
export PATH=$HOME/bin:$PATH
|
|
||||||
go test ./...
|
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.36
|
||||||
|
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||||
|
only-new-issues: true
|
||||||
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user