Skip to content

Commit

Permalink
Fix CI for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-zen committed Jan 12, 2025
1 parent ad9d582 commit ee20b4b
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 130 deletions.
104 changes: 75 additions & 29 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ env:
PYTHON_VERSION: 3.11

jobs:
packages-build:
name: Build packages
checks:
name: Check code
runs-on: ubuntu-latest
env:
RUFF_FORMAT: github
Expand All @@ -29,30 +29,70 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Prepare virtual environment
run: make create-env
- uses: astral-sh/setup-uv@v4

- name: Check format
run: |
make check-format || true
BOLDRED=$(tput bold && tput setaf 1)
RESET=$(tput sgr0)
echo "${BOLDRED}==> We won't fail on formatting errors for the time being, but we will in the future.${RESET}"
echo "${BOLDRED}==> We won't penalise formatting errors for the time being, but we will in the future.${RESET}"
- name: Check lint
run: |
make check-lint || true
BOLDRED=$(tput bold && tput setaf 1)
RESET=$(tput sgr0)
echo "${BOLDRED}==> We won't fail on lint errors for the time being, but we will in the future.${RESET}"
echo "${BOLDRED}==> We won't enforce linting errors for the time being, but we will in the future.${RESET}"
- name: Build packages
run: make build-dist
sdist-build:
name: Build sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- uses: astral-sh/setup-uv@v4

- name: Build sdist
run: make build-sdist

- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: python-packages
name: sdist
path: dist

wheels-build:
name: Build wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- uses: astral-sh/setup-uv@v4

- name: Build wheels
run: make build-wheels

- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist

docker-build:
Expand All @@ -67,19 +107,24 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Prepare virtual environment
run: make create-env
- uses: astral-sh/setup-uv@v4

- name: Check Dockerfile
run: make check-docker

- name: Build Docker image
run: make build-image
run: make save-image

# TODO: Enable this when we figure out how to run it without having to download several Gigabytes of data.
# - name: Test Docker image
# run: make run-example

- name: Upload Docker image
uses: actions/upload-artifact@v4
with:
name: docker-image
path: oncodrivefml.tar

docs-build:
name: Build documentation
runs-on: ubuntu-latest
Expand All @@ -92,10 +137,9 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Prepare virtual environment
run: make create-env
- uses: astral-sh/setup-uv@v4

- name: Check version matching the tag
- name: Build the docs
shell: bash
run: make docs

Expand All @@ -109,10 +153,6 @@ jobs:
name: Check version
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- packages-build
- docker-build
- docs-build

steps:
- uses: actions/checkout@v4
Expand All @@ -122,8 +162,7 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Prepare virtual environment
run: make create-env
- uses: astral-sh/setup-uv@v4

- name: Check version matching the tag
run: make check-version
Expand All @@ -134,6 +173,8 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
needs:
- check-version
- sdist-build
- wheels-build

steps:
- uses: actions/checkout@v4
Expand All @@ -143,14 +184,15 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Prepare virtual environment
run: make create-env
- uses: astral-sh/setup-uv@v4

- name: Download packages
uses: actions/download-artifact@v4
with:
name: python-packages
path: dist

- run: find ./dist -iname "oncodrive*"

- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
Expand All @@ -162,18 +204,22 @@ jobs:
runs-on: ubuntu-latest
needs:
- check-version
- docker-build

steps:
- if: ${{ env.DOCKER_USERNAME != '' }}
uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Prepare virtual environment
run: make create-env
- uses: astral-sh/setup-uv@v4

- name: Download Docker image
uses: actions/download-artifact@v4
with:
name: docker-image

- name: Login to DockerHub
env:
Expand All @@ -182,4 +228,4 @@ jobs:
run: make docker-login

- name: Push Docker image
run: make push-image
run: make load-image push-image
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ docs/build
# External users tests
external_checks

# VSCode
.vscode/

.ruff_cache/
.venv
data/
21 changes: 9 additions & 12 deletions CHANGELOG.rst → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

Changelog
=========
# Changelog

2.4.0
-----
## 2.5.0

- Adopted uv as a build tool and added a CI/CD pipeline

## 2.4.0

- The ``--no-indels`` flags only discards indels, it cannot enable their
analysis
Expand All @@ -13,19 +15,14 @@ Changelog
- Added seed as option in the configuration file
- Updated dependencies and dropped Python 3.5 support

2.3.0
-----
## 2.3.0

- Added option to set the size limit for the indels

2.2.0
-----
## 2.2.0

- Simplified signature computation using bgsignature.
Complex options should be computed externally.

- Adapted to bgparsers 0.9 that require a regions file with header.

- Simplified indels computation as assuming everything in the positive strand.

- Set by default the indels computation as substitutions.
- Set by default the indels computation as substitutions.
Loading

0 comments on commit ee20b4b

Please sign in to comment.