forked from krzko/otelgen
-
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 krzko#125 from krzko/feat-add-additional-usecases
feat: update many things
- Loading branch information
Showing
33 changed files
with
2,323 additions
and
842 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,45 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "*" | ||
- "!main" | ||
paths-ignore: | ||
- "**/.md" | ||
|
||
env: | ||
REGISTRY_IMAGE: ghcr.io/krzko/otelgen | ||
|
||
jobs: | ||
build: | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build only | ||
run: | | ||
docker buildx build \ | ||
--platform linux/amd64 \ | ||
-t ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} \ | ||
. |
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
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,5 +1,6 @@ | ||
### Custom ### | ||
|
||
/build | ||
/otelgen | ||
|
||
# goreleaser | ||
|
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
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,3 +1,18 @@ | ||
FROM scratch | ||
ENTRYPOINT ["/otelgen"] | ||
COPY otelgen /otelgen | ||
FROM golang:1.23 AS builder | ||
|
||
WORKDIR /go/src/github.com/krzko/otelgen | ||
|
||
COPY . . | ||
|
||
ARG BUILD_VERSION=0.0.0 | ||
ARG BUILD_DATE=1970-01-01T00:00:00Z | ||
ARG COMMIT_ID=unknown | ||
|
||
RUN CGO_ENABLED=0 go build -ldflags "-X main.version=${BUILD_VERSION} -X main.date=${BUILD_DATE} -X main.commit=${COMMIT_ID}" \ | ||
-o /usr/bin/otelgen -v /go/src/github.com/krzko/otelgen/cmd/otelgen | ||
|
||
FROM cgr.dev/chainguard/static:latest | ||
|
||
COPY --from=builder /usr/bin/otelgen / | ||
|
||
CMD ["/otelgen"] |
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,66 @@ | ||
# Go parameters | ||
GOCMD=go | ||
GOBUILD=$(GOCMD) build | ||
GOCLEAN=$(GOCMD) clean | ||
GOTEST=$(GOCMD) test | ||
GOGET=$(GOCMD) get | ||
GOMOD=$(GOCMD) mod | ||
GOLINT=golangci-lint | ||
|
||
# Binary name | ||
BINARY_NAME=otelgen | ||
|
||
# Main package path | ||
MAIN_PACKAGE=./cmd/otelgen | ||
|
||
# Build directory | ||
BUILD_DIR=./build | ||
|
||
# Source files | ||
SRC=$(shell find . -name "*.go") | ||
|
||
# Test coverage output | ||
COVERAGE_OUTPUT=coverage.out | ||
|
||
.PHONY: all build clean test coverage lint deps tidy run help | ||
|
||
all: build | ||
|
||
build: ## Build the binary | ||
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PACKAGE) | ||
|
||
clean: ## Remove build artifacts | ||
$(GOCLEAN) | ||
rm -rf $(BUILD_DIR) | ||
rm -f $(COVERAGE_OUTPUT) | ||
|
||
test: ## Run tests | ||
$(GOTEST) -v ./... | ||
|
||
coverage: ## Run tests with coverage | ||
$(GOTEST) -v -coverprofile=$(COVERAGE_OUTPUT) ./... | ||
$(GOCMD) tool cover -html=$(COVERAGE_OUTPUT) | ||
|
||
lint: ## Run linter | ||
$(GOLINT) run | ||
|
||
deps: ## Download dependencies | ||
$(GOGET) -v -t -d ./... | ||
|
||
tidy: ## Tidy and verify dependencies | ||
$(GOMOD) tidy | ||
$(GOMOD) verify | ||
|
||
run: build ## Run the application | ||
$(BUILD_DIR)/$(BINARY_NAME) | ||
|
||
docker-build: ## Build Docker image | ||
docker build -t $(BINARY_NAME) . | ||
|
||
docker-run: ## Run Docker container | ||
docker run --rm $(BINARY_NAME) | ||
|
||
help: ## Display this help screen | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.DEFAULT_GOAL := help |
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
Oops, something went wrong.