Skip to content

Commit

Permalink
build: update build workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ravisuhag committed Jun 19, 2024
1 parent a9f57c7 commit 3b04ecd
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 57 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/package.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.21"
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_TOKEN }}
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ raccoon
.temp
node_modules
__debug.*
dist
45 changes: 45 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: 2

project_name: raccoon

release:
prerelease: auto

before:
hooks:
- go mod tidy
- make clean

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^build:"

builds:
- id: darwin-amd64
main: ./main.go
binary: raccoon
goos: ["darwin"]
goarch: ["arm"]
env:
- CGO_ENABLED=1

checksum:
name_template: "checksums.txt"

snapshot:
name_template: "{{ .Tag }}-next"

dockers:
- goos: linux
goarch: amd64
ids:
- linux
dockerfile: Dockerfile
image_templates:
- "docker.io/raystack/{{.ProjectName}}:latest"
- "docker.io/raystack/{{.ProjectName}}:{{ .Version }}"
- "docker.io/raystack/{{.ProjectName}}:{{ .Version }}-amd64"
23 changes: 7 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
NAME="github.com/raystack/raccoon"
COMMIT := $(shell git rev-parse --short HEAD)
TAG := "$(shell git rev-list --tags --max-count=1)"
VERSION := "$(shell git describe --tags ${TAG})-next"
BUILD_DIR=dist
PROTON_COMMIT := "ccbf219312db35a934361ebad895cb40145ca235"
PROTON_COMMIT := "a4240deecb8345e0e95261f22288f937422594b7"

.PHONY: all build clean test tidy vet proto setup format generate
.PHONY: all build clean test tidy vet proto setup format

all: clean test build format lint
all: clean test lint build

tidy:
@echo "Tidy up go.mod..."
Expand All @@ -19,19 +16,17 @@ lint: ## Lint checker

clean: tidy ## Clean the build artifacts
@echo "Cleaning up build directories..."
@rm -rf $coverage.out ${BUILD_DIR}
@rm -rf $coverage.out raccoon

proto: ## Generate the protobuf files
@echo "Generating protobuf from raystack/proton"
@echo " [info] make sure correct version of dependencies are installed using 'make install'"
@buf generate https://github.com/raystack/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --template buf.gen.yaml --path raystack/raccoon -v
@cp -R proto/raystack/raccoon/v1beta1/* proto/ && rm -Rf proto/raystack
@buf generate https://github.com/raystack/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --path raystack/raccoon -v
@echo "Protobuf compilation finished"

setup: ## Install required dependencies
@echo "> Installing dependencies..."
go mod tidy
go install github.com/bufbuild/buf/cmd/buf@v1.23.0
go install github.com/bufbuild/buf/cmd/buf@v1.33.0

config: ## Generate the sample config file
@echo "Initializing sample server config..."
Expand All @@ -43,7 +38,7 @@ build: ## Build the raccoon binary
@echo "Build complete"

install:
@echo "Installing Guardian to ${GOBIN}..."
@echo "Installing Raccoon to ${GOBIN}..."
@go install

test: ## Run the tests
Expand All @@ -52,10 +47,6 @@ test: ## Run the tests
test-bench: # run benchmark tests
@go test $(shell go list ./... | grep -v "vendor") -v -bench ./... -run=^Benchmark ]

vendor: ## Update the vendor directory
@echo "Updating vendor directory..."
@go mod vendor

docker-run:
docker compose build
docker compose up -d
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Raccoon

![build workflow](https://github.com/raystack/raccoon/actions/workflows/build.yaml/badge.svg)
![package workflow](https://github.com/raystack/raccoon/actions/workflows/package.yaml/badge.svg)
<!-- ![build workflow](https://github.com/raystack/raccoon/actions/workflows/build.yaml/badge.svg) -->

![release workflow](https://github.com/raystack/raccoon/actions/workflows/release.yaml/badge.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?logo=apache)](LICENSE)
[![Version](https://img.shields.io/github/v/release/raystack/raccoon?logo=semantic-release)](Version)

Expand Down
6 changes: 3 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: v1
version: v2
plugins:
- plugin: buf.build/protocolbuffers/go:v1.31.0
- remote: buf.build/protocolbuffers/go:v1.31.0
out: proto
opt: paths=source_relative
- plugin: buf.build/grpc/go:v1.3.0
- remote: buf.build/grpc/go:v1.3.0
out: proto
opt: paths=source_relative,require_unimplemented_servers=true

0 comments on commit 3b04ecd

Please sign in to comment.