From 0d4cee69f677121cd1b8485805b54ca9fbf7c977 Mon Sep 17 00:00:00 2001 From: Faiz Mohammed Date: Thu, 13 Feb 2025 12:43:03 +0530 Subject: [PATCH] Create ci.yml created ci.yml file for configuring the ci workflow --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/ci.yml 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