Skip to content

Commit 60f51fe

Browse files
Fix coverage file
1 parent 4383013 commit 60f51fe

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ jobs:
1313
COVERAGE_FILE: coverage.xml
1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717

1818
- name: Build test image
1919
run: |
2020
DOCKER_BUILDKIT=1 docker build . \
2121
--target python_test_base \
2222
-t conductor-sdk-test:latest
2323
24+
- name: Prepare coverage file
25+
run: touch ${{ env.COVERAGE_FILE }}
26+
2427
- name: Run tests with coverage
2528
id: run_tests
2629
continue-on-error: true
@@ -29,18 +32,29 @@ jobs:
2932
-e CONDUCTOR_AUTH_KEY=${{ secrets.CONDUCTOR_AUTH_KEY }} \
3033
-e CONDUCTOR_AUTH_SECRET=${{ secrets.CONDUCTOR_AUTH_SECRET }} \
3134
-e CONDUCTOR_SERVER_URL=${{ secrets.CONDUCTOR_SERVER_URL }} \
32-
-v ${{ github.workspace }}/${{ env.COVERAGE_FILE }}:/package/${{ env.COVERAGE_FILE }} \
35+
-v ${{ github.workspace }}/${{ env.COVERAGE_FILE }}:/package/${{ env.COVERAGE_FILE }}:rw \
3336
conductor-sdk-test:latest \
3437
/bin/sh -c "coverage run -m unittest discover --verbose --start-directory=./tests/unit && \
3538
coverage run --append -m unittest discover --verbose --start-directory=./tests/backwardcompatibility && \
3639
coverage run --append -m unittest discover --verbose --start-directory=./tests/serdesertest && \
3740
coverage run --append --source=./src/conductor/client/orkes -m unittest discover --verbose --start-directory=./tests/integration && \
3841
coverage report -m && \
39-
coverage xml -o /package/coverage.xml"
42+
coverage xml -o /package/${{ env.COVERAGE_FILE }}"
4043
41-
- name: Upload coverage to Codecov
44+
- name: Verify coverage file
45+
id: verify_coverage
4246
if: always()
4347
continue-on-error: true
48+
run: |
49+
if [ ! -s "${{ env.COVERAGE_FILE }}" ]; then
50+
echo "Coverage file is empty or does not exist"
51+
exit 1
52+
fi
53+
echo "Coverage file exists and is not empty"
54+
55+
- name: Upload coverage to Codecov
56+
if: always() && steps.verify_coverage.outcome == 'success'
57+
continue-on-error: true
4458
uses: codecov/codecov-action@v3
4559
with:
4660
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)