Skip to content

Commit

Permalink
chore: Add CI build (#3)
Browse files Browse the repository at this point in the history
* chore: Add CI build

Signed-off-by: Ce Gao <[email protected]>

* fix: Update

Signed-off-by: Ce Gao <[email protected]>

* Update

Signed-off-by: Ce Gao <[email protected]>

* Update

Signed-off-by: Ce Gao <[email protected]>

* Update

Signed-off-by: Ce Gao <[email protected]>

* fix: Update

Signed-off-by: Ce Gao <[email protected]>
  • Loading branch information
gaocegege authored Jun 21, 2022
1 parent 06b81f4 commit 13b6b27
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 4 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release

on:
push:
tags:
- 'v*'
pull_request:
paths:
- '.github/workflows/release.yml'
- '.goreleaser.yaml'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: setup release environment
run: |-
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env
- name: Run GoReleaser
run: make release
57 changes: 57 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
builds:
- id: linux-build
main: ./cmd/envd-lsp
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
ignore:
- goos: linux
goarch: 386
- id: darwin-build
main: ./cmd/envd-lsp
ldflags:
- -s
env:
- CGO_ENABLED=1
- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64
- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig
- CC=o64-clang
- CXX=o64-clang++
goos:
- darwin
goarch:
- amd64
ignore:
- goos: darwin
goarch: 386
archives:
- id: linux-build
format: binary
builds:
- linux-build
replacements:
linux: Linux
amd64: x86_64
- id: darwin-build
format: binary
builds:
- darwin-build
replacements:
darwin: Darwin
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^build:'
- '^ci:'
- '^docs:'
- '^test:'
- '^chore:'
25 changes: 21 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export SHELL := bash
# It's necessary to set the errexit flags for the bash shell.
export SHELLOPTS := errexit

PACKAGE_NAME := github.com/tensorchord/envd-lsp
GOLANG_CROSS_VERSION ?= v1.17.6

# Project main package location (can be multiple ones).
CMD_DIR := ./cmd

Expand Down Expand Up @@ -95,7 +98,7 @@ export GOFLAGS ?= -count=1
#

# All targets.
.PHONY: help lint test build container push addlicense debug debug-local build-local generate clean test-local addlicense-install mockgen-install pypi-build
.PHONY: help lint test build container push addlicense debug debug-local build-local generate clean test-local addlicense-install release

.DEFAULT_GOAL:=build

Expand Down Expand Up @@ -126,9 +129,6 @@ build-local:
$(CMD_DIR)/$${target}; \
done

pypi-build: clean
@python setup.py sdist bdist_wheel

# It is used by vscode to attach into the process.
debug-local:
@for target in $(TARGETS); do \
Expand Down Expand Up @@ -158,3 +158,20 @@ fmt: ## Run go fmt against code.

vet: ## Run go vet against code.
go vet ./...

release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
-e CGO_ENABLED=1 \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
-w /go/src/$(PACKAGE_NAME) \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --rm-dist
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Language server for envd

A language server for envd, a Python-inspired configuration language.

envd-lsp uses [starlark-lsp](https://github.com/tilt-dev/starlark-lsp/), [go.lsp.dev](https://go.lsp.dev/) and [Tree sitter](https://tree-sitter.github.io/tree-sitter/) as its main dependencies to implement the LSP/JSON-RPC protocol and envd language analysis, respectively.

## Build from source

```
make
```

## CLI

```
NAME:
envd-lsp - language server for envd
USAGE:
envd-lsp [global options] command [command options] [arguments...]
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--address value Address (hostname:port) to listen on
--debug Enable debug logging (default: false)
--help, -h show help (default: false)
--version, -v print the version (default: false)
```

0 comments on commit 13b6b27

Please sign in to comment.