fix: resolve export mode inversion and optimize performance #323
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: Go Tests | |
| on: | |
| push: | |
| branches: [main, feature/*, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| test: | |
| name: Run Go Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.21" | |
| cache: true | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: go test -v ./... | |
| - name: Check test coverage | |
| run: | | |
| # Run tests with coverage, excluding main package | |
| go test -coverprofile=coverage.out ./pkg/... | |
| COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%') | |
| echo "Total coverage (excluding main package): $COVERAGE%" | |
| if (( $(echo "$COVERAGE < 55" | bc -l) )); then | |
| echo "Code coverage is below 55%. Please add more tests." | |
| echo "Target coverage goal: 70% (gradually increasing)" | |
| exit 1 | |
| fi | |
| echo "✅ Coverage check passed! Current: $COVERAGE%, Target: 70%" | |
| - name: Generate coverage report | |
| run: go tool cover -html=coverage.out -o coverage.html | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage.html |