Skip to content

Commit 448d748

Browse files
authored
Merge pull request #1 from initializ/develop
Add multi-module codebase with CI pipeline
2 parents c197a02 + 5d72b7a commit 448d748

250 files changed

Lines changed: 29537 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"includeCoAuthoredBy": false,
3+
"gitAttribution": false
4+
}

.github/workflows/ci.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: "1.25"
22+
23+
- name: Verify dependencies
24+
run: |
25+
cd forge-core && go mod verify
26+
cd ../forge-cli && go mod verify
27+
cd ../forge-plugins && go mod verify
28+
29+
- name: Vet
30+
run: go vet ./forge-core/... ./forge-cli/... ./forge-plugins/...
31+
32+
- name: Check formatting
33+
run: test -z "$(gofmt -l forge-core forge-cli forge-plugins)"
34+
35+
- name: Test
36+
run: go test -race -coverprofile=coverage.out ./forge-core/... ./forge-cli/... ./forge-plugins/...
37+
38+
- name: Check coverage threshold
39+
run: |
40+
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
41+
echo "Total coverage: ${COVERAGE}%"
42+
if (( $(echo "$COVERAGE < 70" | bc -l) )); then
43+
echo "::warning::Coverage ${COVERAGE}% is below 70% threshold"
44+
fi
45+
46+
- name: Upload coverage
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: coverage
50+
path: coverage.out
51+
52+
lint:
53+
name: Lint
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- uses: actions/setup-go@v5
59+
with:
60+
go-version: "1.25"
61+
62+
- uses: golangci/golangci-lint-action@v7
63+
with:
64+
version: v2.10.1
65+
args: ./forge-core/... ./forge-cli/... ./forge-plugins/...
66+
67+
integration:
68+
name: Integration Tests
69+
runs-on: ubuntu-latest
70+
needs: test
71+
steps:
72+
- uses: actions/checkout@v4
73+
74+
- uses: actions/setup-go@v5
75+
with:
76+
go-version: "1.25"
77+
78+
- name: Integration tests
79+
run: go test -race -tags=integration ./forge-core/... ./forge-cli/... ./forge-plugins/...
80+
81+
build:
82+
name: Build (${{ matrix.goos }}/${{ matrix.goarch }})
83+
runs-on: ubuntu-latest
84+
needs: [test, lint]
85+
strategy:
86+
matrix:
87+
include:
88+
- goos: linux
89+
goarch: amd64
90+
- goos: linux
91+
goarch: arm64
92+
- goos: darwin
93+
goarch: amd64
94+
- goos: darwin
95+
goarch: arm64
96+
- goos: windows
97+
goarch: amd64
98+
- goos: windows
99+
goarch: arm64
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- uses: actions/setup-go@v5
104+
with:
105+
go-version: "1.25"
106+
107+
- name: Build
108+
env:
109+
GOOS: ${{ matrix.goos }}
110+
GOARCH: ${{ matrix.goarch }}
111+
CGO_ENABLED: "0"
112+
run: cd forge-cli && go build -ldflags "-s -w" -o ../forge-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/forge

.github/workflows/release.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version: "1.25"
23+
24+
- uses: goreleaser/goreleaser-action@v6
25+
with:
26+
version: latest
27+
args: release --clean
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Code coverage profiles and other test artifacts
15+
*.out
16+
coverage.*
17+
*.coverprofile
18+
profile.cov
19+
20+
# Dependency directories (remove the comment below to include it)
21+
# vendor/
22+
23+
# Go workspace file
24+
# go.work
25+
# go.work.sum
26+
27+
# env file
28+
.env
29+
30+
# Editor/IDE
31+
# .idea/
32+
# .vscode/
33+
34+
35+
# Binary
36+
/forge
37+
38+
# Build output
39+
.forge-output/
40+
41+
# OS files
42+
.DS_Store

.goreleaser.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: 2
2+
3+
builds:
4+
- dir: forge-cli
5+
main: ./cmd/forge
6+
binary: forge
7+
env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- linux
11+
- darwin
12+
- windows
13+
goarch:
14+
- amd64
15+
- arm64
16+
ldflags:
17+
- -s -w -X main.version={{.Version}}
18+
19+
archives:
20+
- formats:
21+
- tar.gz
22+
format_overrides:
23+
- goos: windows
24+
formats:
25+
- zip
26+
name_template: "forge-{{ .Os }}-{{ .Arch }}"
27+
replacements:
28+
linux: Linux
29+
darwin: Darwin
30+
windows: Windows
31+
amd64: x86_64 # matches uname -m
32+
arm64: arm64 # matches uname -m
33+
34+
checksum:
35+
name_template: "checksums.txt"
36+
37+
changelog:
38+
sort: asc
39+
filters:
40+
exclude:
41+
- "^docs:"
42+
- "^test:"
43+
- "^ci:"
44+
- "^chore:"

Makefile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
BINARY := forge
2+
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
3+
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
4+
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)
5+
COVERFILE := coverage.out
6+
MODULES := forge-core forge-cli forge-plugins
7+
8+
.PHONY: build test test-integration vet fmt lint cover cover-html install clean release help
9+
10+
## build: Compile the forge binary
11+
build:
12+
cd forge-cli && go build -ldflags "$(LDFLAGS)" -o ../$(BINARY) ./cmd/forge
13+
14+
## test: Run all unit tests with race detection across all modules
15+
test:
16+
@for mod in $(MODULES); do echo "==> Testing $$mod"; (cd $$mod && go test -race ./...); done
17+
18+
## test-integration: Run integration tests (requires build tag)
19+
test-integration:
20+
@for mod in $(MODULES); do echo "==> Integration testing $$mod"; (cd $$mod && go test -race -tags=integration ./...); done
21+
22+
## vet: Run go vet on all modules
23+
vet:
24+
@for mod in $(MODULES); do echo "==> Vetting $$mod"; (cd $$mod && go vet ./...); done
25+
26+
## fmt: Check that all Go files are gofmt-compliant
27+
fmt:
28+
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:"; gofmt -l .; exit 1)
29+
30+
## lint: Run golangci-lint on all modules (must be installed separately)
31+
lint:
32+
@for mod in $(MODULES); do echo "==> Linting $$mod"; (cd $$mod && golangci-lint run ./...); done
33+
34+
## cover: Generate test coverage report for all modules
35+
cover:
36+
@for mod in $(MODULES); do echo "==> Coverage $$mod"; (cd $$mod && go test -race -coverprofile=$(COVERFILE) ./... && go tool cover -func=$(COVERFILE)); done
37+
38+
## cover-html: Open coverage report in browser (forge-cli)
39+
cover-html:
40+
cd forge-cli && go test -race -coverprofile=$(COVERFILE) ./... && go tool cover -html=$(COVERFILE)
41+
42+
## install: Install forge to GOPATH/bin
43+
install:
44+
cd forge-cli && go install -ldflags "$(LDFLAGS)" ./cmd/forge
45+
46+
## clean: Remove build artifacts and coverage files
47+
clean:
48+
rm -f $(BINARY)
49+
@for mod in $(MODULES); do rm -f $$mod/$(COVERFILE); done
50+
51+
## release: Build a snapshot release using goreleaser
52+
release:
53+
goreleaser release --snapshot --clean
54+
55+
## help: Show this help message
56+
help:
57+
@echo "Usage: make [target]"
58+
@echo ""
59+
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':'

0 commit comments

Comments
 (0)