From 3eb1424cb9165ae7e090cd5dcf80409c675905db Mon Sep 17 00:00:00 2001 From: Joe George Date: Fri, 22 Nov 2024 11:14:26 -0500 Subject: [PATCH 1/4] Add C++ coverage workflow --- .github/workflows/coverage.yml | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..ed7aa07cb29 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,56 @@ +name: Generate API Coverage + +on: + workflow_dispatch: + push: + branches: ["coverage-ci"] + +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-reports.sh "$binary" + done + + for library in lib/*; do + if [[ $library =~ lib/lib[a-zA-Z0-9]+\.dylib ]]; then + ../scripts/generate-code-coverage-reports.sh "$library" + fi + done + + # This will perform a full sync of the documentation to S3 every time the workflow is run since + # 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. + # + # Additionally, we do not cache the doxygen output since it does not remove files old files. + - 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' && github.event_name != 'pull_request' From 8c9145da18d8942f0eab3e7f79cd77858dc2d9b8 Mon Sep 17 00:00:00 2001 From: Joe George Date: Fri, 22 Nov 2024 11:30:11 -0500 Subject: [PATCH 2/4] fixes --- .github/workflows/coverage.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ed7aa07cb29..68894d46671 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -25,12 +25,12 @@ jobs: working-directory: ./cpp run: | for binary in bin/*; do - ../scripts/generate-code-coverage-reports.sh "$binary" + ../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-reports.sh "$library" + ../scripts/generate-code-coverage.sh "$library" fi done @@ -53,4 +53,4 @@ jobs: 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' && github.event_name != 'pull_request' + # if: github.ref == 'refs/heads/main' From f4b3a55cb98b1cfab7883b185dad58c7b95c2c88 Mon Sep 17 00:00:00 2001 From: Joe George Date: Fri, 22 Nov 2024 14:05:49 -0500 Subject: [PATCH 3/4] fixes --- .github/workflows/coverage.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 68894d46671..7a277eaee4e 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -2,8 +2,6 @@ name: Generate API Coverage on: workflow_dispatch: - push: - branches: ["coverage-ci"] jobs: generate-coverage-report: @@ -53,4 +51,4 @@ jobs: 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' + if: github.ref == 'refs/heads/main' From 727fbe799fb1102a5afba6a8cf86a7e86fa5d834 Mon Sep 17 00:00:00 2001 From: Joe George Date: Mon, 2 Dec 2024 09:16:52 -0500 Subject: [PATCH 4/4] Fixes --- .github/workflows/coverage.yml | 2 -- scripts/generate-code-coverage.sh | 10 +++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7a277eaee4e..2b073e4f63c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -35,8 +35,6 @@ jobs: # This will perform a full sync of the documentation to S3 every time the workflow is run since # 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. - # - # Additionally, we do not cache the doxygen output since it does not remove files old files. - name: Sync Documentation to S3 working-directory: ./cpp/coverage/html run: | diff --git a/scripts/generate-code-coverage.sh b/scripts/generate-code-coverage.sh index 16e5a474e50..67348af9cae 100755 --- a/scripts/generate-code-coverage.sh +++ b/scripts/generate-code-coverage.sh @@ -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