diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fdd0199 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Build + +on: + push: + branches: [master] + pull_request: + branches: [master] + types: [opened, reopened, synchronize] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23' + + - name: Prepare + run: | + make init + make linter + make proto + + - name: Install dependencies + run: go get . + + - name: Build + run: make build \ No newline at end of file diff --git a/Makefile b/Makefile index ebab51d..cb91304 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,6 @@ ifeq ($(OS),Windows_NT) PROTOBUF_INSTALL_CMD = choco install protoc endif -windows: - go mod tidy - go build -o main.exe cmd/main.go - init: $(PROTOBUF_INSTALL_CMD) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0 @@ -19,15 +15,14 @@ init: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.35.2 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1 -proto: - protoc --go_out=. --go-grpc_out=. agent/agent.proto api/api.proto cluster/cluster.proto multipass/multipass.proto - - linter: go mod tidy fieldalignment -fix ./... golangci-lint run -c .golangci.yml --timeout=5m -v --fix +proto: + protoc --go_out=. --go-grpc_out=. agent/agent.proto api/api.proto cluster/cluster.proto multipass/multipass.proto + build: go build cmd/main.go