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

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Dec 18, 2023

Summary by CodeRabbit

  • Chores
    • Improved the CI workflow by introducing a new job for preparing coverage data.
    • Streamlined coverage data handling by leveraging GitHub Actions scripting capabilities for artifact management.

@Czaki Czaki added this to the 0.15.3 milestone Dec 18, 2023
Copy link
Contributor

coderabbitai bot commented Dec 18, 2023

Walkthrough

The GitHub Actions workflows have been updated to streamline the handling of coverage data. A new job for preparing coverage data has been introduced, and the process for downloading and processing coverage artifacts has been optimized using GitHub's scripting actions.

Changes

File Path Change Summary
.github/workflows/tests.yml Added coverage_prepare job with steps for handling coverage data.
.github/workflows/.../upload_coverage.yml Replaced steps for downloading and combining coverage data with script-based artifact handling and unzipping steps.

🐇✨
In the realm of code, where tests are king,
A rabbit hopped in, made coverage sing.
With scripts that dance, and actions that zip,
Our data's now ready, without even a blip. 📊🎉

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

@Czaki Czaki changed the title Fetch data from different workflow trigger ci: Fetch data from different workflow trigger Dec 18, 2023
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c35e623 and 2db218e.
Files selected for processing (2)
  • .github/workflows/tests.yml (1 hunks)
  • .github/workflows/upload_coverage.yml (1 hunks)
Additional comments: 8
.github/workflows/tests.yml (6)
  • 119-153: The coverage_prepare job is well-defined with clear steps for handling coverage data. It includes checking out the code, setting up Python, installing dependencies, downloading coverage data, combining coverage data, and uploading the combined coverage report. Ensure that the name for the downloaded artifact in step 136 matches the name of the artifact uploaded by the test_coverage and test_minimal jobs. Also, verify that the retention policy aligns with the project's requirements.

  • 122-122: Verify that the test_coverage and test_minimal jobs are correctly configured to produce the coverage reports artifact that coverage_prepare expects to download.

  • 125-129: The caching strategy in the coverage_prepare job is set up correctly. Confirm that setup.cfg is the correct path for the cache-dependency-path and it contains the project's dependencies to make effective use of the caching.

  • 133-133: The coverage_prepare job installs codecov. Ensure that codecov is the intended tool for handling coverage data and that it's compatible with the project's coverage reporting requirements.

  • 140-145: The steps to combine coverage data and generate a report in the coverage_prepare job appear to be correct. Confirm that the coverage command is available in the environment and that the paths specified (e.g., coverage) are correct and accessible.

  • 147-152: The coverage_prepare job uploads the coverage report as an artifact named coverage_xml. Confirm that this name is consistent with the expected artifact name in any downstream workflows or jobs that might use this artifact. Also, verify that the retention policy of 5 days aligns with the project's requirements.

.github/workflows/upload_coverage.yml (2)
  • 15-36: The updated workflow steps for downloading and unzipping the coverage data artifact appear to be correctly implemented. However, ensure that the artifact name coverage_xml matches the actual artifact produced by the Tests workflow and that the codecov/codecov-action step is correctly configured to find the unzipped coverage data.
Verification successful

The verification process confirms that the Tests workflow produces an artifact named coverage_xml, which matches the expected artifact name in the upload_coverage.yml workflow. Additionally, the codecov/codecov-action is present in the upload_coverage.yml workflow and is configured to fail the CI if there is an error and to use a token for authentication. The unzipped coverage data is expected to be in the workspace directory, which is the default location where the codecov/codecov-action looks for coverage files. Therefore, the changes appear to be correctly implemented in line with the PR objectives and summaries.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the 'Tests' workflow produces an artifact named 'coverage_xml'.
rg --type yaml -C3 'artifact.*coverage_xml' .github/workflows/tests.yml
# Verify that the 'codecov/codecov-action' step is configured to find the unzipped coverage data.
rg --type yaml -C3 'codecov/codecov-action' .github/workflows/tests.yml

Length of output: 145



Script:

#!/bin/bash
# Broaden the search to find any artifact upload steps in the 'Tests' workflow.
rg --type yaml 'upload-artifact' .github/workflows/tests.yml

# Broaden the search to find any usage of the codecov action in the 'Tests' workflow.
rg --type yaml 'codecov-action' .github/workflows/tests.yml

Length of output: 243



Script:

#!/bin/bash
# Verify the exact name of the artifact being produced by the 'Tests' workflow.
rg --type yaml 'name:.*artifact' .github/workflows/tests.yml

# Verify the presence and configuration of the 'codecov/codecov-action' in the 'upload_coverage.yml' workflow.
rg --type yaml 'codecov/codecov-action' .github/workflows/upload_coverage.yml

Length of output: 221



Script:

#!/bin/bash
# Verify the parameters of the 'upload-artifact' step to find the actual name of the artifact in the 'Tests' workflow.
rg --type yaml -A5 'upload-artifact' .github/workflows/tests.yml

# Verify the configuration of the 'codecov/codecov-action' step in the 'upload_coverage.yml' workflow.
rg --type yaml -A5 'codecov/codecov-action' .github/workflows/upload_coverage.yml

Length of output: 715



Script:

#!/bin/bash
# Verify that the unzipped coverage data is placed in the workspace directory in the 'upload_coverage.yml' workflow.
rg --type yaml -A5 'unzip' .github/workflows/upload_coverage.yml

Length of output: 280

* 33-34: Verify that the `GITHUB_WORKSPACE` environment variable is correctly set and that the `fs` module is available in the GitHub Actions runner environment where this workflow will be executed.

@@ -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.

@Czaki Czaki changed the title ci: Fetch data from different workflow trigger ci: Generate local report in Tests workflow and use proper script for fetch report Dec 18, 2023
@Czaki Czaki merged commit c6ee6c9 into develop Dec 18, 2023
38 of 41 checks passed
@Czaki Czaki deleted the fix_coverage2 branch December 18, 2023 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant