Skip to content

Commit 5caf6bc

Browse files
committed
Batman
0 parents  commit 5caf6bc

44 files changed

Lines changed: 4166 additions & 0 deletions

Some content is hidden

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

.devcontainer/devcontainer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Go Dev Environment",
3+
"image": "mcr.microsoft.com/devcontainers/go:1-1.23-bullseye",
4+
"features": {},
5+
"customizations": {
6+
"vscode": {
7+
"extensions": [
8+
"golang.Go",
9+
"ms-vscode.vscode-json",
10+
"ms-vscode.vscode-yaml"
11+
]
12+
}
13+
},
14+
"forwardPorts": [],
15+
"postCreateCommand": "go mod tidy"
16+
}

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_call:
9+
10+
permissions:
11+
contents: read
12+
security-events: write # Required for uploading SARIF results
13+
14+
jobs:
15+
test:
16+
name: Test and Lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.23'
26+
cache: true
27+
28+
- name: Download dependencies
29+
run: go mod download
30+
31+
- name: Verify dependencies
32+
run: go mod verify
33+
34+
- name: Check Go formatting
35+
run: |
36+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
37+
echo "The following files are not formatted:"
38+
gofmt -s -l .
39+
echo "Please run 'gofmt -s -w .'"
40+
exit 1
41+
fi
42+
43+
- name: Run go vet
44+
run: go vet ./...
45+
46+
- name: Run tests
47+
run: go test -v -race -coverprofile=coverage.out ./...
48+
49+
- name: Display test coverage
50+
run: go tool cover -func=coverage.out
51+
52+
- name: Upload coverage to Codecov
53+
uses: codecov/codecov-action@v3
54+
with:
55+
file: ./coverage.out
56+
flags: unittests
57+
name: codecov-umbrella
58+
59+
build:
60+
name: Build
61+
runs-on: ubuntu-latest
62+
needs: test
63+
strategy:
64+
matrix:
65+
goos: [linux]
66+
goarch: [amd64, arm64]
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v4
70+
71+
- name: Set up Go
72+
uses: actions/setup-go@v5
73+
with:
74+
go-version: '1.23'
75+
cache: true
76+
77+
- name: Build binary
78+
env:
79+
GOOS: ${{ matrix.goos }}
80+
GOARCH: ${{ matrix.goarch }}
81+
run: |
82+
binary_name="feature-installer"
83+
if [ "$GOOS" = "windows" ]; then
84+
binary_name="${binary_name}.exe"
85+
fi
86+
go build -v -o "${binary_name}" .
87+
echo "Built binary for $GOOS/$GOARCH: $(file ${binary_name} || echo 'Windows binary')"
88+
89+
security:
90+
name: Security Scan
91+
runs-on: ubuntu-latest
92+
permissions:
93+
contents: read
94+
security-events: write # Required for uploading SARIF results
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@v4
98+
99+
- name: Set up Go
100+
uses: actions/setup-go@v5
101+
with:
102+
go-version: '1.23'
103+
104+
- name: Run Trivy vulnerability scanner
105+
uses: aquasecurity/trivy-action@master
106+
with:
107+
scan-type: 'fs'
108+
scan-ref: '.'
109+
format: 'sarif'
110+
output: 'trivy-results.sarif'
111+
112+
- name: Upload Trivy scan results to GitHub Security tab
113+
uses: github/codeql-action/upload-sarif@v3
114+
if: always()
115+
with:
116+
sarif_file: 'trivy-results.sarif'

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
security-events: write
11+
12+
jobs:
13+
# First run the CI checks
14+
ci:
15+
uses: ./.github/workflows/ci.yml
16+
permissions:
17+
contents: read
18+
security-events: write
19+
20+
release:
21+
runs-on: ubuntu-latest
22+
needs: ci
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: '1.23'
32+
- name: Run GoReleaser
33+
uses: goreleaser/goreleaser-action@v5
34+
with:
35+
version: latest
36+
args: release --clean
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (uncomment if using go mod)
15+
# vendor/
16+
17+
# Go workspace file
18+
go.work
19+
20+
# IDE files
21+
.vscode/
22+
.idea/
23+
24+
# OS files
25+
.DS_Store
26+
Thumbs.db
27+
28+
# Goreleaser
29+
dist/
30+
31+
32+
feature-installer

.goreleaser.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
project_name: feature-installer
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
goarch:
13+
- amd64
14+
- arm64
15+
16+
archives:
17+
- format: tar.gz
18+
name_template: >-
19+
{{ .ProjectName }}_
20+
{{- title .Os }}_
21+
{{- if eq .Arch "amd64" }}x86_64
22+
{{- else if eq .Arch "386" }}i386
23+
{{- else }}{{ .Arch }}{{ end }}
24+
{{- if .Arm }}v{{ .Arm }}{{ end }}
25+
26+
changelog:
27+
sort: asc
28+
filters:
29+
exclude:
30+
- '^docs:'
31+
- '^test:'
32+
33+
release:
34+
github:
35+
owner: devcontainer-community
36+
name: feature-installer

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright (c) 2025 devcontainer.community
2+
3+
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:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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.

Makefile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Makefile for feature-installer
2+
3+
.PHONY: help build test lint fmt vet clean install deps check
4+
5+
# Default target
6+
help: ## Show this help message
7+
@echo 'Usage: make [target]'
8+
@echo ''
9+
@echo 'Targets:'
10+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
11+
12+
# Build the binary
13+
build: ## Build the binary
14+
go build -v -o feature-installer .
15+
16+
# Run tests
17+
test: ## Run all tests
18+
go test -v -race ./...
19+
20+
# Run tests with coverage
21+
test-coverage: ## Run tests with coverage report
22+
go test -v -race -coverprofile=coverage.out ./...
23+
go tool cover -html=coverage.out -o coverage.html
24+
@echo "Coverage report generated: coverage.html"
25+
26+
# Format code
27+
fmt: ## Format Go code
28+
go fmt ./...
29+
gofmt -s -w .
30+
31+
# Run go vet
32+
vet: ## Run go vet
33+
go vet ./...
34+
35+
# Run linting (if golangci-lint is available)
36+
lint: ## Run golangci-lint (requires golangci-lint to be installed)
37+
@which golangci-lint > /dev/null || (echo "golangci-lint not found. Install from https://golangci-lint.run/usage/install/" && exit 1)
38+
golangci-lint run
39+
40+
# Install dependencies
41+
deps: ## Download and verify dependencies
42+
go mod download
43+
go mod verify
44+
go mod tidy
45+
46+
# Run all checks (format, vet, test)
47+
check: fmt vet test ## Run formatting, vetting, and tests
48+
49+
# Clean build artifacts
50+
clean: ## Clean build artifacts
51+
rm -f feature-installer
52+
rm -f coverage.out coverage.html
53+
go clean -cache
54+
go clean -testcache
55+
56+
# Install the binary
57+
install: ## Install the binary to $GOPATH/bin
58+
go install .
59+
60+
# Run the CI checks locally
61+
ci-local: deps fmt vet test ## Run the same checks as CI
62+
63+
# Build for multiple platforms
64+
build-all: ## Build for multiple platforms
65+
GOOS=linux GOARCH=amd64 go build -o feature-installer-linux-amd64 .
66+
GOOS=linux GOARCH=arm64 go build -o feature-installer-linux-arm64 .
67+
GOOS=darwin GOARCH=amd64 go build -o feature-installer-darwin-amd64 .
68+
GOOS=darwin GOARCH=arm64 go build -o feature-installer-darwin-arm64 .
69+
GOOS=windows GOARCH=amd64 go build -o feature-installer-windows-amd64.exe .
70+
71+
# Development target - watch for changes and run tests
72+
dev: ## Run tests in watch mode (requires entr: brew install entr)
73+
find . -name "*.go" | entr -c make test

0 commit comments

Comments
 (0)