From 2e808682b63800a94d23c8b09b516b73a81d3c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 18:54:15 +0000 Subject: [PATCH 1/9] CI: Use hyphen-delimited inclusion tag for filenames --- .github/workflows/ubuntu.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index ace0346367e..a2919787059 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -91,6 +91,12 @@ 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}" env: DELETE_ARRAY: ${{ matrix.extra-include }} @@ -168,14 +174,14 @@ jobs: 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 From 2131d883cba7f93a67fdf05878891b4e8a2c3c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 18:55:48 +0000 Subject: [PATCH 2/9] CI: Fix shellcheck issues in inclusion list bash script --- .github/workflows/ubuntu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index a2919787059..6e35b900a2e 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[@]}" From e4914a0d5c5fce4029ee8fe0da4080637325e510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 18:56:27 +0000 Subject: [PATCH 3/9] CI: Truncate flag name if too long --- .github/workflows/ubuntu.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6e35b900a2e..c6e2199d769 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -97,6 +97,20 @@ jobs: 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 }} @@ -189,11 +203,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 }} + token: ${{ secrets.CODECOV_TOKEN }} build-and-test-success: name: Build & Test Result From a88c6adecc3c4bf65e61c171882b85796f3c532f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 18:58:08 +0000 Subject: [PATCH 4/9] CI: Wait for 7 code coverage uploads before notifying --- codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index a166c5156e4..a4a7a708277 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: From 3f417adff67bef6eb217f70cd0b5aac6df0820a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:09:58 +0000 Subject: [PATCH 5/9] CI: Install python coverage through pip for a more recent version --- .github/workflows/ubuntu.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c6e2199d769..8af51789c77 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -124,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: | From 7852c4b4e11a3a730cc71d69296df87b088f9c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:10:35 +0000 Subject: [PATCH 6/9] CI: Clean up codecov.yml file --- codecov.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/codecov.yml b/codecov.yml index a4a7a708277..0146fc8fc11 100644 --- a/codecov.yml +++ b/codecov.yml @@ -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 From 00632aaad8426e8d0fbb01a7fa93a4c32cf3d9ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:19:20 +0000 Subject: [PATCH 7/9] CI: Install python coverage through pip for a more recent version --- .github/workflows/ubuntu.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 8af51789c77..21601663075 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -180,12 +180,12 @@ 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 From 4d054dc605f0a87493ecc67e283f862b2fa1efdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:20:32 +0000 Subject: [PATCH 8/9] CI: Changes for codecov-action@v4 --- .github/workflows/pytest.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 From 76967fae01992b5729d375415905c46c3324a9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 3 Feb 2024 20:07:47 +0000 Subject: [PATCH 9/9] CI: Truncate codecov upload name if too long --- .github/workflows/ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 21601663075..23895cd6116 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -207,7 +207,7 @@ jobs: verbose: true # 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 }} + name: gunittest-${{ matrix.config }}-${{ steps.get-exclude.outputs.extra-include-tag-trunc }} token: ${{ secrets.CODECOV_TOKEN }} build-and-test-success: