chore: add mise

This commit is contained in:
Kevin Franklin Kim 2025-09-18 23:21:15 +02:00
parent 401407617a
commit 3677ba8f02
No known key found for this signature in database
4 changed files with 109 additions and 56 deletions

View File

@ -1,4 +1,4 @@
name: Lint and Test
name: Test Branch
on:
push:
@ -7,48 +7,51 @@ on:
merge_group:
workflow_dispatch:
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GOFLAGS: -mod=readonly
GOPROXY: https://proxy.golang.org
permissions:
contents: read
pull-requests: read
checks: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
- uses: jdx/mise-action@v3
- uses: actions/setup-go@v6
with:
check-latest: true
go-version-file: go.mod
- uses: actions/setup-node@v4
- uses: golangci/golangci-lint-action@v8
with:
install-mode: none
- uses: actions/setup-node@v5
with:
cache: yarn
- name: Run yarn install
working-directory: example
run: yarn install
- name: Run go mod tidy
run: |
make tidy
git diff --exit-code
run: make tidy && git diff --exit-code
- uses: golangci/golangci-lint-action@v8
- name: Run lint
run: make lint
- name: Run tests
run: make test
- name: Make examples
run: |
make examples
git diff --exit-code
- name: Run tests
run: make test

5
.mise.toml Normal file
View File

@ -0,0 +1,5 @@
[tools]
# https://github.com/golangci/golangci-lint/releases
golangci-lint = "2.4.0"
# https://github.com/go-courier/husky/releases
"github:go-courier/husky" = "1.8.1"

View File

@ -1,19 +1,32 @@
.DEFAULT_GOAL:=help
-include .makerc
# --- Config -----------------------------------------------------------------
# Newline hack for error output
define br
endef
# --- Targets -----------------------------------------------------------------
# This allows us to accept extra arguments
%: .husky
%: .mise .husky
@:
.PHONY: .mise
# Install dependencies
.mise: msg := $(br)$(br)Please ensure you have 'mise' installed and activated!$(br)$(br)$$ brew update$(br)$$ brew install mise$(br)$(br)See the documentation: https://mise.jdx.dev/getting-started.html$(br)$(br)
.mise:
ifeq (, $(shell command -v mise))
$(error ${msg})
endif
@mise install
.PHONY: .husky
# Configure git hooks for husky
.husky:
@if ! command -v husky &> /dev/null; then \
echo "ERROR: missing executeable 'husky', please run:"; \
echo "\n$ go install github.com/go-courier/husky/cmd/husky@latest\n"; \
fi
@git config core.hooksPath .husky
## === Tasks ===
@ -22,11 +35,38 @@
## Run lint & test
check: tidy examples lint test
.PHONY: tidy
## Run go mod tidy
tidy:
@go mod tidy
.PHONY: lint
## Run linter
lint:
@golangci-lint run
.PHONY: lint.fix
## Run linter and fix
lint.fix:
@golangci-lint run --fix
.PHONY: test
## Run go test
test:
@GO_TEST_TAGS=-skip go test -coverprofile=coverage.out --tags=safe -race ./...
.PHONY: build
## Build binary
build:
@rm -f bin/gotsrpc
@go build -o bin/gotsrpc cmd/gotsrpc/gotsrpc.go
.PHONY: build.debug
## Build binary in debug mode
build.debug:
@rm -f bin/gotsrpc
@go build -gcflags "all=-N -l" -o bin/gotsrpc cmd/gotsrpc/gotsrpc.go
.PHONY: install
## Run go install
install:
@ -42,15 +82,9 @@ install.debug:
outdated:
@go list -u -m -json all | go-mod-outdated -update -direct
.PHONY: build.debug
## Build binary in debug mode
build.debug:
@rm -f bin/gotsrpc
@go build -gcflags "all=-N -l" -o bin/gotsrpc cmd/gotsrpc/gotsrpc.go
## === Tools ===
EXAMPLES=basic errors monitor nullable union time
EXAMPLES=basic errors monitor nullable union time types
define examples
.PHONY: example.$(1)
example.$(1):
@ -71,21 +105,6 @@ example.$(1).lint:
endef
$(foreach p,$(EXAMPLES),$(eval $(call examples,$(p))))
.PHONY: lint
## Run linter
lint:
@golangci-lint run
.PHONY: lint.fix
## Run linter and fix
lint.fix:
@golangci-lint run --fix
.PHONY: tidy
## Run go mod tidy
tidy:
@go mod tidy
## === Examples ===
.PHONY: examples

View File

@ -1,6 +1,5 @@
[![Build Status](https://github.com/foomo/gotsrpc/actions/workflows/test.yml/badge.svg?branch=main&event=push)](https://github.com/foomo/gotsrpc/actions/workflows/test.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/foomo/gotsrpc)](https://goreportcard.com/report/github.com/foomo/gotsrpc)
[![Coverage Status](https://coveralls.io/repos/github/foomo/gotsrpc/badge.svg?branch=main&)](https://coveralls.io/github/foomo/gotsrpc?branch=main)
[![GoDoc](https://godoc.org/github.com/foomo/gotsrpc?status.svg)](https://godoc.org/github.com/foomo/gotsrpc)
<p align="center">
@ -11,22 +10,49 @@
## Documentation
Please refer to the documentation:
Please refer to the [documentation](https://www.foomo.org/docs/projects/gotsrpc).
https://www.foomo.org/docs/projects/gotsrpc
```shell
$ gotsrpc
gotsrpc
Usage:
gotsrpc [options] <config-file>
Options:
-version Display version information
-debug Print debug information
Examples:
$ gotsrpc path/to/gotsrpc.yaml
```
## Installation
Follow the docs:
Please follow the [documentation](https://www.foomo.org/docs/projects/gotsrpc/cli#installation).
https://www.foomo.org/docs/projects/gotsrpc/cli#installation
### Download binary
From source to /usr/local/bin/gotsrpc:
Download a [binary release](https://github.com/foomo/gotsrpc/releases)
```bash
go get github.com/foomo/gotsrpc/v2
cd $GOPATH/src/github.com/foomo/gotsrpc
make install
### Build from source
```
go install github.com/foomo/gotsrpc@latest
```
### Homebrew (Linux/macOS)
If you use [Homebrew](https://brew.sh), you can install like this:
```
brew install foomo/tap/gotsrpc
```
### Mise
If you use [mise](https://https://mise.jdx.dev), you can install like this:
```
mise use github.com:foomo/gotsrpc
```
Release downloads: