diff --git a/.codecov.yml b/.codecov.yml index 3fc7bfb1..5fffb1c2 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -9,3 +9,14 @@ coverage: default: target: 20% # Need to bump this number https://docs.codecov.com/docs/commit-status#patch-status threshold: 2% + +# `codecov/codecov-action` reruns `gcovr` if build files present +# That's why we run it in a separate workflow +# This ignore list is not currently used +# +# More info: https://github.com/XRPLF/clio/pull/2066 +ignore: + - "tests" + - "src/data/cassandra/" + - "src/data/CassandraBackend.hpp" + - "src/data/BackendFactory.*" diff --git a/.github/actions/code_coverage/action.yml b/.github/actions/code_coverage/action.yml index c0db0fe5..79037207 100644 --- a/.github/actions/code_coverage/action.yml +++ b/.github/actions/code_coverage/action.yml @@ -3,20 +3,24 @@ description: Run tests, generate code coverage report and upload it to codecov.i runs: using: composite + steps: - name: Run tests shell: bash run: | build/clio_tests + # Please keep exclude list in sync with .codecov.yml - name: Run gcovr shell: bash run: | - gcovr -e tests \ + gcovr \ + -e tests \ -e src/data/cassandra \ -e src/data/CassandraBackend.hpp \ -e 'src/data/BackendFactory.*' \ - --xml build/coverage_report.xml -j8 --exclude-throw-branches + --xml build/coverage_report.xml \ + -j8 --exclude-throw-branches - name: Archive coverage report uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 103b1adb..62dc932e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,34 +19,24 @@ jobs: strategy: fail-fast: false matrix: + os: [heavy] + conan_profile: [gcc, clang] + build_type: [Release, Debug] + container: ['{ "image": "ghcr.io/xrplf/clio-ci:latest" }'] + code_coverage: [false] + static: [true] + include: - - os: heavy - conan_profile: gcc - build_type: Release - container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }' - code_coverage: false - static: true - os: heavy conan_profile: gcc build_type: Debug container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }' code_coverage: true static: true - - os: heavy - conan_profile: clang - build_type: Release - container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }' - code_coverage: false - static: true - - os: heavy - conan_profile: clang - build_type: Debug - container: '{ "image": "ghcr.io/xrplf/clio-ci:latest" }' - code_coverage: false - static: true - os: macos15 conan_profile: default_apple_clang build_type: Release + container: "" code_coverage: false static: false @@ -60,7 +50,7 @@ jobs: static: ${{ matrix.static }} run_unit_tests: true run_integration_tests: false - clio_server: true + upload_clio_server: true check_config: name: Check Config Description diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ca44fbad..e2853845 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -52,8 +52,8 @@ on: type: boolean default: false - clio_server: - description: Whether to build clio_server + upload_clio_server: + description: Whether to upload clio_server required: true type: boolean @@ -80,13 +80,13 @@ jobs: disable_cache: ${{ inputs.disable_cache }} code_coverage: ${{ inputs.code_coverage }} static: ${{ inputs.static }} - clio_server: ${{ inputs.clio_server }} + upload_clio_server: ${{ inputs.upload_clio_server }} targets: ${{ inputs.targets }} sanitizer: ${{ inputs.sanitizer }} test: needs: build - # TODO: We don't upload tests if code coverage is enabled + # We don't upload tests if code coverage is enabled if: ${{ !inputs.code_coverage }} uses: ./.github/workflows/test_impl.yml with: diff --git a/.github/workflows/build_impl.yml b/.github/workflows/build_impl.yml index 32700eee..8bc95459 100644 --- a/.github/workflows/build_impl.yml +++ b/.github/workflows/build_impl.yml @@ -38,8 +38,8 @@ on: required: true type: boolean - clio_server: - description: Whether to build clio_server + upload_clio_server: + description: Whether to upload clio_server required: true type: boolean @@ -115,15 +115,15 @@ jobs: cat /tmp/ccache.stats - name: Strip unit_tests - if: ${{ !inputs.code_coverage && inputs.sanitizer == 'false' }} + if: inputs.sanitizer == 'false' && !inputs.code_coverage run: strip build/clio_tests - name: Strip integration_tests - if: ${{ !inputs.code_coverage }} + if: inputs.sanitizer == 'false' && !inputs.code_coverage run: strip build/clio_integration_tests - name: Upload clio_server - if: ${{ inputs.clio_server }} + if: inputs.upload_clio_server && !inputs.code_coverage uses: actions/upload-artifact@v4 with: name: clio_server_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }} @@ -157,12 +157,21 @@ jobs: code_coverage: ${{ inputs.code_coverage }} conan_profile: ${{ inputs.conan_profile }} - # TODO: This is not a part of build process but it is the easiest way to do it here. - # It will be refactored in https://github.com/XRPLF/clio/issues/1075 + # This is run as part of the build job, because it requires the following: + # - source code + # - generated source code (Build.cpp) + # - conan packages + # - .gcno files in build directory + # + # It's all available in the build job, but not in the test job - name: Run code coverage if: ${{ inputs.code_coverage }} uses: ./.github/actions/code_coverage + # `codecov/codecov-action` will rerun `gcov` if it's available and build directory is present + # To prevent this from happening, we run this action in a separate workflow + # + # More info: https://github.com/XRPLF/clio/pull/2066 upload_coverage_report: if: ${{ inputs.code_coverage }} name: Codecov diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a57eb734..76c4eb18 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -47,7 +47,7 @@ jobs: static: ${{ matrix.static }} run_unit_tests: true run_integration_tests: ${{ matrix.os != 'macos15' }} - clio_server: true + upload_clio_server: true disable_cache: true nightly_release: diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index d1d4f7bf..161b4561 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -39,6 +39,6 @@ jobs: static: false run_unit_tests: true run_integration_tests: false - clio_server: false + upload_clio_server: false targets: clio_tests clio_integration_tests sanitizer: ${{ matrix.sanitizer }} diff --git a/.github/workflows/test_impl.yml b/.github/workflows/test_impl.yml index e0142a35..856458ee 100644 --- a/.github/workflows/test_impl.yml +++ b/.github/workflows/test_impl.yml @@ -59,12 +59,20 @@ jobs: with: name: clio_tests_${{ runner.os }}_${{ inputs.build_type }}_${{ inputs.conan_profile }} - - name: Run clio_tests - run: | - chmod +x ./clio_tests - ${{ inputs.sanitizer != 'false' && './.github/scripts/execute-tests-under-sanitizer' || '' }} ./clio_tests + - name: Make clio_tests executable + shell: bash + run: chmod +x ./clio_tests + + - name: Run clio_tests (regular) + if: inputs.sanitizer == 'false' + run: ./clio_tests + + - name: Run clio_tests (sanitizer) + if: inputs.sanitizer != 'false' + run: ./.github/scripts/execute-tests-under-sanitizer ./clio_tests - name: Check for sanitizer report + if: inputs.sanitizer != 'false' shell: bash id: check_report run: | @@ -75,7 +83,7 @@ jobs: fi - name: Upload sanitizer report - if: ${{ steps.check_report.outputs.found_report == 'true' }} + if: inputs.sanitizer != 'false' && steps.check_report.outputs.found_report == 'true' uses: actions/upload-artifact@v4 with: name: ${{ inputs.conan_profile }}_report @@ -84,7 +92,7 @@ jobs: # TODO: enable when we have fixed all currently existing issues from sanitizers - name: Create an issue - if: ${{ false && steps.check_report.outputs.found_report == 'true' }} + if: false && inputs.sanitizer != 'false' && steps.check_report.outputs.found_report == 'true' uses: ./.github/actions/create_issue env: GH_TOKEN: ${{ github.token }}