Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 71 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
name: Build

on:
- push
- pull_request
push:
branches:
- main
- master
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
go-version: ["1.18.x", "1.19.x", "1.20.x", "1.21.x"]
go-version:
[
"1.18.x",
"1.19.x",
"1.20.x",
"1.21.x",
"1.22.x",
"1.23.x",
"1.24.x",
"1.25.x",
]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: ${{ matrix.go-version }}
- name: Cache mods
uses: actions/cache@v3
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.4.2
with:
path: |
~/.cache/go-build
Expand All @@ -27,3 +49,46 @@ jobs:
run: go mod download
- name: Build
run: go build

zizmor:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Run zizmor
uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0
with:
inputs: .github/workflows/

goreleaser-snapshot:
runs-on: ubuntu-latest
permissions:
contents: read
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: "1.24.x"
cache: false
- name: Run GoReleaser (snapshot)
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with:
distribution: goreleaser
version: latest
args: release --snapshot --clean
- name: Upload artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: dist
path: dist/
20 changes: 14 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@ on:
- push
- pull_request

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
go-version: ["1.21.x"]
go-version: ["1.24.x"]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v3
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: ${{ matrix.go-version }}
- name: Cache mods
uses: actions/cache@v3
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: |
~/.cache/go-build
Expand All @@ -26,8 +34,8 @@ jobs:
- name: Download mods
run: go mod download
- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: v1.54.1
version: v2.7.2
args: --timeout 5m0s
skip-cache: true
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: "1.24.x"
cache: false
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 16 additions & 19 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
run:
skip-dirs:
- .tmp
- vendor
version: "2"

linters:
disable-all: true
default: none
enable:
# - errcheck
- gocritic
- goconst
- goimports
- gosimple
- govet
- ineffassign
- staticcheck
- stylecheck
- typecheck
- unused
disable:
- errcheck
exclusions:
rules:
# Suppress ST1005 - error strings capitalization
- linters: [staticcheck]
text: "error strings should not be capitalized"
settings:
govet:
enable:
- shadow

linters-settings:
govet:
# report about shadowed variables
check-shadowing: true

issues:
exclude-rules:
- linters: [stylecheck]
text: "ST1005:"
formatters:
enable:
- goimports
55 changes: 55 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: 2

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- freebsd
goarch:
- amd64
- arm64
- arm
- "386"
ignore:
# macOS doesn't support 32-bit architectures
- goos: darwin
goarch: "386"
- goos: darwin
goarch: arm
ldflags:
- -s -w
- -X main.version={{.Version}}

archives:
- name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
files:
- LICENSE*
- README*
- CHANGELOG*

checksum:
name_template: "checksums.txt"
algorithm: sha256

snapshot:
version_template: "{{ incpatch .Version }}-next"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^chore:"
- "^ci:"

release:
draft: false
prerelease: auto
name_template: "{{.ProjectName}} {{.Version}}"
34 changes: 0 additions & 34 deletions build-all.sh

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module github.com/DarthSim/overmind/v2
go 1.21

require (
github.com/Envek/godotenv v0.0.0-20240326021258-e36c8a003587
github.com/matoous/go-nanoid v1.5.0
github.com/sevlyar/go-daemon v0.1.6
github.com/urfave/cli v1.22.12
golang.org/x/term v0.4.0
)

require (
github.com/Envek/godotenv v0.0.0-20240326021258-e36c8a003587 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
Expand Down
36 changes: 36 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Build a local development version
build:
go build -ldflags "-X main.version=dev" -o overmind .

# Run tests
test:
go test -v ./...

# Run linter
lint:
golangci-lint run --timeout 5m0s

# Build a snapshot release (useful for testing)
snapshot:
goreleaser release --snapshot --clean

# Check if the goreleaser config is valid
check-config:
goreleaser check

# Clean build artifacts
clean:
rm -rf ./dist
rm -f overmind

# Show current version from git tags
version:
@git describe --always --tags --abbrev=0 2>/dev/null || echo "no tags found"

# Install goreleaser (if not already installed)
install-goreleaser:
@which goreleaser > /dev/null || (echo "Installing goreleaser..." && go install github.com/goreleaser/goreleaser/v2@latest)

# Local release (requires goreleaser to be installed)
release: install-goreleaser
goreleaser release --clean
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
"github.com/urfave/cli"
)

const version = "2.5.1"
// version will be set by goreleaser via ldflags
var version = "dev"

func socketFlags(s, n *string) []cli.Flag {
return []cli.Flag{
Expand Down
Loading