Skip to content

Add coverage (goveralls) github action #10

Add coverage (goveralls) github action

Add coverage (goveralls) github action #10

Workflow file for this run

on:
push:
branches:
- master
pull_request:
name: Coverage
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.25.x'
- name: Checkout code
uses: actions/checkout@v4
- name: Generate coverage
run: |
set +e # Don't exit on error, we'll handle failures explicitly
# Generate unit test coverage
echo "mode: count" > acc.out
for Dir in . $(find ./* -maxdepth 10 -type d | grep -v vendor); do
if ls $Dir/*.go &> /dev/null; then
returnval=$(go test -coverprofile=profile.out -covermode=count $Dir 2>&1)
test_exit_code=$?
echo ${returnval}
if [[ ${returnval} != *FAIL* ]] && [[ ${returnval} != *"no test files"* ]]; then
if [ -f profile.out ]; then
cat profile.out | grep -v "mode: count" >> acc.out
fi
fi
fi
done
set -e # Re-enable exit on error for the merge step
# Merge coverage files using the project's merge script
cat acc.out | go run scripts/merge-coverprofile.go > profile.cov
rm -rf ./profile.out ./acc.out
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov