Merge pull request #102 from Novartis/reenable-codecov #219
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Tests that run on every PR | |
| name: Pull Request Checks | |
| on: [push, pull_request] | |
| jobs: | |
| black: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| name: Checkout repository | |
| - uses: actions/setup-python@v2 | |
| name: Setup Python | |
| with: | |
| python-version: 3.9 | |
| - name: Install black | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black | |
| - name: Run black | |
| run: | | |
| black . --check | |
| # This job is copied over from `deploy.yaml` | |
| run-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| # See: https://github.com/marketplace/actions/setup-conda | |
| - uses: s-weigand/setup-conda@v1 | |
| with: | |
| conda-channels: "conda-forge" | |
| - name: Build environment | |
| run: | | |
| conda env create -f environment.yml | |
| eval "$(conda shell.bash hook)" | |
| conda activate cellxgene-gateway | |
| python setup.py install | |
| pip install -r requirements-test.txt | |
| - name: Run tests | |
| run: | | |
| eval "$(conda shell.bash hook)" | |
| conda activate cellxgene-gateway | |
| coverage run -m unittest discover tests | |
| - name: Check coverage | |
| run: | | |
| eval "$(conda shell.bash hook)" | |
| conda activate cellxgene-gateway | |
| coverage report --fail-under 41 | |
| coverage report > coverage.txt | |
| coverage html -i | |
| coverage xml -i | |
| - name: Upload coverage HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html | |
| path: htmlcov/ | |
| retention-days: 30 | |
| - name: Upload coverage xml | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-xml | |
| path: coverage.xml | |
| retention-days: 30 | |
| - name: Upload coverage summary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-summary | |
| path: coverage.txt | |
| retention-days: 30 | |
| - name: "Upload coverage to Codecov" | |
| if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }} | |
| uses: codecov/codecov-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests | |
| env_vars: OS,PYTHON | |
| name: codecov-umbrella | |
| fail_ci_if_error: true | |
| path_to_write_report: ./codecov_report.txt | |
| verbose: true |