Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: CI

on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]

# Prevent concurrent workflow runs on same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write
checks: write

jobs:
build-and-test:
name: Build and Test (Go ${{ matrix.go-version }})
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
go-version: ['1.25']
include:
- go-version: '1.25'
race: true
Comment thread
coderabbitai[bot] marked this conversation as resolved.

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true

- name: Download dependencies
run: go mod download

- name: Build
run: go build -v ./...

- name: Run tests
run: |
if [ "${{ matrix.go-version }}" = "1.25" ]; then
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
else
go test -v -short ./...
fi

- name: Verify module validity
run: |
go mod verify
go build -v ./...

- name: Upload coverage
if: matrix.race == true
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.out

test-coverage:
name: Coverage Report
needs: build-and-test
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Download dependencies
run: go mod download

- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage
path: .

- name: Generate coverage report
run: |
go test -coverprofile=coverage.out -covermode=atomic ./...

- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.out
flags: unittests
name: fingerprintproxy
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Coverage Summary
run: |
echo "## Coverage Summary" >> "$GITHUB_STEP_SUMMARY"
go tool cover -func=coverage.out >> "$GITHUB_STEP_SUMMARY"

cross-platform:
name: Cross-platform Build
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ['1.25']
include:
- os: ubuntu-latest
artifact_suffix: '-linux-amd64'
goarch: amd64
- os: macos-latest
artifact_suffix: '-darwin-arm64'
goarch: arm64
- os: windows-latest
artifact_suffix: '-windows-amd64.exe'
goarch: amd64

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true

- name: Build
run: go build -ldflags="-s -w" -o fingerprintproxy${{ matrix.artifact_suffix }} .
env:
GOARCH: ${{ matrix.goarch }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: fingerprintproxy${{ matrix.artifact_suffix }}
path: fingerprintproxy${{ matrix.artifact_suffix }}
59 changes: 59 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Dependencies

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
go-mod-updater:
name: Update Go Dependencies
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Update dependencies
run: |
go get -u ./...
go mod tidy

- name: Create PR with updates
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore(deps): update Go dependencies'
title: 'Chore: Update Go Dependencies'
body: |
This PR updates Go module dependencies.

## Update Summary
- Run `go mod tidy` to clean up dependencies
- Run `go get -u ./...` to update indirect dependencies

Please review the changes before merging.
labels: dependencies, automated
branch: dependency-updates
delete-branch: true
draft: true

# Enable Dependabot for GitHub Actions as well
# Note: Add .github/dependabot.yml manually for Actions updates
138 changes: 138 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Lint

on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
STATICCHECK_VERSION: '0.7.0'
ACTIONLINT_VERSION: '1.7.1'

jobs:
golangci-lint:
name: Lint with golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Download dependencies
run: go mod download

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.11.4
args: --timeout=5m

gofmt:
name: Check formatting
runs-on: ubuntu-latest
timeout-minutes: 2
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Check formatting
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "The following files are not formatted correctly:"
gofmt -l .
exit 1
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

govet:
name: Run go vet
runs-on: ubuntu-latest
timeout-minutes: 3
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Download dependencies
run: go mod download

- name: Run go vet
run: go vet ./...

staticcheck:
name: Static Analysis
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Download dependencies
run: go mod download

- name: Install staticcheck
run: go install "honnef.co/go/tools/cmd/staticcheck@v${STATICCHECK_VERSION}"

- name: Run staticcheck
run: staticcheck ./...
Comment thread
coderabbitai[bot] marked this conversation as resolved.

actionlint:
name: Workflow Lint
runs-on: ubuntu-latest
timeout-minutes: 2
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Install actionlint
run: go install "github.com/rhysd/actionlint/cmd/actionlint@v${ACTIONLINT_VERSION}"

- name: Run actionlint
run: actionlint
shell: bash
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
id-token: write

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

# Nightly builds available via workflow_dispatch
# To enable: remove the "if: false" line and trigger manually
Loading
Loading