Skip to content

Commit 99c273c

Browse files
committed
Fix CI for publishing
1 parent ad9d582 commit 99c273c

File tree

8 files changed

+1335
-158
lines changed

8 files changed

+1335
-158
lines changed

.github/workflows/build.yaml

+111-57
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,29 @@ permissions:
1212

1313
env:
1414
TERM: xterm
15-
PYTHON_VERSION: 3.11
15+
PYTHON_VERSION: 3.12
1616

1717
jobs:
18-
packages-build:
19-
name: Build packages
18+
check-version:
19+
name: Check version
20+
runs-on: ubuntu-latest
21+
if: startsWith(github.ref, 'refs/tags/')
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ env.PYTHON_VERSION }}
30+
31+
- uses: astral-sh/setup-uv@v4
32+
33+
- name: Check version matching the tag
34+
run: make check-version
35+
36+
check-code:
37+
name: Check code
2038
runs-on: ubuntu-latest
2139
env:
2240
RUFF_FORMAT: github
@@ -29,35 +47,27 @@ jobs:
2947
with:
3048
python-version: ${{ env.PYTHON_VERSION }}
3149

32-
- name: Prepare virtual environment
33-
run: make create-env
50+
- uses: astral-sh/setup-uv@v4
3451

3552
- name: Check format
3653
run: |
3754
make check-format || true
3855
BOLDRED=$(tput bold && tput setaf 1)
3956
RESET=$(tput sgr0)
40-
echo "${BOLDRED}==> We won't fail on formatting errors for the time being, but we will in the future.${RESET}"
57+
echo "${BOLDRED}==> We won't penalise formatting errors for the time being, but we will in the future.${RESET}"
4158
4259
- name: Check lint
4360
run: |
4461
make check-lint || true
4562
BOLDRED=$(tput bold && tput setaf 1)
4663
RESET=$(tput sgr0)
47-
echo "${BOLDRED}==> We won't fail on lint errors for the time being, but we will in the future.${RESET}"
48-
49-
- name: Build packages
50-
run: make build-dist
64+
echo "${BOLDRED}==> We won't enforce linting errors for the time being, but we will in the future.${RESET}"
5165
52-
- name: Upload packages
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: python-packages
56-
path: dist
57-
58-
docker-build:
59-
name: Build Docker image
66+
docs-build:
67+
name: Build documentation
6068
runs-on: ubuntu-latest
69+
needs:
70+
- check-code
6171

6272
steps:
6373
- uses: actions/checkout@v4
@@ -67,22 +77,23 @@ jobs:
6777
with:
6878
python-version: ${{ env.PYTHON_VERSION }}
6979

70-
- name: Prepare virtual environment
71-
run: make create-env
72-
73-
- name: Check Dockerfile
74-
run: make check-docker
80+
- uses: astral-sh/setup-uv@v4
7581

76-
- name: Build Docker image
77-
run: make build-image
82+
- name: Build the docs
83+
shell: bash
84+
run: make docs
7885

79-
# TODO: Enable this when we figure out how to run it without having to download several Gigabytes of data.
80-
# - name: Test Docker image
81-
# run: make run-example
86+
- name: Upload documentation
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: documentation
90+
path: docs/build
8291

83-
docs-build:
84-
name: Build documentation
92+
sdist-build:
93+
name: Build sdist
8594
runs-on: ubuntu-latest
95+
needs:
96+
- check-code
8697

8798
steps:
8899
- uses: actions/checkout@v4
@@ -92,27 +103,26 @@ jobs:
92103
with:
93104
python-version: ${{ env.PYTHON_VERSION }}
94105

95-
- name: Prepare virtual environment
96-
run: make create-env
106+
- uses: astral-sh/setup-uv@v4
97107

98-
- name: Check version matching the tag
99-
shell: bash
100-
run: make docs
108+
- name: Build sdist
109+
run: make build-sdist
101110

102-
- name: Upload documentation
111+
- name: Upload packages
103112
uses: actions/upload-artifact@v4
104113
with:
105-
name: documentation
106-
path: docs/build
114+
name: packages-sdist
115+
path: dist
107116

108-
check-version:
109-
name: Check version
110-
runs-on: ubuntu-latest
111-
if: startsWith(github.ref, 'refs/tags/')
117+
wheels-build:
118+
name: Build wheels
119+
runs-on: ${{ matrix.os }}
120+
strategy:
121+
fail-fast: false
122+
matrix:
123+
os: [ubuntu-latest, macos-latest]
112124
needs:
113-
- packages-build
114-
- docker-build
115-
- docs-build
125+
- check-code
116126

117127
steps:
118128
- uses: actions/checkout@v4
@@ -122,18 +132,25 @@ jobs:
122132
with:
123133
python-version: ${{ env.PYTHON_VERSION }}
124134

125-
- name: Prepare virtual environment
126-
run: make create-env
135+
- uses: astral-sh/setup-uv@v4
127136

128-
- name: Check version matching the tag
129-
run: make check-version
137+
- name: Build wheels
138+
run: make build-wheels
130139

140+
- name: Upload packages
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: packages-wheels-${{ matrix.os }}
144+
path: dist
145+
131146
packages-publish:
132147
name: Publish packages
133148
runs-on: ubuntu-latest
134149
if: startsWith(github.ref, 'refs/tags/')
135150
needs:
136151
- check-version
152+
- sdist-build
153+
- wheels-build
137154

138155
steps:
139156
- uses: actions/checkout@v4
@@ -143,37 +160,74 @@ jobs:
143160
with:
144161
python-version: ${{ env.PYTHON_VERSION }}
145162

146-
- name: Prepare virtual environment
147-
run: make create-env
163+
- uses: astral-sh/setup-uv@v4
148164

149165
- name: Download packages
150166
uses: actions/download-artifact@v4
151167
with:
152-
name: python-packages
168+
pattern: packages-*
169+
merge-multiple: true
170+
path: dist
153171

154172
- name: Publish to PyPI
155173
env:
156174
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
157175
run: make publish-dist
158176

177+
docker-build:
178+
name: Build Docker image
179+
runs-on: ubuntu-latest
180+
needs:
181+
- check-code
182+
183+
steps:
184+
- uses: actions/checkout@v4
185+
186+
- name: Set up Python
187+
uses: actions/setup-python@v5
188+
with:
189+
python-version: ${{ env.PYTHON_VERSION }}
190+
191+
- uses: astral-sh/setup-uv@v4
192+
193+
- name: Check Dockerfile
194+
run: make check-docker
195+
196+
- name: Build Docker image
197+
run: make save-image
198+
199+
# TODO: Enable this when we figure out how to run it without having to download several Gigabytes of data.
200+
# - name: Test Docker image
201+
# run: make run-example
202+
203+
- name: Upload Docker image
204+
uses: actions/upload-artifact@v4
205+
with:
206+
name: docker-image
207+
path: oncodrivefml.tar
208+
159209
docker-push:
160210
name: Push Docker image
161211
if: startsWith(github.ref, 'refs/tags/')
162212
runs-on: ubuntu-latest
163213
needs:
164214
- check-version
215+
- docker-build
165216

166217
steps:
167-
- if: ${{ env.DOCKER_USERNAME != '' }}
168-
uses: actions/checkout@v3
218+
- uses: actions/checkout@v4
169219

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

175-
- name: Prepare virtual environment
176-
run: make create-env
225+
- uses: astral-sh/setup-uv@v4
226+
227+
- name: Download Docker image
228+
uses: actions/download-artifact@v4
229+
with:
230+
name: docker-image
177231

178232
- name: Login to DockerHub
179233
env:
@@ -182,4 +236,4 @@ jobs:
182236
run: make docker-login
183237

184238
- name: Push Docker image
185-
run: make push-image
239+
run: make load-image push-image

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ docs/build
3838
# External users tests
3939
external_checks
4040

41+
# VSCode
42+
.vscode/
43+
4144
.ruff_cache/
4245
.venv
4346
data/

.python-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11.9
1+
3.12

CHANGELOG.rst CHANGELOG.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11

2-
Changelog
3-
=========
2+
# Changelog
43

5-
2.4.0
6-
-----
4+
## 2.5.0
5+
6+
- Adopted uv as a build tool and added a CI/CD pipeline
7+
8+
## 2.4.0
79

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

16-
2.3.0
17-
-----
18+
## 2.3.0
1819

1920
- Added option to set the size limit for the indels
2021

21-
2.2.0
22-
-----
22+
## 2.2.0
2323

2424
- Simplified signature computation using bgsignature.
2525
Complex options should be computed externally.
26-
2726
- Adapted to bgparsers 0.9 that require a regions file with header.
28-
2927
- Simplified indels computation as assuming everything in the positive strand.
30-
31-
- Set by default the indels computation as substitutions.
28+
- Set by default the indels computation as substitutions.

0 commit comments

Comments
 (0)