Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C++ coverage report workflow #3179

Merged
merged 4 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Generate API Coverage

on:
workflow_dispatch:

jobs:
generate-coverage-report:
runs-on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Dependencies
uses: ./.github/actions/setup-dependencies
with:
use_ccache: false

- name: Generate C++ Coverage
working-directory: ./cpp
run: ../scripts/generate-code-coverage.sh

- name: Generate C++ Coverage Reports
working-directory: ./cpp
run: |
for binary in bin/*; do
../scripts/generate-code-coverage.sh "$binary"
done

for library in lib/*; do
if [[ $library =~ lib/lib[a-zA-Z0-9]+\.dylib ]]; then
../scripts/generate-code-coverage.sh "$library"
fi
done

# This will perform a full sync of the documentation to S3 every time the workflow is run since
externl marked this conversation as resolved.
Show resolved Hide resolved
# the timestamps will always be different. Using --size-only is not sufficient since the
# documentation may be updated without changing the size of the files. S3 does not offer a hash based sync.
- name: Sync Documentation to S3
working-directory: ./cpp/coverage/html
run: |
for coverage_dir in *; do
if [[ -d $coverage_dir ]]; then
aws s3 sync $coverage_dir s3://${AWS_S3_CODE_BUCKET}/ice/cpp/main/coverage/$(basename $coverage_dir) --delete
fi
done

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_CODE_BUCKET: ${{ secrets.AWS_S3_CODE_BUCKET }}
AWS_DEFAULT_REGION: us-east-1
if: github.ref == 'refs/heads/main'
10 changes: 3 additions & 7 deletions scripts/generate-code-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,12 @@ if [ -e default.profdata ]; then
echo "Remove default.profdata to rebuild code coverage"
else
echo "Building with code coverage..."
if [ -z "$MAKEFLAGS" ]; then
ncpu=$(sysctl -n hw.ncpu)
export MAKEFLAGS="-j$ncpu"
fi

ncpu=$(sysctl -n hw.ncpu)
make clean
make
make "-j$ncpu"

echo "Running tests..."
python3 allTests.py --all --workers=8
python3 allTests.py --all --workers="$ncpu"

echo "Merge coverage data..."
${CLI_TOOLS}/llvm-profdata merge -o default.profdata coverage/*.profraw
Expand Down