-
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.
- Loading branch information
Showing
21 changed files
with
4,119 additions
and
6 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,46 @@ | ||
root = "." | ||
testdata_dir = "testdata" | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
args_bin = [] | ||
bin = "./main" | ||
cmd = "make build" | ||
delay = 1000 | ||
exclude_dir = ["assets", "tmp", "vendor", "testdata"] | ||
exclude_file = [] | ||
exclude_regex = ["_test.go", ".*_templ.go"] | ||
exclude_unchanged = false | ||
follow_symlink = false | ||
full_bin = "" | ||
include_dir = [] | ||
include_ext = ["go", "tpl", "tmpl", "html", "templ"] | ||
include_file = [] | ||
kill_delay = "0s" | ||
log = "build-errors.log" | ||
poll = false | ||
poll_interval = 0 | ||
post_cmd = [] | ||
pre_cmd = [] | ||
rerun = false | ||
rerun_delay = 500 | ||
send_interrupt = false | ||
stop_on_error = false | ||
|
||
[color] | ||
app = "" | ||
build = "yellow" | ||
main = "magenta" | ||
runner = "green" | ||
watcher = "cyan" | ||
|
||
[log] | ||
main_only = false | ||
time = false | ||
|
||
[misc] | ||
clean_on_exit = false | ||
|
||
[screen] | ||
clear_on_rebuild = false | ||
keep_scroll = 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Go-test | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21.x' | ||
- name: Build | ||
run: go build -v ./... | ||
- name: Test with the Go CLI | ||
run: go test ./... |
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,29 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21.1' | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/[email protected] | ||
with: | ||
distribution: goreleaser | ||
version: ${{ env.GITHUB_REF_NAME }} | ||
args: release --clean | ||
workdir: ./ | ||
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
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,41 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
env: | ||
- PACKAGE_PATH=github.com/<user>/<repo>/cmd | ||
|
||
builds: | ||
- binary: "{{ .ProjectName }}" | ||
main: ./cmd/api | ||
goos: | ||
- darwin | ||
- linux | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -s -w -X {{.Env.PACKAGE_PATH}}={{.Version}} | ||
release: | ||
prerelease: auto | ||
|
||
universal_binaries: | ||
- replace: true | ||
|
||
archives: | ||
- name_template: > | ||
{{- .ProjectName }}_{{- .Version }}_{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64{{- else if eq .Arch "386" }}i386{{- else }}{{ .Arch }}{{ end }}{{- if .Arm }}v{{ .Arm }}{{ end -}} | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
builds_info: | ||
group: root | ||
owner: root | ||
files: | ||
- README.md | ||
checksum: | ||
name_template: 'checksums.txt' |
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,42 @@ | ||
# Simple Makefile for a Go project | ||
|
||
# Build the application | ||
all: build | ||
|
||
build: | ||
@echo "Building..." | ||
@templ generate | ||
@go build -o main cmd/api/main.go | ||
|
||
# Run the application | ||
run: | ||
@go run cmd/api/main.go | ||
|
||
# Test the application | ||
test: | ||
@echo "Testing..." | ||
@go test ./tests -v | ||
|
||
# Clean the binary | ||
clean: | ||
@echo "Cleaning..." | ||
@rm -f main | ||
|
||
# Live Reload | ||
watch: | ||
@if command -v air > /dev/null; then \ | ||
air; \ | ||
echo "Watching...";\ | ||
else \ | ||
read -p "Go's 'air' is not installed on your machine. Do you want to install it? [Y/n] " choice; \ | ||
if [ "$$choice" != "n" ] && [ "$$choice" != "N" ]; then \ | ||
go install github.com/cosmtrek/air@latest; \ | ||
air; \ | ||
echo "Watching...";\ | ||
else \ | ||
echo "You chose not to install air. Exiting..."; \ | ||
exit 1; \ | ||
fi; \ | ||
fi | ||
|
||
.PHONY: all build run test clean |
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 +1,49 @@ | ||
# misc | ||
# Project misc | ||
|
||
One Paragraph of project description goes here | ||
|
||
## Getting Started | ||
|
||
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. | ||
|
||
## MakeFile | ||
|
||
run all make commands with clean tests | ||
```bash | ||
make all build | ||
``` | ||
|
||
build the application | ||
```bash | ||
make build | ||
``` | ||
|
||
run the application | ||
```bash | ||
make run | ||
``` | ||
|
||
Create DB container | ||
```bash | ||
make docker-run | ||
``` | ||
|
||
Shutdown DB container | ||
```bash | ||
make docker-down | ||
``` | ||
|
||
live reload the application | ||
```bash | ||
make watch | ||
``` | ||
|
||
run the test suite | ||
```bash | ||
make test | ||
``` | ||
|
||
clean up binary from the last build | ||
```bash | ||
make clean | ||
``` |
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,16 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"misc/internal/server" | ||
) | ||
|
||
func main() { | ||
|
||
server := server.NewServer() | ||
|
||
err := server.ListenAndServe() | ||
if err != nil { | ||
panic(fmt.Sprintf("cannot start server: %s", err)) | ||
} | ||
} |
Oops, something went wrong.