Skip to content
Merged
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
13 changes: 12 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
time: "04:00"
labels:
- dependencies
- github-actions
commit-message:
prefix: chore
include: scope
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
time: "04:00"
labels:
- dependencies
- go
- golang
commit-message:
prefix: chore
include: scope
87 changes: 87 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Go

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read

# Cancel old runs when new commit pushed to PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
# Skip job if PR is draft or has WIP in title
if: github.event_name != 'pull_request' || (!github.event.pull_request.draft && !contains(github.event.pull_request.title, 'WIP'))
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: ./go.mod
cache: true

- name: Set up golangci-lint cache
uses: actions/cache@v5
with:
path: ~/.cache/golangci-lint
key: golangci-${{ hashFiles('.golangci.yml') }}-${{ hashFiles('go.sum') }}
restore-keys: |
golangci-${{ hashFiles('.golangci.yml') }}-
golangci-

- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
only-new-issues: ${{ github.event_name == 'pull_request' }}
skip-cache: true # Use our custom cache
problem-matchers: true

test:
name: Test
runs-on: ubuntu-latest
# Skip job if PR is draft or has WIP in title
if: github.event_name != 'pull_request' || (!github.event.pull_request.draft && !contains(github.event.pull_request.title, 'WIP'))
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: ./go.mod
cache: true

- name: Download dependencies
run: go mod download

- name: Run tests
run: go test -v -race ./...

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: ./go.mod
cache: true

- name: Build
run: go build -ldflags "-s -w" -o build/esq ./cmd/esq
136 changes: 136 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: ./go.mod
cache: true

- name: Run tests
run: go test -v -race ./...

- name: Build binaries
run: |
VERSION=${GITHUB_REF_NAME}
COMMIT=$(git rev-parse --short HEAD)
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"

mkdir -p dist

# Build for each platform
platforms=(
"linux/amd64"
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
"windows/amd64"
)

for platform in "${platforms[@]}"; do
GOOS=${platform%/*}
GOARCH=${platform#*/}

output_name="esq-${GOOS}-${GOARCH}"
if [ "$GOOS" = "windows" ]; then
output_name+=".exe"
fi

echo "Building $output_name..."
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "${LDFLAGS}" -o "dist/${output_name}" ./cmd/esq
done

# Create archives
cd dist
for file in esq-*; do
if [[ "$file" == *.exe ]]; then
zip "${file%.exe}.zip" "$file"
rm "$file"
else
tar czf "${file}.tar.gz" "$file"
rm "$file"
fi
done

# Generate checksums
sha256sum * > checksums.txt

- name: Generate changelog
id: changelog
run: |
# Get previous tag
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")

if [ -n "$PREV_TAG" ]; then
echo "Generating changelog from $PREV_TAG to $GITHUB_REF_NAME"
CHANGELOG=$(git log --pretty=format:"- %s (%h)" "$PREV_TAG".."$GITHUB_REF_NAME" --no-merges)
else
echo "No previous tag found, including all commits"
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
fi

# Escape for GitHub Actions
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body: |
## What's Changed

${{ steps.changelog.outputs.changelog }}

## Installation

### macOS (Apple Silicon)
```bash
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/esq-darwin-arm64.tar.gz | tar xz
chmod +x esq-darwin-arm64
sudo mv esq-darwin-arm64 /usr/local/bin/esq
```

### macOS (Intel)
```bash
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/esq-darwin-amd64.tar.gz | tar xz
chmod +x esq-darwin-amd64
sudo mv esq-darwin-amd64 /usr/local/bin/esq
```

### Linux (x64)
```bash
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/esq-linux-amd64.tar.gz | tar xz
chmod +x esq-linux-amd64
sudo mv esq-linux-amd64 /usr/local/bin/esq
```

### Windows
Download `esq-windows-amd64.zip` and add to your PATH.

## Checksums

See `checksums.txt` for SHA256 checksums of all binaries.
files: |
dist/*
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
33 changes: 32 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Build artifacts
/build/
/dist/
bin/
dist/

# Test coverage
coverage.out
coverage.html

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# OS files
.DS_Store
Thumbs.db

# Binary
/esq
/esq.exe
*.exe

# Config (local development)
.env

# Go
/vendor/

# Air (hot reload)
/tmp/
.claude/
7 changes: 7 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Code of Conduct

This project follows the [Contributor Covenant v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).

In short: be respectful, constructive, and inclusive. Harassment or exclusionary behavior will not be tolerated.

For concerns, contact the maintainers via [GitHub issues](https://github.com/enthus-appdev/esq-cli/issues).
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Contributing to esq-cli

Thanks for your interest in contributing! Here's how to get started.

## Development Setup

```bash
git clone https://github.com/enthus-appdev/esq-cli.git
cd esq-cli
make build # Build the binary
make test # Run tests
make lint # Run goimports + golangci-lint
```

Requires Go 1.24+ and [golangci-lint](https://golangci-lint.run/).

## Making Changes

1. Fork the repository and create a feature branch from `main`
2. Write your code and add tests where appropriate
3. Run `make lint && make test` to ensure all checks pass
4. Commit with a clear message describing the change
5. Open a pull request against `main`

## Code Style

- Run `goimports -w .` before committing
- Follow standard Go conventions

## Reporting Bugs

Open a [GitHub issue](https://github.com/enthus-appdev/esq-cli/issues) with:
- Steps to reproduce
- Expected vs actual behavior
- CLI version (`esq --version`) and OS

## License

By contributing, you agree that your contributions will be licensed under the MIT License.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 enthus GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
BINARY_NAME := esq
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
LDFLAGS := -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT)"
LDFLAGS := -ldflags "-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)"

.PHONY: build install clean lint test
.PHONY: all build install clean lint test help

build:
all: build ## Build the application (default)

build: ## Build to bin/esq
go build $(LDFLAGS) -o bin/$(BINARY_NAME) ./cmd/esq

install: build
install: build ## Build + copy to ~/bin/
cp bin/$(BINARY_NAME) $(HOME)/bin/$(BINARY_NAME)

clean:
rm -rf bin/
clean: ## Remove build artifacts
rm -rf bin/ dist/ coverage.out coverage.html

lint:
lint: ## Run goimports + golangci-lint
goimports -w . && golangci-lint run

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

help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
Loading