90 lines
1.6 KiB
YAML
90 lines
1.6 KiB
YAML
|
name: Go
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
branches: [ main ]
|
||
|
pull_request:
|
||
|
branches: [ main ]
|
||
|
|
||
|
jobs:
|
||
|
|
||
|
test:
|
||
|
name: Test
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
|
||
|
- name: Set up Go 1.x
|
||
|
uses: actions/setup-go@v2
|
||
|
with:
|
||
|
go-version: ^1.16
|
||
|
|
||
|
- name: Check out code into the Go module directory
|
||
|
uses: actions/checkout@v2
|
||
|
|
||
|
- name: Test code
|
||
|
run: make test
|
||
|
|
||
|
vet:
|
||
|
name: Vet
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
|
||
|
- name: Set up Go 1.x
|
||
|
uses: actions/setup-go@v2
|
||
|
with:
|
||
|
go-version: ^1.16
|
||
|
|
||
|
- name: Check out code into the Go module directory
|
||
|
uses: actions/checkout@v2
|
||
|
|
||
|
- name: Vet code
|
||
|
run: go vet ./...
|
||
|
|
||
|
format:
|
||
|
name: Format
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
|
||
|
- name: Set up Go 1.x
|
||
|
uses: actions/setup-go@v2
|
||
|
with:
|
||
|
go-version: ^1.16
|
||
|
|
||
|
- name: Check out code into the Go module directory
|
||
|
uses: actions/checkout@v2
|
||
|
|
||
|
- name: Set Git user
|
||
|
run: |
|
||
|
git config --local user.email "action@github.com"
|
||
|
git config --local user.name "GitHub Action"
|
||
|
|
||
|
- name: Format code
|
||
|
run: gofmt -l -w -s .
|
||
|
|
||
|
- name: Commit and push changes
|
||
|
run: |
|
||
|
git add .
|
||
|
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
|
||
|
git commit -m "[Action] go fmt" -a
|
||
|
git push
|
||
|
fi
|
||
|
|
||
|
build:
|
||
|
name: Build
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
|
||
|
- name: Set up Go 1.x
|
||
|
uses: actions/setup-go@v2
|
||
|
with:
|
||
|
go-version: ^1.16
|
||
|
|
||
|
- name: Check out code into the Go module directory
|
||
|
uses: actions/checkout@v2
|
||
|
|
||
|
- name: Build
|
||
|
run: make TAGS=production
|
||
|
|
||
|
|
||
|
# vim: set et ts=2 sw=2:
|