Clash.Meta/.github/workflows/go.yml

45 lines
1.1 KiB
YAML
Raw Normal View History

2019-08-15 11:40:40 +08:00
name: Go
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
2019-10-14 10:40:00 +08:00
- name: Setup Go
2020-06-04 10:38:30 +08:00
uses: actions/setup-go@v2
2019-08-15 11:40:40 +08:00
with:
2021-09-15 20:21:30 +08:00
go-version: 1.17.x
2019-08-15 11:40:40 +08:00
- name: Check out code into the Go module directory
2020-06-04 10:38:30 +08:00
uses: actions/checkout@v2
2019-11-06 12:05:18 +08:00
- name: Cache go module
2020-06-04 10:38:30 +08:00
uses: actions/cache@v2
2019-11-06 12:05:18 +08:00
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
2019-08-15 11:40:40 +08:00
2020-08-25 22:32:23 +08:00
- name: Get dependencies, run test and static check
2019-08-15 11:40:40 +08:00
run: |
go test ./...
2020-08-25 22:32:23 +08:00
go vet ./...
go install honnef.co/go/tools/cmd/staticcheck@latest
2020-08-25 22:32:23 +08:00
staticcheck -- $(go list ./...)
2019-10-14 10:40:00 +08:00
- name: Build
if: startsWith(github.ref, 'refs/tags/')
env:
NAME: clash
BINDIR: bin
run: make -j releases
- name: Upload Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: bin/*
draft: true