Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Generate local report in Tests workflow and use proper script for fetch report #1054

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,41 @@ jobs:
tox_args: "-e py38-PyQt5-minimal"
coverage: true

coverage_prepare:
name: Prepare coverage
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider pinning the runner version in the coverage_prepare job to ubuntu-20.04 for consistency with other jobs and to avoid potential issues when the ubuntu-latest runner is updated.

needs: [test_coverage, test_minimal]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
cache-dependency-path: setup.cfg
cache: 'pip'
- name: Install Dependencies
run: |
pip install --upgrade pip
pip install codecov

- name: Download coverage data
uses: actions/download-artifact@v3
with:
name: coverage reports
path: coverage
- name: combine coverage data
run: |
python -Im coverage combine coverage
python -Im coverage xml -o coverage.xml
# Report and write to summary.
python -Im coverage report --format=markdown --skip-empty --skip-covered >> $GITHUB_STEP_SUMMARY

- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage_xml
path: coverage.xml
retention-days: 5

test_conda:
name: Test PartSeg conda
runs-on: ubuntu-20.04
Expand Down
47 changes: 21 additions & 26 deletions .github/workflows/upload_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,28 @@ jobs:
name: Upload coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"
cache-dependency-path: setup.cfg
cache: 'pip'

- name: Install Dependencies
run: |
pip install --upgrade pip
pip install codecov

- name: Download coverage data
uses: actions/download-artifact@v3
- name: Download Coverage Data
uses: actions/github-script@v6
with:
name: coverage reports
path: coverage

- name: combine coverage data
run: |
python -Im coverage combine coverage
python -Im coverage xml -o coverage.xml

# Report and write to summary.
python -Im coverage report --format=markdown --skip-empty --skip-covered >> $GITHUB_STEP_SUMMARY

script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "coverage_xml"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverage_xml.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip coverage_xml.zip
- name: Upload coverage data
uses: codecov/codecov-action@v3
with:
Expand Down
Loading