From 4b96a3a0a0f82d97591e0b885fff489792077cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E9=B9=8F=E9=A3=9E?= Date: Sat, 22 Jul 2023 15:34:31 +0800 Subject: [PATCH] chore: github actions --- .github/workflows/go.yml | 47 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 44 ++++++++++++++++++++++++++++++++ README.md | 6 +++++ 3 files changed, 97 insertions(+) create mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..1f841ca --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,47 @@ +name: Go + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.19 + + - name: Test + run: go test -v ./... + + - name: Build with xgo + uses: crazy-max/ghaction-xgo@v2 + with: + xgo_version: latest + go_version: ${{ matrix.go_version }} + dest: build + prefix: thriftls + targets: windows/386,windows/amd64,linux/386,linux/amd64,darwin/386,darwin/amd64 + v: true + x: false + race: false + ldflags: -s -w + buildmode: default + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + title: "Development Build" + files: | + build/thriftls* + + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9a02ecb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: "tagged-release" + +on: + push: + tags: + - "v*" + +jobs: + tagged-release: + name: "Tagged Release" + runs-on: "ubuntu-latest" + + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.19 + + - name: Test + run: go test -v ./... + + - name: Build with xgo + uses: crazy-max/ghaction-xgo@v2 + with: + xgo_version: latest + go_version: ${{ matrix.go_version }} + dest: build + prefix: kubecm + targets: windows/386,windows/amd64,linux/386,linux/amd64,darwin/386,darwin/amd64 + v: true + x: false + race: false + ldflags: -s -w + buildmode: default + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + files: | + build/thriftls* + diff --git a/README.md b/README.md index 465ace1..c8e3f88 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +# thrift language server + +[![Language grade: Go](https://img.shields.io/lgtm/grade/go/g/joyme123/thrift-ls.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/joyme123/thrift-ls/context:go) + +![Go](https://github.com/joyme123/thrift-ls/workflows/Go/badge.svg?branch=main) + ## 调试 这里以 neovim 为例,在配置文件里用 lua 进行设置: