forked from czarcas7ic/cosmprund
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from osmosis-labs/feat/add-goodies
Feat/add goodies
- Loading branch information
Showing
7 changed files
with
218 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This workflow creates a release using goreleaser | ||
# via the 'make release' command. | ||
|
||
name: Create release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
name: Create release | ||
runs-on: buildjet-4vcpu-ubuntu-2204 | ||
steps: | ||
- | ||
name: Check out repository code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.ref }} | ||
- | ||
name: Make release | ||
run: | | ||
make release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,29 @@ | ||
build | ||
snapshots/ | ||
here/ | ||
vendor/ | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
go.work.sum | ||
|
||
# env file | ||
.env* | ||
|
||
# Custom | ||
dist/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
project_name: cosmprund | ||
|
||
env: | ||
- CGO_ENABLED=0 | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: cosmprund | ||
binary: cosmprund | ||
flags: | ||
- -mod=readonly | ||
- -trimpath | ||
goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
ldflags: | ||
- -s | ||
- -w | ||
|
||
archives: | ||
- id: zipped | ||
builds: | ||
- cosmprund | ||
name_template: "{{.ProjectName}}-{{.Os}}-{{.Arch}}" | ||
format: tar.gz | ||
files: | ||
- none* | ||
- id: binaries | ||
builds: | ||
- cosmprund | ||
name_template: "{{.ProjectName}}-{{.Os}}-{{.Arch}}" | ||
format: binary | ||
files: | ||
- none* | ||
|
||
release: | ||
github: | ||
owner: osmosis-labs | ||
name: cosmprund | ||
header: | | ||
osmprund release {{ .Version }} | ||
footer: | | ||
## 🐳 Docker | ||
The following Docker images are available in our registry: | ||
| Image | Tag | | ||
|-------------------------------------|----------------| | ||
| `osmolabs/cosmprund:{{ .Version }}` | {{ .Version }} | | ||
name_template: "cosmprund v{{.Version}}" | ||
mode: replace | ||
draft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
# 1st stage, build app | ||
FROM golang:1.21-alpine as builder | ||
# ---------------------------------------------------------------- | ||
# Builder Stage | ||
# ---------------------------------------------------------------- | ||
ARG GO_VERSION="1.21" | ||
|
||
COPY . /app | ||
FROM golang:${GO_VERSION}-alpine AS builder | ||
|
||
# Download go dependencies | ||
WORKDIR /app | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
RUN go build -o cosmprund | ||
# Copy the remaining files | ||
COPY cmd /app/cmd | ||
COPY internal /app/internal | ||
COPY *.go /app/ | ||
|
||
# Build binary | ||
RUN go build \ | ||
-mod=readonly \ | ||
-ldflags "-w -s" \ | ||
-trimpath \ | ||
-o /app/build/cosmprund | ||
|
||
FROM alpine | ||
# ---------------------------------------------------------------- | ||
# Final image for Running | ||
# ---------------------------------------------------------------- | ||
|
||
COPY --from=builder /app/cosmprund /usr/bin/cosmprund | ||
FROM alpine:3.19 | ||
|
||
COPY --from=builder /app/build/cosmprund /usr/bin/cosmprund | ||
|
||
ENTRYPOINT [ "/usr/bin/cosmprund" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
VERSION := $(shell git describe --tags) | ||
COMMIT := $(shell git log -1 --format='%H') | ||
GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2) | ||
|
||
all: install | ||
|
||
build: | ||
@echo "Building cosmprund" | ||
@go build -mod readonly $(BUILD_FLAGS) -o build/cosmprund main.go | ||
|
||
clean: | ||
rm -rf build | ||
|
||
.PHONY: all lint test race msan tools clean build | ||
|
||
############################################################################### | ||
### Docker ### | ||
############################################################################### | ||
|
||
docker-build: | ||
docker build -t cosmprund:local . | ||
|
||
docker-run: | ||
docker run cosmprund:local | ||
|
||
############################################################################### | ||
### Release ### | ||
############################################################################### | ||
GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GO_VERSION) | ||
|
||
ifdef GITHUB_TOKEN | ||
release: | ||
docker run \ | ||
--rm \ | ||
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v `pwd`:/go/src/diffusion \ | ||
-w /go/src/diffusion \ | ||
$(GORELEASER_IMAGE) \ | ||
release \ | ||
--clean | ||
else | ||
release: | ||
@echo "Error: GITHUB_TOKEN is not defined. Please define it before running 'make release'." | ||
endif | ||
|
||
release-dry-run: | ||
docker run \ | ||
--rm \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v `pwd`:/go/src/diffusion \ | ||
-w /go/src/diffusion \ | ||
$(GORELEASER_IMAGE) \ | ||
release \ | ||
--clean \ | ||
--skip=publish | ||
|
||
release-snapshot: | ||
docker run \ | ||
--rm \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v `pwd`:/go/src/osmosisd \ | ||
-w /go/src/osmosisd \ | ||
$(GORELEASER_IMAGE) \ | ||
release \ | ||
--clean \ | ||
--snapshot \ | ||
--skip=validate \ | ||
--skip=publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters