diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index fbee83e..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/.github/workflows/performance-regression.yml b/.github/workflows/performance-regression.yml deleted file mode 100644 index 1461b68..0000000 --- a/.github/workflows/performance-regression.yml +++ /dev/null @@ -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 - }); diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index faf9da5..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -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 }}