Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI for publishing #5

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 110 additions & 56 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,26 @@ env:
PYTHON_VERSION: 3.11

jobs:
packages-build:
name: Build packages
check-version:
name: Check version
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

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: Check version matching the tag
run: make check-version

check-code:
name: Check code
runs-on: ubuntu-latest
env:
RUFF_FORMAT: github
Expand All @@ -29,35 +47,27 @@ 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}"

- name: Build packages
run: make build-dist
echo "${BOLDRED}==> We won't enforce linting errors for the time being, but we will in the future.${RESET}"

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

docker-build:
name: Build Docker image
docs-build:
name: Build documentation
runs-on: ubuntu-latest
needs:
- check-code

steps:
- uses: actions/checkout@v4
Expand All @@ -67,22 +77,23 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Prepare virtual environment
run: make create-env

- name: Check Dockerfile
run: make check-docker
- uses: astral-sh/setup-uv@v4

- name: Build Docker image
run: make build-image
- name: Build the docs
shell: bash
run: make docs

# 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 documentation
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/build

docs-build:
name: Build documentation
sdist-build:
name: Build sdist
runs-on: ubuntu-latest
needs:
- check-code

steps:
- uses: actions/checkout@v4
Expand All @@ -92,27 +103,26 @@ 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
shell: bash
run: make docs
- name: Build sdist
run: make build-sdist

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

check-version:
name: Check version
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
wheels-build:
name: Build wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
needs:
- packages-build
- docker-build
- docs-build
- check-code

steps:
- uses: actions/checkout@v4
Expand All @@ -122,18 +132,25 @@ 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
- name: Build wheels
run: make build-wheels

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

packages-publish:
name: Publish packages
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- check-version
- sdist-build
- wheels-build

steps:
- uses: actions/checkout@v4
Expand All @@ -143,37 +160,74 @@ 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
pattern: packages-*
merge-multiple: true
path: dist

- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: make publish-dist

docker-build:
name: Build Docker image
runs-on: ubuntu-latest
needs:
- check-code

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: Check Dockerfile
run: make check-docker

- name: Build Docker 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

docker-push:
name: Push Docker image
if: startsWith(github.ref, 'refs/tags/')
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 +236,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/
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.9
3.11
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
Loading