clash/.github/workflows/go.yml

49 lines
1.4 KiB
YAML
Raw Normal View History

2019-08-15 03:40:40 +00:00
name: Go
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Get latest go version
id: version
run: |
echo ::set-output name=go_version::$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g')
2019-10-14 02:40:00 +00:00
- name: Setup Go
2020-06-04 02:38:30 +00:00
uses: actions/setup-go@v2
2019-08-15 03:40:40 +00:00
with:
go-version: ${{ steps.version.outputs.go_version }}
2019-08-15 03:40:40 +00:00
- name: Check out code into the Go module directory
2020-06-04 02:38:30 +00:00
uses: actions/checkout@v2
2019-11-06 04:05:18 +00:00
- name: Cache go module
2020-06-04 02:38:30 +00:00
uses: actions/cache@v2
2019-11-06 04:05:18 +00:00
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
2019-08-15 03:40:40 +00:00
2020-08-25 14:32:23 +00:00
- name: Get dependencies, run test and static check
2019-08-15 03:40:40 +00:00
run: |
go test ./...
2021-10-10 15:44:09 +00:00
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run --disable-all -E govet -E gofumpt -E megacheck ./...
2019-10-14 02:40:00 +00: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