Skip to content

Update codecov with token (#407) #248

Update codecov with token (#407)

Update codecov with token (#407) #248

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: precommit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pre-commit
- name: Run pre-commit
run: |
pre-commit run --color=always --show-diff-on-failure --all-files
metrics:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.9', '3.11']
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
twine check dist/*
- name: Install package with test dependencies
run: |
pip install dist/*.whl
pip install '.[test,louvain]'
- name: Test with pytest
if: ${{ matrix.os != 'macos-latest'}}
run: |
pytest --cov=scib --cov-report=xml -vv --ignore=tests/integration/ --ignore=tests/metrics/rpy2 -vv
mv coverage.xml "$(echo 'coverage_metrics_${{ matrix.os }}_${{ matrix.python }}.xml' | sed 's/[^a-z0-9\.\/]/_/g')"
- name: Upload coverage to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: metrics
path: coverage_*.xml
rpy2:
runs-on: ${{ matrix.os }}
strategy:
matrix:
r: ['4.2']
python: ['3.10']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r }}
- name: Install dependencies
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
python -m pip install --upgrade pip
pip install '.[test,rpy2]'
Rscript -e "install.packages('remotes')"
Rscript -e "remotes::install_github('theislab/kBET')"
- name: Test with pytest
run: |
pytest --cov=scib --cov-report=xml -vv --tb=native -k rpy2
mv coverage.xml "$(echo 'coverage_rpy2_${{ matrix.os }}_${{ matrix.python }}.xml' | sed 's/[^a-z0-9\.\/]/_/g')"
- name: Upload coverage to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: rpy2
path: coverage_*.xml
integration:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.9', '3.11']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[test,scanorama,scvi,harmony]'
- name: Test with pytest
run: |
pytest --cov=scib --cov-report=xml -vv --tb=native -k integration
mv coverage.xml "$(echo 'coverage_integration_${{ matrix.os }}_${{ matrix.python }}.xml' | sed 's/[^a-z0-9\.\/]/_/g')"
- name: Upload coverage to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: integration
path: coverage_*.xml
upload-codecov:
needs: [metrics, rpy2]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download coverage from GitHub Actions
uses: actions/download-artifact@v3
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: ${{ github.repository == 'theislab/scib' }}
verbose: true
- name: Delete coverage artifacts
uses: geekyeggo/delete-artifact@v4