refactor: move test files from root to test directory #44
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 | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Build | |
| run: go build -v ./... | |
| - name: Test | |
| 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 "Coverage: $COVERAGE%" | |
| if (( $(echo "$COVERAGE < 20" | bc -l) )); then | |
| echo "Coverage $COVERAGE% is below 20% threshold" | |
| exit 1 | |
| fi | |
| shell: bash | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v4 | |
| with: | |
| version: latest | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage.out | |
| flags: unittests |