Skip to content

Commit 665caec

Browse files
authored
Fix upload coverage step (baserow#4126)
1 parent 137aa1a commit 665caec

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,24 +846,35 @@ jobs:
846846
run: |
847847
echo "Listing downloaded files:"
848848
find reports-download -type f
849-
cp reports-download/.coverage* . 2>/dev/null || echo "No coverage files found"
850-
coverage combine
851-
coverage report
849+
cp reports-download/.coverage* $GITHUB_WORKSPACE/ 2>/dev/null || echo "No coverage files found"
850+
cd $GITHUB_WORKSPACE
851+
coverage combine || echo "::warning::No coverage data to combine"
852+
coverage report || echo "::warning::No coverage report generated"
853+
ls -la .coverage* || true
854+
855+
- name: Verify .coverage file exists
856+
run: |
857+
if [ ! -f $GITHUB_WORKSPACE/.coverage ]; then
858+
echo "::error::No .coverage file found after combining coverage!"
859+
exit 1
860+
fi
852861
853862
- name: Upload combined coverage report
854863
uses: actions/upload-artifact@v4
855864
with:
856865
name: backend-coverage-report
857-
path: .coverage
866+
path: ${{ github.workspace }}/.coverage
867+
include-hidden-files: true
858868
retention-days: 30
859869
overwrite: true
860870

861871
- name: Comment coverage report on PR
862-
uses: py-cov-action/python-coverage-comment-action@v3
863872
if: github.event_name == 'pull_request'
873+
uses: py-cov-action/python-coverage-comment-action@v3.38
864874
with:
865875
GITHUB_TOKEN: ${{ github.token }}
866876
MERGE_COVERAGE_FILES: false
877+
COVERAGE_PATH: ${{ github.workspace }}
867878

868879
# ==========================================================================
869880
# Build and publish stage - builds production grade images and publishes

backend/tests/baserow/contrib/integrations/local_baserow/test_utils.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,16 @@ def test_prepare_file_for_db_with_existing_file(data_fixture):
391391

392392

393393
@pytest.mark.django_db
394+
@responses.activate
394395
def test_prepare_file_for_db_with_mix(data_fixture, fake):
396+
picsum_url = "https://picsum.photos/300/200"
397+
responses.add(
398+
responses.GET,
399+
picsum_url,
400+
status=200,
401+
body=fake.image((300, 200)),
402+
)
403+
395404
user = data_fixture.create_user()
396405
user_file = data_fixture.create_user_file(
397406
original_name=f"a.txt",
@@ -407,7 +416,7 @@ def test_prepare_file_for_db_with_mix(data_fixture, fake):
407416
{
408417
"__file__": True,
409418
"name": "filename",
410-
"url": "https://picsum.photos/300/200",
419+
"url": picsum_url,
411420
},
412421
{
413422
"__file__": True,
@@ -432,7 +441,7 @@ def test_prepare_file_for_db_with_mix(data_fixture, fake):
432441
"image_height": 200,
433442
"image_width": 300,
434443
"is_image": True,
435-
"mime_type": "image/jpeg",
444+
"mime_type": "image/png",
436445
"name": AnyStr(),
437446
"size": AnyInt(),
438447
"uploaded_at": AnyStr(),

0 commit comments

Comments
 (0)