Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade buf and goreleaser #495

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

13 changes: 13 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Raystack takes the security of our software products and services seriously.

If you believe you have found a security vulnerability in this project, you can report it to us directly using [private vulnerability reporting][].

- Include a description of your investigation of the this project's codebase and why you believe an exploit is possible.
- POCs and links to code are greatly encouraged.
- Such reports are not eligible for a bounty reward.

**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**

Thanks for helping make GitHub safe for everyone.

[private vulnerability reporting]: https://github.com/raystack/meteor/security/advisories
18 changes: 2 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ jobs:
fetch-depth: 0
- run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "stable"
cache: true
go-version-file: "go.mod"
- name: Get release tag
id: get_version
uses: battila7/get-version-action@v2
Expand All @@ -29,16 +28,3 @@ jobs:
distribution: goreleaser
version: ~v2
args: --snapshot --clean
- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Images
run: docker push docker.io/raystack/meteor:latest
23 changes: 0 additions & 23 deletions .github/workflows/build_dev.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: docs

name: Docs
on:
push:
branches:
Expand All @@ -11,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-node@v2
- name: Installation
uses: bahmutov/npm-install@v1
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
name: lint

name: Lint
on:
push:
branches:
- main
paths:
- "**.go"
- go.mod
- go.sum
pull_request:
paths:
- "**.go"
- go.mod
- go.sum

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.20"
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run linter
uses: golangci/golangci-lint-action@v3
go-version-file: "go.mod"

- name: Run checks
uses: golangci/golangci-lint-action@v6
with:
version: v1.53
version: v1.60
args: --timeout=5m
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: release

name: Release
on:
push:
tags:
Expand All @@ -18,8 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable"
cache: true
go-version-file: "go.mod"
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down
30 changes: 13 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Test

on:
push:
pull_request:
Expand All @@ -10,12 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.20'
cache: true
go-version-file: "go.mod"
- name: Install dependencies
run: sudo apt-get install build-essential
- name: Run Test
Expand All @@ -32,12 +30,12 @@ jobs:
plugins: ${{ steps.set-matrix.outputs.plugins }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- id: set-matrix
run: |
echo "plugins=$(find plugins -mindepth 2 -maxdepth 2 -type d | sed 's/plugins\///' | awk 'BEGIN{printf "["} {printf "%s\"%s\"",sep,$0; sep=","} END{print ",\".\"]"}')" >> $GITHUB_OUTPUT

plugins-test:
plugins:
needs: pretest
runs-on: ubuntu-latest
if: |
Expand All @@ -49,12 +47,11 @@ jobs:
plugins: ${{ fromJson(needs.pretest.outputs.plugins) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.20'
cache: true
go-version-file: "go.mod"
- name: Install dependencies
run: sudo apt-get install build-essential
- name: Run Test
Expand All @@ -67,15 +64,14 @@ jobs:

coverage:
runs-on: ubuntu-latest
needs: [test, plugins-test]
needs: [test, plugins]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.20'
cache: true
go-version-file: "go.mod"
- name: Download coverage
uses: actions/download-artifact@v3
with:
Expand All @@ -89,4 +85,4 @@ jobs:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go install github.com/mattn/[email protected]
goveralls -coverprofile=$(ls -1 coverage*.out | paste -sd "," -) -service=github
goveralls -coverprofile=$(ls -1 coverage*.out | paste -sd "," -) -service=github
22 changes: 6 additions & 16 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,26 @@ before:
- make clean

changelog:
use: github
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^build:"
exclude: ["^docs:", "^test:", "^build:", "^refactor:", "^style:", "^chore:"]

builds:
- main: ./main.go
id: "linux"
binary: meteor
flags: [-a]
ldflags:
- -X github.com/raystack/meteor/cmd.Version={{.Tag}}
- -X github.com/raystack/meteor/cmd.BuildCommit={{.FullCommit}}
- -X github.com/raystack/meteor/cmd.BuildDate={{.Date}}
goos: ["linux", "windows", "darwin"]
goarch: [amd64, arm64] # skip goarch 386 and arm due to conflicts with "github.com/blastrain/vitess-sqlparser" library
goarch: [amd64, arm64] # Skip goarch 386 and arm due to conflicts with "github.com/blastrain/vitess-sqlparser" library
env:
- CGO_ENABLED=0
ignore: # skip goarch 386 and arm due to conflicts with "github.com/blastrain/vitess-sqlparser" library
- goos: linux
goarch: 386
ignore:
- goos: linux
goarch: arm
- goos: windows
goarch: 386
- goos: windows
goarch: arm

Expand All @@ -51,7 +44,7 @@ checksum:
name_template: "checksums.txt"

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

dockers:
- goos: linux
Expand All @@ -69,10 +62,7 @@ nfpms:
description: "Metadata collection tool."
homepage: https://github.com/raystack/meteor
license: Apache 2.0
formats:
- deb
- rpm
- apk
formats: [deb, rpm, apk]

scoops:
- homepage: "https://github.com/raystack/meteor"
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME="github.com/raystack/meteor"
VERSION=$(shell git describe --always --tags 2>/dev/null)
COVERFILE="/tmp/app.coverprofile"
PROTON_COMMIT := "42b77358cbb68335607e99794f729e4a558974a5"
PROTON_COMMIT := "ae895e033f71df187c62d7cf9431a2e259ddd423"
.PHONY: all build clean test

all: build
Expand All @@ -28,20 +28,20 @@ test-plugins:
@echo " > Testing plugins with tag 'plugins'"
go test $(if $(filter .,$(PLUGIN)),./plugins,$(if $(PLUGIN),./plugins/$(PLUGIN)/...,./plugins/...)) -tags=plugins -coverprofile=coverage-plugins$(subst .,root,$(subst /,-,$(if $(PLUGIN),-$(PLUGIN),))).out -parallel=1

test-coverage: # test test-plugins
test-coverage:
cp coverage.out coverage-all.out
tail -n +2 coverage-plugins.out >> coverage-all.out
go tool cover -html=coverage-all.out

generate-proto: ## regenerate protos
generate-proto:
@echo " > cloning protobuf from raystack/proton"
@echo " > generating protobuf"
@buf generate --template buf.gen.yaml https://github.com/raystack/proton/archive/${PROTON_COMMIT}.zip#strip_components=1 --path raystack/assets/v1beta2
@echo " > protobuf compilation finished"

lint: ## Lint with golangci-lint
lint:
golangci-lint run

install: ## install required dependencies
install:
@echo "> installing dependencies"
go install github.com/vektra/mockery/[email protected]
4 changes: 2 additions & 2 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: v1
version: v2
plugins:
- name: go
- remote: buf.build/protocolbuffers/go:v1.31.0
out: models
opt: paths=source_relative
2 changes: 1 addition & 1 deletion cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func InfoProccCmd() *cobra.Command {

func inform(typ string, summary string, err error) error {
if err != nil {
fmt.Println(term.Redf("ERROR:"), term.Redf(err.Error()))
fmt.Println(term.Redf("ERROR: %s", err.Error()))
fmt.Println(term.Bluef("\nUse 'meteor list %s' for the list of supported %s.", typ, typ))
return nil
}
Expand Down
Loading
Loading