Skip to content

Setting up hombrew tap #4

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

Merged
merged 1 commit into from
Oct 28, 2022
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
44 changes: 24 additions & 20 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
name: publish
name: goreleaser

on:
release:
types: [published]
push:
tags:
- "*"

permissions:
contents: write

jobs:
publish:
strategy:
matrix:
go-version: [ 1.15.x ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install Go
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Make all
run: make all
- name: Upload release binaries
uses: alexellis/upload-assets@0.3.0
env:
GITHUB_TOKEN: ${{ github.token }}
go-version: 1.17
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
asset_paths: '["./bin/pprof-exporter*"]'
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.dylib
bin
pprof-exporter*
codeperf*

# Test binary, built with `go test -c`
*.test
Expand Down
32 changes: 32 additions & 0 deletions .goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
builds:
- binary: codeperf
goos:
- darwin
- linux
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
flags:
- -mod=vendor

release:
prerelease: auto

universal_binaries:
- replace: true

brews:
-
name: codeperf
homepage: "https://github.com/codeperfio/codeperf"
tap:
owner: codeperf
name: homebrew-codeperf
commit_author:
name: codeperf.io
email: hello@codeperf.io

checksum:
name_template: 'checksums.txt'
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ifeq ($(GIT_VERSION),)
GIT_VERSION:=$(shell git describe --tags --dirty)
endif

LDFLAGS := "-s -w -X github.com/codeperfio/pprof-exporter/cmd.Version=$(GIT_VERSION) -X github.com/codeperfio/pprof-exporter/cmd.GitCommit=$(GIT_COMMIT)"
LDFLAGS := "-s -w -X github.com/codeperfio/codeperf/cmd.Version=$(GIT_VERSION) -X github.com/codeperfio/codeperf/cmd.GitCommit=$(GIT_COMMIT)"
export GO111MODULE=on
SOURCE_DIRS = cmd main.go

Expand Down Expand Up @@ -38,12 +38,11 @@ lint:
.PHONY: dist
dist:
mkdir -p bin/
rm -rf bin/pprof-exporter*
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/pprof-exporter
CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/pprof-exporter-darwin
GOARM=6 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/pprof-exporter-armhf
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/pprof-exporter-arm64
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/pprof-exporter.exe
rm -rf bin/codeperf*
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/codeperf
CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/codeperf-darwin
GOARM=6 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/codeperf-armhf
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/codeperf-arm64

.PHONY: hash
hash:
Expand Down
14 changes: 7 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 codeperf.io <hello@codeperf.io>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -43,12 +43,12 @@ var longDescription = ` __ ____ _
\___/\____/\__,_/\___/ .___/\___/_/ /_/ (_) /_/\____/
/_/

Export and persist Go's profiling data locally, or into https://codeperf.io for FREE.`
Export and persist Go's profiling data locally, or into https://codeperf.io.`

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "pprof-exporter",
Short: "Export and persist Go's profiling data locally, or into https://codeperf.io for FREE.",
Short: "Export and persist Go's profiling data locally, or into https://codeperf.io.",
Long: longDescription,
Run: exportLogic(),
}
Expand Down Expand Up @@ -85,7 +85,7 @@ func init() {
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.

rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.pprof-exporter.yaml)")
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.codeperf.yaml)")
rootCmd.PersistentFlags().BoolVar(&local, "local", false, "don't push the data to https://codeperf.io")
rootCmd.PersistentFlags().StringVar(&bench, "bench", "", "Benchmark name")
rootCmd.PersistentFlags().StringVar(&gitOrg, "git-org", defaultGitOrg, "git org")
Expand Down Expand Up @@ -130,10 +130,10 @@ func initConfig() {
home, err := os.UserHomeDir()
cobra.CheckErr(err)

// Search config in home directory with name ".pprof-exporter" (without extension).
// Search config in home directory with name ".codeperf" (without extension).
viper.AddConfigPath(home)
viper.SetConfigType("yaml")
viper.SetConfigName(".pprof-exporter")
viper.SetConfigName(".codeperf")
}

viper.AutomaticEnv() // read in environment variables that match
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/codeperfio/pprof-exporter
module github.com/codeperfio/codeperf

go 1.16

Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -15,7 +15,7 @@ limitations under the License.
*/
package main

import "github.com/codeperfio/pprof-exporter/cmd"
import "github.com/codeperfio/codeperf/cmd"

func main() {
cmd.Execute()
Expand Down