Skip to content

Commit

Permalink
Add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
federicotdn committed Dec 13, 2024
1 parent b087b49 commit 60bdd3c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: k6 - Test Suite
on: [push]

jobs:
runner-job:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5

- name: Check Formatting
run: make format-check

- name: Build Binary
run: make build
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
GO_SOURCES=$(shell find . -type f -name '*.go' -not -path "./vendor/*")

.PHONY: run
run:
go generate pkg/web/web.go
CGO_ENABLED=0 go run ./cmd

# TODO: add build recipe for npm
# Note: does not include frontend files, only Go code.
.PHONY: build
build:
go generate pkg/web/web.go
CGO_ENABLED=0 go build -o bin/quickpizza ./cmd
go build -tags=mock -o bin/quickpizza ./cmd

.PHONY: proto
proto:
Expand All @@ -22,3 +16,11 @@ format:
.PHONY: format-check
format-check:
@out=$$(goimports -l $(GO_SOURCES)) && echo "$$out" && test -z "$$out"

.PHONY: docker-localdev-build
docker-localdev-build:
docker build . -t grafana/quickpizza:localdev

.PHONY: docker-localdev-run
docker-localdev-run:
docker run --rm -it -p 3333:3333 -p 3334:3334 -p 3335:3335 -v $$(pwd):/db -e QUICKPIZZA_DB=file:/db/quickpizza.db grafana/quickpizza:localdev
4 changes: 2 additions & 2 deletions pkg/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ var (
})

pizzaCaloriesPerSliceNativeHistogram = promauto.NewHistogram(prometheus.HistogramOpts{
Name: "pizza_calories_per_slice_alternate",
Help: "The number of calories per slice of pizza (Native Histogram)",
Name: "pizza_calories_per_slice_alternate",
Help: "The number of calories per slice of pizza (Native Histogram)",
NativeHistogramBucketFactor: 1.1,
NativeHistogramMaxBucketNumber: 100,
NativeHistogramMinResetDuration: 1 * time.Hour,
Expand Down
2 changes: 2 additions & 0 deletions pkg/web/web.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !mock

package web

import "embed"
Expand Down
10 changes: 10 additions & 0 deletions pkg/web/web_mock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build mock

package web

import "embed"

// Embed some random directory.
//
//go:embed all:static
var EmbeddedFiles embed.FS

0 comments on commit 60bdd3c

Please sign in to comment.