feat:[ add telemetry ] #65
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
| name: CI/CD Pipeline | |
| # This workflow runs only when core application files are changed | |
| # Triggers: internal/**, main.go, go.mod, go.sum, Dockerfile, .dockerignore, workflow files | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| paths: | |
| - 'internal/**' # Core application code | |
| - 'main.go' # Main application entry point | |
| - 'go.mod' # Go module dependencies | |
| - 'go.sum' # Go module checksums | |
| - 'Dockerfile' # Docker configuration | |
| - '.dockerignore' # Docker ignore file | |
| - '.github/workflows/**' # CI/CD workflow changes | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'internal/**' | |
| - 'main.go' | |
| - 'go.mod' | |
| - 'go.sum' | |
| - 'Dockerfile' | |
| - '.dockerignore' | |
| - '.github/workflows/**' | |
| release: | |
| types: [ published ] | |
| env: | |
| GO_VERSION: '1.22' | |
| jobs: | |
| unit-test: | |
| name: Unit Tests | |
| 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 }} | |
| cache: true | |
| - name: Run unit tests | |
| run: | | |
| go test -v -race -coverprofile=coverage.out -short ./... | |
| - name: Generate coverage report | |
| run: | | |
| go tool cover -html=coverage.out -o coverage.html | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.out | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| integration-test: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Run integration tests | |
| env: | |
| FACEIT_API_KEY: ${{ secrets.FACEIT_API_KEY }} | |
| run: | | |
| go test -v -race ./internal/repository/... | |
| lint: | |
| name: Lint | |
| 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 }} | |
| cache: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v6 | |
| with: | |
| version: latest | |
| args: --timeout=5m | |