diff --git a/.github/.codecov.yml b/.github/.codecov.yml new file mode 100644 index 000000000..bcb9d02db --- /dev/null +++ b/.github/.codecov.yml @@ -0,0 +1,8 @@ +# https://docs.codecov.com/docs/common-recipe-list + +comment: # this is a top-level key + layout: "reach, diff, flags, files" + behavior: default + require_changes: false # if true: only post the comment if coverage changes + require_base: no # [yes :: must have a base report to post] + require_head: yes # [yes :: must have a head report to post] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecfdccaef..395bd7e59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,3 +150,27 @@ jobs: run: | aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ env.LINUX_BASE_IMAGE }} build downstream -p ${{ env.PACKAGE_NAME }} + + codecov-linux: + runs-on: ubuntu-22.04 + steps: + - name: Checkout Sources + uses: actions/checkout@v3 + # CMAKE_C_FLAGS for GCC to enable code coverage information. + # COVERAGE_EXTRA_FLAGS="-p" to include path information in the report file name + - name: Build ${{ env.PACKAGE_NAME }} + consumers + run: | + python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" + chmod a+x builder + ./builder build -p ${{ env.PACKAGE_NAME }} --compiler=gcc-9 --cmake-extra=-DASSERT_LOCK_HELD=ON --cmake-extra=-DCMAKE_C_FLAGS="-fprofile-arcs -ftest-coverage" --cmake-extra=-DCOVERAGE_EXTRA_FLAGS="--preserve-paths --source-prefix `pwd`" + # Get test coverage report from CMAKE coverage + - name: Ctest Coverage + run: | + cd build/aws-c-s3 + ctest -T coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + # only reports those from source/, the report name will be generated with # to replace / + files: "source#*"