Add more config variables #54
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: Test | |
| on: | |
| push: | |
| branches: [main, feat/*] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| env: | |
| GO_VERSION: "1.24.9" | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.out ./... | |
| - name: Check coverage | |
| run: | | |
| COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//') | |
| echo "Total coverage: ${COVERAGE}%" | |
| if (( $(echo "$COVERAGE < 30" | bc -l) )); then | |
| echo "Warning: Coverage below 30%" | |
| fi | |
| - name: Build all packages | |
| run: go build ./... | |
| - name: Build examples | |
| run: | | |
| for example in $(find examples -name main.go); do | |
| echo "Building $example..." | |
| go build "$example" | |
| done | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Check formatting | |
| run: | | |
| if [ -n "$(gofmt -s -l .)" ]; then | |
| echo "Go code is not formatted:" | |
| gofmt -s -d . | |
| exit 1 | |
| fi |