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

Test badge #415

Closed
wants to merge 2 commits into from
Closed

Test badge #415

wants to merge 2 commits into from

Conversation

alan-barzilay
Copy link
Collaborator

update status badge from travis to github action and Break tests and codecov workflow in 2.

The idea is to have the status badge report if the tests are passing,
without considering codecov since it frequently fails due to some
network hickup that makes the report upload to fail.

This also makes things a bit more compartimentalized.

The idea is to have the status badge report if the tests are passing,
without considering codecov since it frequently fails due to some
network hickup that makes the report upload to fail.

This also makes things a bit more compartimentalized.
@alan-barzilay
Copy link
Collaborator Author

relevant reference: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run

Also:

Note: This event will only trigger a workflow run if the workflow file is on the default branch.

@alan-barzilay
Copy link
Collaborator Author

alan-barzilay commented Nov 8, 2023

it will go from this:
image

to this:
image

@alan-barzilay
Copy link
Collaborator Author

alan-barzilay commented Nov 8, 2023

tested on https://github.com/pipreqsxp/pipreqs/actions/runs/6800189760/job/18488179557 and tests work as expected once they reach the main branch, with codecov being called after a successful run of "Tests".

(The code coverage test is expected to fail since that repo doesnt have the codecov token to perform the upload)

.. image:: https://img.shields.io/travis/bndr/pipreqs.svg
:target: https://travis-ci.org/bndr/pipreqs

.. image:: https://github.com/bndr/pipreqs/actions/workflows/tests.yml/badge.svg?branch=master
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I set the tracking to tests performed on the master branch, a broken test in the next branch or in a random PR doesnt seem to be very informative or relevant to users since unless they manually instal pipreqs they will get the master branch through pypi

.github/workflows/codecov.yml Show resolved Hide resolved
jobs:
coverage_report:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

If the pipeline fails, will the badge reflect update the status?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if the pipeline fails (aka any of the tests fail) the coverage_report workflow won't be run and if the branch being tested happens to be the master branch, then the badge will be updated as failing

.github/workflows/codecov.yml Show resolved Hide resolved
.github/workflows/tests.yml Show resolved Hide resolved
@alan-barzilay
Copy link
Collaborator Author

Would you consider adding a report here? like it is done in Code Coverage Report using insightsengineering/coverage-action@v2. It would be nice to see the status during the PR progress.

That would be nice but sadly we run into a problem of not having permission for the bot to do its thing. In the interest of time I will drop this idea for now and create an issue to register our interest for the future.

Here is the step I tried to implement into the workflow:

            - name: Produce the coverage report
              uses: insightsengineering/coverage-action@v2
              with:
		path: coverage.xml
		# Publish the rendered output as a PR comment
		publish: true
		# Create a coverage diff report.
		diff: true
		# Branch to diff against.
		diff-branch: next
		# This is where the coverage reports for the
		# `diff-branch` are stored.
		diff-storage: _xml_coverage_reports
		togglable-report: true

@alan-barzilay
Copy link
Collaborator Author

there seems to be an issue, the codecov test is run but doesnt show up in the PR, it seems to loose any association with what trigerred it

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.

2 participants