Skip to content

Commit

Permalink
Refactor GitHub Actions workflows for build, release, and test
Browse files Browse the repository at this point in the history
  • Loading branch information
canergen committed Dec 15, 2023
1 parent dfe95bb commit 9530dc2
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 945 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
name: Check Build

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install build dependencies
run: python -m pip install --upgrade pip wheel twine build
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*.whl
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install build dependencies
run: python -m pip install --upgrade pip wheel twine build
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*.whl
46 changes: 23 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
name: Release

on:
push:
tags:
- "*.*.*"
push:
tags:
- "*.*.*"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
# will use ref/SHA that triggered it
- name: Checkout code
uses: actions/checkout@v3
release:
name: Release
runs-on: ubuntu-latest
steps:
# will use ref/SHA that triggered it
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install hatch
run: |
pip install hatch
- name: Install hatch
run: |
pip install hatch
- name: Build project for distribution
run: hatch build
- name: Build project for distribution
run: hatch build

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
94 changes: 47 additions & 47 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,57 @@
name: PopV

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
defaults:
run:
shell: bash -e {0} # -e to fail on error
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
defaults:
run:
shell: bash -e {0} # -e to fail on error

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python: "3.9"
- os: ubuntu-latest
python: "3.10"
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python: "3.9"
- os: ubuntu-latest
python: "3.10"

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
pip install pytest-cov
pip install ${{ matrix.pip-flags }} ".[dev]"
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
pytest -v --cov --color=yes
- name: Upload coverage
uses: codecov/codecov-action@v3
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
pip install pytest-cov
pip install ${{ matrix.pip-flags }} ".[dev]"
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
pytest -v --cov --color=yes
- name: Upload coverage
uses: codecov/codecov-action@v3
12 changes: 6 additions & 6 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Run to check if valid
# curl --data-binary @codecov.yml https://codecov.io/validate
coverage:
status:
project:
default:
target: 85%
threshold: 1%
patch: off
status:
project:
default:
target: 85%
threshold: 1%
patch: off

ignore:
14 changes: 2 additions & 12 deletions docs/notebooks/tabula_sapiens_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -566,25 +566,15 @@
" ref_batch_key=ref_batch_key,\n",
" unknown_celltype_label=unknown_celltype_label,\n",
" save_path_trained_models=output_model_fn,\n",
" cl_obo_folder=\"ontology/\",\n",
" cl_obo_folder=\"./PopV/popv/ontology/\",\n",
" prediction_mode=\"inference\", # 'fast' mode gives fast results (does not include BBKNN and Scanorama and makes more inaccurate predictions)\n",
" n_samples_per_label=n_samples_per_label,\n",
" accelerator=\"cpu\",\n",
" accelerator=\"cuda\",\n",
" compute_embedding=True,\n",
" hvg=None,\n",
").adata"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "f523194b",
"metadata": {},
"outputs": [],
"source": [
"adata.uns['_accelerator'] = 'cpu'"
]
},
{
"cell_type": "code",
"execution_count": 19,
Expand Down
Loading

0 comments on commit 9530dc2

Please sign in to comment.