Skip to content

*_if aggregate functions #296

*_if aggregate functions

*_if aggregate functions #296

Workflow file for this run

name: Build/Unit tests/Coverage
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: Build
run: go build -v ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
args: --verbose --timeout 10m --fix=false --config=.golangci.yml ./pkg/...
- name: Generate coverage report for coveralls.io
run: |
go test -coverprofile=/var/tmp/capillaries.p.tmp -cover $(find ./ -name '*_test.go' -printf "%h\n" | sort -u)
cat /var/tmp/capillaries.p.tmp | grep -v "donotcover" > /var/tmp/capillaries.p
- name: Send coverage to coveralls.io
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=/var/tmp/capillaries.p -service=github
- name: pkg/cql test coverage threshold check
env:
TESTCOVERAGE_THRESHOLD: 87.6
run: |
go test -v ./pkg/cql/... -coverprofile coverage.out -covermode count
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then
echo -e "\033[32mOK: $totalCoverage >= $TESTCOVERAGE_THRESHOLD\033[0m"
else
echo -e "\033[31mFAILED: $totalCoverage < $TESTCOVERAGE_THRESHOLD. Cover more with unit tests or adjust threshold to a lower value.\033[0m"
exit 1
fi
- name: pkg/custom/py_calc test coverage threshold check
env:
TESTCOVERAGE_THRESHOLD: 83.7
run: |
go test -v ./pkg/custom/py_calc/... -coverprofile coverage.out -covermode count
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then
echo -e "\033[32mOK: $totalCoverage >= $TESTCOVERAGE_THRESHOLD\033[0m"
else
echo -e "\033[31mFAILED: $totalCoverage < $TESTCOVERAGE_THRESHOLD. Cover more with unit tests or adjust threshold to a lower value.\033[0m"
exit 1
fi
- name: pkg/custom/tag_and_denormalize test coverage threshold check
env:
TESTCOVERAGE_THRESHOLD: 81.7
run: |
go test -v ./pkg/custom/tag_and_denormalize/... -coverprofile coverage.out -covermode count
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then
echo -e "\033[32mOK: $totalCoverage >= $TESTCOVERAGE_THRESHOLD\033[0m"
else
echo -e "\033[31mFAILED: $totalCoverage < $TESTCOVERAGE_THRESHOLD. Cover more with unit tests or adjust threshold to a lower value.\033[0m"
exit 1
fi
- name: pkg/dpc test coverage threshold check
env:
TESTCOVERAGE_THRESHOLD: 85.7
run: |
go test -v ./pkg/dpc/... -coverprofile coverage.out -covermode count
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then
echo -e "\033[32mOK: $totalCoverage >= $TESTCOVERAGE_THRESHOLD\033[0m"
else
echo -e "\033[31mFAILED: $totalCoverage < $TESTCOVERAGE_THRESHOLD. Cover more with unit tests or adjust threshold to a lower value.\033[0m"
exit 1
fi
- name: pkg/eval test coverage threshold check
env:
TESTCOVERAGE_THRESHOLD: 97.4
run: |
go test -v ./pkg/eval/... -coverprofile coverage.out -covermode count
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then
echo -e "\033[32mOK: $totalCoverage >= $TESTCOVERAGE_THRESHOLD\033[0m"
else
echo -e "\033[31mFAILED: $totalCoverage < $TESTCOVERAGE_THRESHOLD. Cover more with unit tests or adjust threshold to a lower value.\033[0m"
exit 1
fi
- name: pkg/sc test coverage threshold check
env:
TESTCOVERAGE_THRESHOLD: 91.7
run: |
go test -v ./pkg/sc/... -coverprofile coverage.out -covermode count
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then
echo -e "\033[32mOK: $totalCoverage >= $TESTCOVERAGE_THRESHOLD\033[0m"
else
echo -e "\033[31mFAILED: $totalCoverage < $TESTCOVERAGE_THRESHOLD. Cover more with unit tests or adjust threshold to a lower value.\033[0m"
exit 1
fi