Skip to content

Commit

Permalink
ci: improve coverage workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Oct 10, 2024
1 parent e89a2f5 commit aae911d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
32 changes: 7 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,22 @@ jobs:
target: 'test:coverage'
parallel: 1

- name: 'Move test result files'
- uses: myparcelnl/actions/collect-test-results@v4
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
#language=bash
run: |
# Create the directories in case they don't exist
mkdir -p coverage junit
yarn workspaces foreach -Apv --exclude . exec \
bash -c \
'if [ -f "coverage/clover.xml" ]; then \
# Make file paths relative
sed -i "s|'$PWD'/||g" "coverage/clover.xml"; \
cp -f "coverage/clover.xml" "'$PWD'/coverage/$(basename $PWD).xml"; \
fi; \
if [[ -f "junit.xml" && -s "junit.xml" ]]; then \
# Set the testsuites name to the package name
sed -i "s|<testsuites name=\".*\">|<testsuites name=\"$npm_package_name\">|" "junit.xml"; \
cp -f "junit.xml" "'$PWD'/junit/$(basename $PWD).xml"; \
fi'

- uses: myparcelnl/actions/codecov-coverage@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: frontend
flags: unit,frontend
files: coverage/**/*.xml
flags: frontend
files: coverage/*.xml

- uses: myparcelnl/actions/codecov-test-results@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: frontend
flags: unit,frontend
files: junit/**/*.xml
flags: frontend
files: junit/*.xml

test-backend:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -126,12 +108,12 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: backend
flags: unit,backend
flags: backend
files: clover.xml

- uses: myparcelnl/actions/codecov-test-results@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: backend
flags: unit,backend
flags: backend
files: junit.xml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ junit.xml

coverage/
dist/
junit/
lib/
node_modules/
vendor/
Expand Down

0 comments on commit aae911d

Please sign in to comment.