Skip to content

Commit

Permalink
Merge pull request #514 from UW-GAC/maint/fix-coverage-ci
Browse files Browse the repository at this point in the history
Fix coverage for newest upload-artifact action
  • Loading branch information
amstilp authored Sep 16, 2024
2 parents b6dc36d + 77b4616 commit 49c05da
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ jobs:
options: --tmpfs /var/lib/mysql

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.1.7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v5.2.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -74,11 +74,16 @@ jobs:
- name: Run Tests
run: hatch run $TEST_ENV:cov

- name: Rename coverage file
run: |
ls -la .coverage*
mv .coverage.* coverage-${{ strategy.job-index }}
- name: Upload coverage data
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4.4.0
with:
name: coverage-data-${{ strategy.job-index }}
path: ".coverage.*"
path: coverage-${{ strategy.job-index }}
if-no-files-found: error


Expand All @@ -90,29 +95,25 @@ jobs:
needs: [test]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.1.7

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v5.2.0
with:
python-version: "3.12"

- name: Install hatch
run: python -m pip install --upgrade hatch

- name: Download coverage data
uses: actions/download-artifact@v4
uses: actions/download-artifact@v4.1.8
with:
path: ./artifacts/

- name: Merge coverage files
run: |
mv ./artifacts/coverage-data*/.coverage* .
ls -la .coverage*
- name: Combine coverage data
run: |
hatch run cov:combine
ls -la ./artifacts/coverage-data*
hatch run cov:combine ./artifacts/coverage-data*/coverage-*
ls -la .coverage*
- name: Create coverage xml file
Expand All @@ -121,7 +122,7 @@ jobs:
ls -la .
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v4.5.0
with:
fail_ci_if_error: true # optional (default = false)
token: ${{ secrets.CODECOV_TOKEN }}
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,9 @@ dependencies = [
"coverage[toml]>=6.5"
]
[tool.hatch.envs.cov.scripts]
clean = ["rm -f .coverage"]
combine = [
# Clean up old files first.
"rm -f .coverage",
"coverage combine",
"python -m coverage combine {args}",
]
report = ["coverage report"]
html = ["coverage html"]
Expand Down

0 comments on commit 49c05da

Please sign in to comment.