From 6ff8c8f9ef5a4af07330c674e07a0ef3afc5cdde Mon Sep 17 00:00:00 2001 From: Edie Lemoine Date: Wed, 9 Oct 2024 17:16:21 +0200 Subject: [PATCH] ci: fix paths in coverage files --- .github/workflows/test.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f6496e9..c19df8c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,18 +49,19 @@ jobs: # Create the directories in case they don't exist mkdir -p .tmp/coverage .tmp/junit - # Copy the files to the respective folder, named after the project. yarn workspaces foreach -Apv --exclude . exec \ bash -c \ - 'if [ -f "coverage/clover.xml" ]; then cp -f "coverage/clover.xml" "../../../../.tmp/coverage/$(basename $PWD).xml"; fi; \ + 'if [ -f "coverage/clover.xml" ]; then \ + # Make file paths relative + sed -i "" "s|'$PWD'/||g" "coverage/clover.xml"; \ + cp -f "coverage/clover.xml" "'$PWD'/.tmp/coverage/$(basename $PWD).xml"; \ + fi; \ if [[ -f "junit.xml" && -s "junit.xml" ]]; then \ - sed -i "s|||" "junit.xml"; \ - cp -f "junit.xml" "../../../../.tmp/junit/$(basename $PWD).xml"; \ + # Set the testsuites name to the package name + sed -i "" "s|||" "junit.xml"; \ + cp -f "junit.xml" "'$PWD'/.tmp/junit/$(basename $PWD).xml"; \ fi' - # Make the coverage paths relative before uploading - find .tmp/coverage -type f -name '*.xml' -exec sed -i 's|'"$PWD"'/||g' {} \; - - uses: myparcelnl/actions/codecov-coverage@v4 with: token: ${{ secrets.CODECOV_TOKEN }}