This commit is contained in:
Harivansh Rathi 2026-02-07 14:08:09 -05:00
parent 011170671c
commit 6d7716a0fe
3 changed files with 155 additions and 1 deletions

27
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: CI
on:
pull_request:
push:
branches-ignore:
- main
tags-ignore:
- "v*"
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: go build ./...
- name: Test
run: go test ./...

95
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,95 @@
name: Release
on:
push:
branches:
- main
tags-ignore:
- "v*"
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Compute next version
id: version
shell: bash
run: |
set -euo pipefail
latest_tag="$(git tag --list 'v*' --sort=-v:refname | head -n 1)"
if [ -z "$latest_tag" ]; then
next_tag="v0.1.0"
else
base="${latest_tag#v}"
IFS='.' read -r major minor patch <<< "$base"
patch=$((patch + 1))
next_tag="v${major}.${minor}.${patch}"
fi
echo "next_tag=$next_tag" >> "$GITHUB_OUTPUT"
echo "version=${next_tag#v}" >> "$GITHUB_OUTPUT"
- name: Commit VERSION
shell: bash
run: |
set -euo pipefail
echo "${{ steps.version.outputs.version }}" > VERSION
if git diff --quiet VERSION; then
echo "VERSION unchanged"
else
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add VERSION
git commit -m "chore(release): ${{ steps.version.outputs.next_tag }} [skip ci]"
git push origin HEAD:main
fi
- name: Create tag
shell: bash
run: |
set -euo pipefail
git fetch --tags
if git rev-parse "${{ steps.version.outputs.next_tag }}" >/dev/null 2>&1; then
echo "Tag already exists: ${{ steps.version.outputs.next_tag }}"
else
git tag "${{ steps.version.outputs.next_tag }}"
git push origin "${{ steps.version.outputs.next_tag }}"
fi
- name: Build release binaries
shell: bash
run: |
set -euo pipefail
mkdir -p dist
version="${{ steps.version.outputs.next_tag }}"
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${version}" -o "dist/agentikube_${version}_linux_amd64" ./cmd/agentikube
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${version}" -o "dist/agentikube_${version}_linux_arm64" ./cmd/agentikube
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${version}" -o "dist/agentikube_${version}_darwin_amd64" ./cmd/agentikube
GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.version=${version}" -o "dist/agentikube_${version}_darwin_arm64" ./cmd/agentikube
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${version}" -o "dist/agentikube_${version}_windows_amd64.exe" ./cmd/agentikube
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.next_tag }}
name: ${{ steps.version.outputs.next_tag }}
generate_release_notes: true
files: dist/*

View file

@ -4,7 +4,9 @@
[![GitHub Downloads (All Assets)](https://img.shields.io/github/downloads/harivansh-afk/agentikube/total)](https://github.com/harivansh-afk/agentikube/releases)
[![GitHub License](https://img.shields.io/github/license/harivansh-afk/agentikube)](https://github.com/harivansh-afk/agentikube)
[![Go Version](https://img.shields.io/github/go-mod/go-version/harivansh-afk/agentikube)](https://github.com/harivansh-afk/agentikube/blob/main/go.mod)
[![Repo Size](https://img.shields.io/github/repo-size/harivansh-afk/agentikube)](https://github.com/harivansh-afk/agentikube)
[![Code Size](https://img.shields.io/github/languages/code-size/harivansh-afk/agentikube)](https://github.com/harivansh-afk/agentikube)
[![CI](https://github.com/harivansh-afk/agentikube/actions/workflows/ci.yml/badge.svg)](https://github.com/harivansh-afk/agentikube/actions/workflows/ci.yml)
[![Release](https://github.com/harivansh-afk/agentikube/actions/workflows/release.yml/badge.svg)](https://github.com/harivansh-afk/agentikube/actions/workflows/release.yml)
This repo is a small Go CLI for running isolated agent sandboxes on Kubernetes.
@ -132,6 +134,36 @@ agentikube list
agentikube ssh demo
```
## Test CLI Locally
Use this exact flow to verify the CLI on your machine:
```bash
# 1) Build + tests
mkdir -p .cache/go-build .cache/go-mod
GOCACHE=$(pwd)/.cache/go-build GOMODCACHE=$(pwd)/.cache/go-mod go build ./...
GOCACHE=$(pwd)/.cache/go-build GOMODCACHE=$(pwd)/.cache/go-mod go test ./...
# 2) Root help + command help
GOCACHE=$(pwd)/.cache/go-build GOMODCACHE=$(pwd)/.cache/go-mod go run ./cmd/agentikube --help
for c in init up create list ssh down destroy status; do
GOCACHE=$(pwd)/.cache/go-build GOMODCACHE=$(pwd)/.cache/go-mod go run ./cmd/agentikube "$c" --help >/dev/null
done
# 3) Manifest generation smoke test
./agentikube up --dry-run --config agentikube.example.yaml
```
If those pass, the CLI wiring + config + templating path is working locally.
## CI And Auto Release
This repo now has two GitHub Actions workflows:
- `.github/workflows/ci.yml`
Runs `go build ./...` and `go test ./...` on PRs and non-main branch pushes.
- `.github/workflows/release.yml`
Runs on push to `main`, auto-bumps patch version (`vX.Y.Z`), writes `VERSION`, creates/pushes tag, builds multi-platform binaries, and creates a GitHub Release with artifacts.
## Notes / Current Limits
- `storage.type` currently must be `efs`.