fix: resolve race conditions in monitor tests #41
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 Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| name: Linting | |
| 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.25" | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Format check | |
| run: | | |
| if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | |
| echo "The following files are not formatted:" | |
| gofmt -s -l . | |
| exit 1 | |
| fi | |
| - name: Build check | |
| run: go build ./... | |
| test: | |
| name: Tests & Coverage | |
| 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.25" | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Run tests with coverage | |
| run: go test -v -race -coverprofile=coverage.out ./... | |
| - 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 | |
| benchmark: | |
| name: Performance Benchmarks | |
| 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.25" | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Run benchmarks | |
| run: go test -bench=. -benchmem ./tests | |
| build: | |
| name: Build & Release | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.25" | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Create dist directory | |
| run: mkdir -p dist | |
| - name: Build for multiple platforms | |
| run: | | |
| GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/sqlparser-linux-amd64 ./cmd/sqlparser | |
| GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o dist/sqlparser-darwin-amd64 ./cmd/sqlparser | |
| GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o dist/sqlparser-darwin-arm64 ./cmd/sqlparser | |
| GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/sqlparser-windows-amd64.exe ./cmd/sqlparser | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sql-parser-binaries | |
| path: dist/ | |
| retention-days: 30 |