mirror of
https://github.com/safing/portbase
synced 2026-04-30 12:50:06 +00:00
Migrate to go-modules and add github action
This commit is contained in:
parent
69177a3968
commit
75691f8782
8 changed files with 371 additions and 450 deletions
85
.github/workflows/go.yml
vendored
Normal file
85
.github/workflows/go.yml
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
name: Go
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Linter
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '^1.15'
|
||||
|
||||
# nektos/act does not have sudo install but we need it on GH actions so
|
||||
# try to install it.
|
||||
- name: Install sudo
|
||||
run: bash -c "apt-get update || true ; apt-get install sudo || true"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Install git and gcc
|
||||
run: sudo bash -c "apt-get update && apt-get install -y git gcc libc6-dev"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Get dependencies
|
||||
run: go mod download
|
||||
|
||||
- name: Run go vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: Install golint
|
||||
run: bash -c "GOBIN=$(pwd) go get -u golang.org/x/lint/golint"
|
||||
|
||||
- name: Run golint
|
||||
run: ./golint -set_exit_status -min_confidence 1.0 ./...
|
||||
|
||||
- name: Run gofmt
|
||||
run: bash -c "test -z $(gofmt -s -l .)"
|
||||
|
||||
- name: Run golangci-lint
|
||||
uses: golangci/golangci-lint-action@v1
|
||||
with:
|
||||
version: v1.26
|
||||
args: -c ./.golangci.yml
|
||||
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '^1.15'
|
||||
|
||||
# nektos/act does not have sudo install but we need it on GH actions so
|
||||
# try to install it.
|
||||
- name: Install sudo
|
||||
run: bash -c "apt-get update || true ; apt-get install sudo || true"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Install git and gcc
|
||||
run: sudo bash -c "apt-get update && apt-get install -y git gcc libc6-dev"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get dependencies
|
||||
run: go mod download
|
||||
|
||||
- name: Test
|
||||
run: ./test full --test-only
|
||||
Loading…
Add table
Add a link
Reference in a new issue