fix:(cos): Use cos custom directory #777
Workflow file for this run
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: Internal Packages Tests | |
| on: | |
| pull_request: | |
| workflow_call: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test Internal Packages | |
| runs-on: [self-hosted-linux-amd64-noble-edge] | |
| env: | |
| COVERAGE_THRESHOLD: 85 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: 1.25 | |
| - name: Ensure No Formatting Changes | |
| run: | | |
| go fmt ./... | |
| git diff --exit-code | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.11.4 | |
| - name: Run Unit and Integration Test of internal packages | |
| env: | |
| POSTGRESQL_DB_CONNECT_STRING: postgres://postgres:postgres@localhost:5432/postgres | |
| run: | | |
| # Clear test cache to ensure coverage is calculated fresh | |
| go clean -testcache | |
| # We exclude packages from coverage analysis as they are highly uncovered at the moment | |
| EXCLUDE_PKGS="internal/telemetry" | |
| COVER_PKG=$(go list ./internal/... | grep -Ev "$EXCLUDE_PKGS" | tr '\n' ',') | |
| go test -v -count=1 -coverprofile=coverage.out -race -tags=integration -coverpkg=$COVER_PKG ./internal/... | |
| - name: Print coverage report | |
| run: | | |
| go tool cover -func=coverage.out | |
| - name: Generate coverage report | |
| run: go tool cover -html=coverage.out -o=coverage.html | |
| - uses: actions/upload-artifact@v7.0.0 | |
| with: | |
| name: coverage-report | |
| path: coverage.html | |
| - name: Enforce min coverage | |
| run: | | |
| if ! go tool cover -func=coverage.out | tail -1 | awk '{if ($3 < ENVIRON["COVERAGE_THRESHOLD"]) exit 1}'; then | |
| echo "::error::Code coverage is below $COVERAGE_THRESHOLD" | |
| exit 1 | |
| fi | |
| services: | |
| postgres: | |
| image: postgres:16.13 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 |