1
0
Fork 0
datetime.link/.github/workflows/build.yml

91 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2020-10-31 01:12:08 +08:00
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:
2021-11-16 12:25:06 +08:00
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Test code
run: make test
2020-10-31 01:18:17 +08:00
vet:
name: Vet
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
2021-11-16 12:25:06 +08:00
go-version: ^1.17
2020-10-31 01:18:17 +08:00
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Vet code
2020-11-10 19:44:58 +08:00
run: go vet ./...
2020-10-31 01:18:17 +08:00
format:
name: Format
2020-10-31 01:12:08 +08:00
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
2021-11-16 12:25:06 +08:00
go-version: ^1.17
2020-10-31 01:12:08 +08:00
- 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
2020-11-10 19:50:58 +08:00
run: gofmt -l -w -s .
2020-10-31 01:12:08 +08:00
- name: Commit and push changes
id: commit-dockerfiles
run: |
git add .
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
2021-11-16 12:25:06 +08:00
git commit -m 'style: `go fmt`' -a
2020-10-31 01:12:08 +08:00
git push
fi
2020-10-31 01:18:17 +08:00
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
2021-11-16 12:25:06 +08:00
go-version: ^1.17
2020-10-31 01:18:17 +08:00
- name: Check out code into the Go module directory
uses: actions/checkout@v2
2020-10-31 01:12:08 +08:00
- name: Build
run: make TAGS=production
2020-11-08 00:57:43 +08:00
# vim: set et ts=2 sw=2: