From e2c0f6483df4a447adc42079d66617adee35ed4c Mon Sep 17 00:00:00 2001 From: Alan Barzilay Date: Wed, 8 Nov 2023 11:26:30 -0300 Subject: [PATCH 1/2] update status badge from travis to github action --- README.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 22a3aef..be8aa9c 100644 --- a/README.rst +++ b/README.rst @@ -2,9 +2,8 @@ ``pipreqs`` - Generate requirements.txt file for any project based on imports ============================================================================= -.. 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 + :target: https://github.com/bndr/pipreqs/actions/workflows/tests.yml .. image:: https://img.shields.io/pypi/v/pipreqs.svg :target: https://pypi.python.org/pypi/pipreqs From eabd8b91ff044c708d25f4936288fc2a0798d63f Mon Sep 17 00:00:00 2001 From: Alan Barzilay Date: Wed, 8 Nov 2023 11:30:51 -0300 Subject: [PATCH 2/2] 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. --- .github/workflows/codecov.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 26 +------------------------- 2 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000..94ddfe2 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,30 @@ +name: CodeCov +on: + workflow_run: + workflows: [Tests] + types: [completed] + +jobs: + coverage_report: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install coverage docopt yarg requests + + - name: Calculate coverage + run: coverage run --source=pipreqs -m unittest discover + + - name: Create XML report + run: coverage xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: coverage.xml + fail_ci_if_error: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4c9ae7e..2abae8b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Tests and Codecov +name: Tests on: push: pull_request: @@ -28,27 +28,3 @@ jobs: - name: Test with tox run: tox - - coverage_report: - needs: run_tests - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install coverage docopt yarg requests - - - name: Calculate coverage - run: coverage run --source=pipreqs -m unittest discover - - - name: Create XML report - run: coverage xml - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - files: coverage.xml - fail_ci_if_error: true