-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): add comprehensive GitHub Actions workflows for CI/CD #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a3c514a
feat(ci): add comprehensive GitHub Actions workflows for CI/CD
a3bb89c
fix(ci): resolve GitHub Actions workflow failures
c5e4dc6
fix(ci): resolve remaining workflow failures
38d6d34
fix(ci): update linter versions for Go 1.25 compatibility
3cb637e
fix(errcheck): handle unchecked error return values
bbfa6e3
fix(ci): address workflow review findings
d8020af
fix(ci): fix cross-platform build GOARCH configuration
ce1d80b
fix(ci): use YAML env block for cross-platform GOARCH
cd2e746
fix(ci): pin tool versions and add gofmt setup
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| 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 }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
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 ./... | ||
|
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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| # Nightly builds available via workflow_dispatch | ||
| # To enable: remove the "if: false" line and trigger manually | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.