diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cef2efd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: Go CI +on: + pull_request: + branches: + - beck-onix-v1.0-develop + - beck-onix-v1.0 + push: + branches: + - beck-onix-v1.0-develop + - beck-onix-v1.0 +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.20' + - name: Install dependencies + run: go mod tidy + - name: Run tests + run: go test -coverprofile=coverage.out ./... + - name: Check coverage + run: | + coverage=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//') + if (( $(echo "$coverage < 90" | bc -l) )); then + echo "Coverage is below 90%" + exit 1 + fi + - name: Run golangci-lint + run: golangci-lint run + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + files: ./coverage.out