Skip to content

Commit 7c63fc8

Browse files
authored
Merge pull request #33 from LAA-Software-Engineering/issue/1-go-module-skeleton
feat: Go module skeleton, CI, and issue #1 foundations
2 parents 74b8717 + 9f42e46 commit 7c63fc8

24 files changed

Lines changed: 234 additions & 0 deletions

File tree

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# LF everywhere for Go so gofmt -l matches Linux/macOS on Windows CI and locally.
2+
*.go text eol=lf
3+
go.mod text eol=lf
4+
go.sum text eol=lf

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- "Makefile"
9+
- "**/*.md"
10+
pull_request:
11+
paths-ignore:
12+
- "Makefile"
13+
- "**/*.md"
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
build-and-test:
24+
name: Go ${{ matrix.go }} — ${{ matrix.os }}
25+
runs-on: ${{ matrix.os }}
26+
timeout-minutes: 15
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
os: [ubuntu-latest, macos-latest, windows-latest]
31+
go: ["1.22.x"]
32+
include:
33+
# Extra Go patch line on Linux to catch regressions on newer toolchain.
34+
- os: ubuntu-latest
35+
go: "1.23.x"
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Set up Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: ${{ matrix.go }}
45+
cache: true
46+
47+
- name: Download modules
48+
run: go mod download
49+
50+
- name: Verify go.sum
51+
run: go mod verify
52+
53+
- name: Check formatting
54+
shell: bash
55+
run: |
56+
set -euo pipefail
57+
out="$(gofmt -l .)"
58+
if [[ -n "$out" ]]; then
59+
echo "::error::Run gofmt on:"
60+
echo "$out"
61+
exit 1
62+
fi
63+
64+
- name: Go vet
65+
run: go vet ./...
66+
67+
- name: Build agentctl
68+
run: go build -v -o agentctl${{ runner.os == 'Windows' && '.exe' || '' }} ./cmd/agentctl
69+
70+
# Use bash on Windows: PowerShell misparses -coverprofile=coverage.out
71+
# (".out" becomes a separate argument / package path).
72+
- name: Unit tests
73+
shell: bash
74+
run: |
75+
go test -v \
76+
-race \
77+
-count=1 \
78+
-shuffle=on \
79+
-timeout=10m \
80+
-covermode=atomic \
81+
-coverprofile=coverage.out \
82+
./...
83+
84+
- name: Coverage summary
85+
if: runner.os == 'Linux'
86+
run: go tool cover -func=coverage.out | tail -n1
87+
88+
- name: Upload coverage artifact
89+
if: runner.os == 'Linux' && matrix.go == '1.22.x'
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: coverage-linux-go122
93+
path: coverage.out
94+
if-no-files-found: error

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# If you prefer the allow list template instead of the deny list, see community template:
22
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
33
#
4+
# Local build output (see Makefile)
5+
bin/
6+
47
# Binaries for programs and plugins
58
*.exe
69
*.exe~

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.PHONY: test build
2+
3+
test:
4+
go test ./...
5+
6+
build:
7+
mkdir -p bin
8+
go build -o bin/agentctl ./cmd/agentctl

cmd/agentctl/main.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/LAA-Software-Engineering/agentic-control-plane/internal/app"
8+
)
9+
10+
func main() {
11+
if err := app.New().Run(); err != nil {
12+
fmt.Fprintln(os.Stderr, err)
13+
os.Exit(1)
14+
}
15+
}

go.mod

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module github.com/LAA-Software-Engineering/agentic-control-plane
2+
3+
go 1.22
4+
5+
require github.com/spf13/cobra v1.8.1
6+
7+
require (
8+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
9+
github.com/spf13/pflag v1.0.5 // indirect
10+
)

go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
2+
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3+
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
4+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
5+
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
6+
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
7+
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
8+
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
9+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/app/app.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package app
2+
3+
// App is the composition root for agentctl. Subsystems (stores, planner,
4+
// runtime) will be assembled here in later phases.
5+
type App struct{}
6+
7+
// New constructs an application instance with default wiring.
8+
func New() *App {
9+
return &App{}
10+
}
11+
12+
// Run starts the CLI and blocks until the root command finishes.
13+
func (a *App) Run() error {
14+
return runCLI()
15+
}

internal/app/wiring.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package app
2+
3+
import "github.com/LAA-Software-Engineering/agentic-control-plane/internal/cli"
4+
5+
func runCLI() error {
6+
return cli.Execute()
7+
}

internal/apply/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package apply applies plans to control-plane and runtime state.
2+
package apply

0 commit comments

Comments
 (0)