Compare commits

4 Commits
v0.1.0 ... main

Author SHA1 Message Date
Kevin McIntyre
70b2d55613 style: fix gofmt formatting in cmd and internal packages
All checks were successful
CI / Test (push) Successful in 57s
CI / Lint (push) Successful in 14s
CI / Benchmark (push) Successful in 3m27s
2026-02-10 14:00:27 -05:00
Kevin McIntyre
4dfeb64364 ci: add workflow_dispatch trigger to CI workflow
Some checks failed
CI / Test (push) Failing after 32s
CI / Lint (push) Failing after 29s
CI / Benchmark (push) Failing after 38s
2026-02-10 13:08:02 -05:00
Kevin McIntyre
394dcddfd6 ci: add Gitea Actions workflows
Add ci.yml (test, lint, benchmark) and release.yml (cross-compile
builds) compatible with Gitea Actions. Uses upload-artifact@v3
instead of v4 which is unsupported on Gitea.
2026-02-10 12:24:04 -05:00
Kevin McIntyre
7db655a698 chore: remove GitHub Actions workflows
These workflows were designed for GitHub Actions and don't apply
to the Gitea runner. Remove to avoid blocking the CI queue.
2026-02-10 10:28:18 -05:00
12 changed files with 166 additions and 468 deletions

80
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,80 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
GO_VERSION: "1.24"
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Build
run: go build -v ./...
- name: Run go vet
run: go vet ./...
- name: Run tests
run: go test -v -race ./...
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Check formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "The following files are not formatted properly:"
gofmt -s -l .
exit 1
fi
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Run staticcheck
run: staticcheck ./...
benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Run benchmarks
run: go test -bench=. -benchmem -count=1 ./...

View File

@@ -0,0 +1,79 @@
name: Release
on:
push:
tags:
- 'v*'
env:
GO_VERSION: "1.24"
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Run tests
run: go test -race ./...
- name: Run go vet
run: go vet ./...
build:
name: Build (${{ matrix.goos }}, ${{ matrix.goarch }})
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: ""
- goos: linux
goarch: arm64
suffix: ""
- goos: darwin
goarch: amd64
suffix: ""
- goos: darwin
goarch: arm64
suffix: ""
- goos: windows
goarch: amd64
suffix: ".exe"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
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.BuildDate=$DATE"
mkdir -p dist
go build -ldflags "$LDFLAGS" -o "dist/jdenticon-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}" ./cmd/jdenticon/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: jdenticon-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/

View File

@@ -1,250 +0,0 @@
name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
env:
GO_VERSION: "1.24"
jobs:
# Core testing across multiple Go versions and platforms
test:
name: Test (Go ${{ matrix.go-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ["1.24.x"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Build
run: go build -v ./...
- name: Run go vet
run: go vet ./...
- name: Run tests
run: go test -v ./...
- name: Run tests with race detector
run: go test -race -v ./...
# Code quality and linting
lint:
name: Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-
- name: Download dependencies
run: go mod download
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
- name: Check formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "The following files are not formatted properly:"
gofmt -s -l .
exit 1
fi
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Run staticcheck
run: staticcheck ./...
# Security scanning
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Run govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
- name: Run gosec security scanner
run: |
go install github.com/securego/gosec/v2/cmd/gosec@latest
gosec ./...
# Test coverage
coverage:
name: Test Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-
- name: Download dependencies
run: go mod download
- name: Run tests with coverage
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.txt
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
# Benchmarks
benchmark:
name: Benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-
- name: Download dependencies
run: go mod download
- name: Run benchmarks
run: go test -bench=. -benchmem -count=3 ./... > benchmark_results.txt
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark_results.txt
retention-days: 30
# Build verification for CLI tool
build:
name: Build CLI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-
- name: Download dependencies
run: go mod download
- name: Build CLI tool
run: go build -v -o jdenticon-cli ./cmd/jdenticon
- name: Test CLI tool
run: |
./jdenticon-cli generate --help
./jdenticon-cli generate "test@example.com" -s 64 -o test.svg
test -f test.svg
- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: jdenticon-cli-linux
path: jdenticon-cli
retention-days: 7

View File

@@ -1,84 +0,0 @@
name: Benchmarks
on:
pull_request:
paths:
- '**/*.go'
- 'go.mod'
- 'go.sum'
push:
branches: [main]
paths:
- '**/*.go'
- 'go.mod'
- 'go.sum'
workflow_dispatch:
env:
GO_VERSION: "1.24"
jobs:
benchmarks:
name: Run Benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Run benchmarks
run: |
go test -bench=. -benchmem -count=3 ./... | tee benchmark_results.txt
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark_results.txt
retention-days: 30
- name: Comment benchmark results on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
let comment = '## 📊 Benchmark Results\n\n';
try {
if (fs.existsSync('benchmark_results.txt')) {
const benchmarks = fs.readFileSync('benchmark_results.txt', 'utf8');
const lines = benchmarks.split('\n').filter(line =>
line.includes('Benchmark') || line.includes('ns/op') || line.includes('ok')
);
if (lines.length > 0) {
comment += '```\n';
comment += lines.slice(0, 20).join('\n');
if (lines.length > 20) {
comment += `\n... and ${lines.length - 20} more lines\n`;
}
comment += '\n```\n';
} else {
comment += 'No benchmark results found.\n';
}
}
} catch (error) {
comment += `⚠️ Could not read benchmark results: ${error.message}\n`;
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});

View File

@@ -1,127 +0,0 @@
name: Release
on:
push:
tags:
- 'v*'
env:
GO_VERSION: "1.24"
permissions:
contents: write
jobs:
# Run tests before releasing
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Run tests
run: go test -race ./...
- name: Run go vet
run: go vet ./...
# Build binaries for multiple platforms
build:
name: Build
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: ""
- goos: linux
goarch: arm64
suffix: ""
- goos: darwin
goarch: amd64
suffix: ""
- goos: darwin
goarch: arm64
suffix: ""
- goos: windows
goarch: amd64
suffix: ".exe"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Download dependencies
run: go mod download
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
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.BuildDate=$DATE"
mkdir -p dist
go build -ldflags "$LDFLAGS" -o "dist/jdenticon-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}" ./cmd/jdenticon/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: jdenticon-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/
# Create GitHub release with all binaries
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release
find artifacts -type f -name "jdenticon-*" -exec cp {} release/ \;
ls -la release/
# Create checksums
cd release
sha256sum * > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
release/*
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -14,10 +14,10 @@ import (
"sync/atomic"
"syscall"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
"github.com/mattn/go-isatty"
"github.com/schollz/progressbar/v3"
"github.com/spf13/cobra"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
)
const (

View File

@@ -11,9 +11,9 @@ import (
"testing"
"time"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
)
// TestBatchCommand tests the batch command functionality

View File

@@ -8,8 +8,8 @@ import (
"runtime"
"strings"
"github.com/spf13/cobra"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
"github.com/spf13/cobra"
)
// isRootPath checks if the given path is a filesystem root.

View File

@@ -9,9 +9,9 @@ import (
"strings"
"testing"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
)
// TestGenerateCommand tests the generate command functionality

View File

@@ -7,9 +7,9 @@ import (
"strconv"
"strings"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"gitea.dockr.co/kev/go-jdenticon/jdenticon"
)
const (

View File

@@ -5,8 +5,8 @@ import (
"strconv"
"sync/atomic"
lru "github.com/hashicorp/golang-lru/v2"
"gitea.dockr.co/kev/go-jdenticon/internal/constants"
lru "github.com/hashicorp/golang-lru/v2"
)
// CacheMetrics holds cache performance metrics using atomic operations for efficiency

View File

@@ -6,9 +6,9 @@ import (
"strconv"
"sync"
lru "github.com/hashicorp/golang-lru/v2"
"gitea.dockr.co/kev/go-jdenticon/internal/constants"
"gitea.dockr.co/kev/go-jdenticon/internal/util"
lru "github.com/hashicorp/golang-lru/v2"
"golang.org/x/sync/singleflight"
)