Skip to content

Add sudo to installation steps #4

Add sudo to installation steps

Add sudo to installation steps #4

Workflow file for this run

name: Execute GoTasker Unit Tests
on:
push:
branches:
- main
paths-ignore:
- "**/*.md"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.22.0'
- name: Install GO linter
run: |
sudo apt-get install golint
- name: Run linter
run: |
golint -set_exit_status ./...
- name: Run go vet
run: |
go vet ./...
- name: Execute unit tests
run: |
go test ./... -coverprofile coverage.out -covermode count
go tool cover -func coverage.out
- name: Quality Gate - Test coverage shall be above threshold
env:
TESTCOVERAGE_THRESHOLD: 75
run: |
echo "Quality Gate: checking test coverage is above threshold ..."
echo "Threshold : $TESTCOVERAGE_THRESHOLD %"
totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
echo "Current test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "OK"
else
echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value."
echo "Failed"
exit 1
fi