diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 96e6c30376e..8ac2628d571 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -92,11 +92,10 @@ jobs: uses: codecov/codecov-action@v4 with: verbose: true - gcov: true + # gcov: true flags: pytest-python-${{ matrix.python-version }} name: pytest-python-${{ matrix.python-version }} - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} pytest-success: name: pytest Result diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index ace0346367e..23895cd6116 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -76,14 +76,14 @@ jobs: echo "${delete[@]}" for target in "${delete[@]}"; do for i in "${!array[@]}"; do - if [[ ${array[i]} = $target ]]; then + if [[ ${array[i]} = "$target" ]]; then unset 'array[i]' fi done done unset new_array for i in "${!array[@]}"; do - new_array+=( "${array[i]}" ) + new_array+=( "${array[i]}" ) done echo "Excluded folders:" echo "${new_array[@]}" @@ -91,6 +91,26 @@ jobs: echo "Exclusion string to add to gunittest config" echo "${extra_exclude}" echo "extra-exclude=${extra_exclude}" >> "${GITHUB_OUTPUT}" + echo "Inclusion string for tags" + printf -v extra_include_tag ' %s' "${delete[@]}" + extra_include_tag="${extra_include_tag:1}" # trim extra first space + extra_include_tag=${extra_include_tag// /-} # replace spaces by hyphens + echo "${extra_include_tag}" + echo "extra-include-tag=${extra_include_tag}" >> "${GITHUB_OUTPUT}" + echo "Truncated string for codecov upload" + max_flag_len=45 + max_flag_prefix_len=33 # gunittest-ubuntu-22.04_without_x- + max_flag_suffix_len=$((max_flag_len - max_flag_prefix_len)) + extra_include_tag_len=${#extra_include_tag} # string's length + extra_include_tag_len_len=${#extra_include_tag_len} # length of string's length + if [[ "${extra_include_tag_len}" -gt "${max_flag_suffix_len}" ]]; then + # Extra include too long + extra_include_tag_trunc="${extra_include_tag:0:$max_flag_suffix_len-1-$extra_include_tag_len_len}.${extra_include_tag_len}" + else + extra_include_tag_trunc="${extra_include_tag}" + fi + echo "${extra_include_tag_trunc}" + echo "extra-include-tag-trunc=${extra_include_tag_trunc}" >> "${GITHUB_OUTPUT}" env: DELETE_ARRAY: ${{ matrix.extra-include }} @@ -104,9 +124,11 @@ jobs: - name: Get dependencies run: | sudo apt-get update -y - sudo apt-get install -y wget git gawk findutils python3-coverage + sudo apt-get install -y wget git gawk findutils xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \ sudo apt-get install -y --no-install-recommends --no-install-suggests + - name: Install python coverage tool + run: pip install coverage - name: Create installation directory run: | @@ -158,24 +180,24 @@ jobs: - name: Run tests run: INITIAL_PWD="${PWD}" .github/workflows/test_thorough.sh --config .gunittest.extra.cfg env: - PYTHON: python3-coverage run --branch --parallel-mode --concurrency=multiprocessing,thread + PYTHON: coverage run --branch --parallel-mode --concurrency=multiprocessing,thread INITIAL_GISBASE: $HOME/install/grass84 - - run: python3-coverage combine + - run: coverage combine - name: Show python coverage report summary - run: python3-coverage report - - run: python3-coverage html + run: coverage report + - run: coverage html - name: Make HTML test report available if: ${{ always() }} uses: actions/upload-artifact@v4 with: - name: testreport-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.extra-include }} + name: testreport-${{ matrix.os }}-${{ matrix.config }}-${{ steps.get-exclude.outputs.extra-include-tag }} path: testreport retention-days: 3 - name: Make python-only code coverage test report available if: ${{ always() }} uses: actions/upload-artifact@v4 with: - name: python-codecoverage-report-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.extra-include }} + name: python-codecoverage-report-${{ matrix.os }}-${{ matrix.config }}-${{ steps.get-exclude.outputs.extra-include-tag }} path: coverage_html_report retention-days: 3 @@ -183,11 +205,10 @@ jobs: uses: codecov/codecov-action@v4 with: verbose: true - gcov: true - flags: gunittest,gunittest-${{ matrix.config }},gunittest-${{ matrix.config }}-${{ matrix.extra-include }} - name: gunittest-${{ matrix.config }}-${{ matrix.extra-include }} - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # gcov: true + flags: gunittest,gunittest-${{ matrix.config }},gunittest-${{ matrix.config }}-${{ steps.get-exclude.outputs.extra-include-tag-trunc }} + name: gunittest-${{ matrix.config }}-${{ steps.get-exclude.outputs.extra-include-tag-trunc }} + token: ${{ secrets.CODECOV_TOKEN }} build-and-test-success: name: Build & Test Result diff --git a/codecov.yml b/codecov.yml index a166c5156e4..0146fc8fc11 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,7 +3,7 @@ codecov: # do not notify until at least 7 builds have been uploaded from the CI pipeline # Change when more or less uploads are made, to not receive a GitHub # comment notification too early after only pytest has uploaded coverage - after_n_builds: 5 + after_n_builds: 7 coverage: status: project: @@ -15,12 +15,6 @@ coverage: informational: true component_management: - # default_rules: # default rules that will be inherited by all components - # statuses: - # - type: project # in this case every component that doens't have a status defined will have a project type one - # target: auto - # branches: - # - "!main" individual_components: - component_id: modules_database # this is an identifier that should not be changed name: db # this is a display name, and can be changed freely