Skip to content

Commit b67a097

Browse files
authored
Update workflows to use uv (missing updates to tests) (#334)
* feat(workflow docs): use uv to build env & call mkdocs build * feat(build): use uv for build workflow and add pytest dependencies to pyproject.toml
1 parent 9ded99a commit b67a097

File tree

4 files changed

+275
-69
lines changed

4 files changed

+275
-69
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
1+
---
12
name: Build
2-
33
on:
44
workflow_dispatch:
55
push:
6-
branches:
7-
- main
6+
branches: [main]
87
pull_request:
9-
108
jobs:
11-
test:
12-
9+
build:
1310
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
python_version: ['3.10']
17-
18-
steps:
11+
steps:
1912
- uses: actions/checkout@v4
20-
- name: Set up Python
21-
uses: actions/setup-python@v4
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v6
2215
with:
23-
python-version: ${{ matrix.python_version }}
24-
- name: Install dependencies
16+
enable-cache: true
17+
cache-dependency-glob: uv.lock
18+
- name: Setup python
19+
uses: uv python install
20+
- name: Install the project
21+
run: uv sync --locked --all-extras --dev
22+
- name: Lint check
2523
run: |
26-
python -m pip install --upgrade pip
27-
pip install hatch
28-
hatch env create
29-
- name: Lint and typecheck
30-
run: |
31-
hatch run lint-check
24+
uv run ruff format --check .
25+
uv run ruff .
3226
- name: Test
3327
run: |
34-
hatch run test-cov-xml
35-
- uses: codecov/codecov-action@v4
36-
with:
28+
uv run pytest -rA --cov-report=xml
29+
- uses: codecov/codecov-action@v5
30+
with:
3731
token: ${{ secrets.CODECOV_TOKEN }}
3832
fail_ci_if_error: true
3933
verbose: true
Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,38 @@
1-
name: Build documentation
2-
1+
---
2+
name: Build and deploy docs
33
on:
44
workflow_dispatch:
55
push:
6-
branches:
7-
- main
8-
9-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
6+
branches: [main]
107
permissions:
118
contents: read
129
pages: write
1310
id-token: write
14-
15-
# Allow one concurrent deployment
1611
concurrency:
17-
group: "pages"
12+
group: pages
1813
cancel-in-progress: true
19-
20-
# Default to bash
2114
defaults:
2215
run:
2316
shell: bash
24-
2517
jobs:
2618
build:
27-
2819
runs-on: ubuntu-latest
29-
30-
steps:
31-
- uses: actions/checkout@v4
32-
- name: Set up Python
33-
uses: actions/setup-python@v4
34-
with:
35-
python-version: '3.10'
36-
- name: Install dependencies
37-
run: |
38-
python -m pip install --upgrade pip
39-
pip install hatch
40-
hatch env create
41-
- name: Build
42-
run: hatch run docs-build
43-
- name: Upload artifact
44-
uses: actions/upload-pages-artifact@v2
45-
with:
46-
path: ./site
47-
48-
deploy:
49-
environment:
50-
name: github-pages
51-
url: ${{ steps.deployment.outputs.page_url }}
52-
runs-on: ubuntu-latest
53-
needs: build
5420
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up uv
23+
uses: astral-sh/setup-uv@v6
24+
with:
25+
enable-cache: true
26+
cache-dependency-glob: uv.lock
27+
- name: Set up Python
28+
run: uv python install
29+
- name: Install project + dev deps
30+
run: uv sync --locked --all-extras --dev
31+
- name: Build documentation
32+
run: uv run mkdocs build
33+
- name: Upload Pages artifact
34+
uses: actions/upload-pages-artifact@v3
35+
with:
36+
path: site
5537
- name: Deploy to GitHub Pages
56-
id: deployment
57-
uses: actions/deploy-pages@v2
38+
uses: actions/deploy-pages@v4

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ Source = "https://github.com/pinellolab/DNA-Diffusion"
3535
target-version = "py312"
3636
line-length = 120
3737
extend-include = ["*.ipynb"]
38-
select = ["E", "F", "I"]
39-
ignore = ["E721", "E731", "E741", "E742", "E743"]
38+
lint.select = ["E", "F", "I"]
39+
lint.ignore = ["E721", "E731", "E741", "E742", "E743"]
4040
exclude = ["src/refactor"]
4141

42-
[tool.ruff.isort]
42+
[tool.ruff.lint.isort]
4343
known-first-party = ["dnadiffusion"]
4444

4545
[tool.ruff.format]
4646
quote-style = "double"
4747

48-
[tool.ruff.flake8-tidy-imports]
48+
[tool.ruff.lint.flake8-tidy-imports]
4949
ban-relative-imports = "all"
5050

51-
[tool.ruff.per-file-ignores]
51+
[tool.ruff.lint.per-file-ignores]
5252
# Tests can use magic values, assertions, and relative imports
5353
"tests/**/*" = ["PLR2004", "S101", "TID252"]
5454

@@ -87,4 +87,7 @@ dev = [
8787
"pytest-cov>=6.1.1",
8888
"pytest>=8.3.5",
8989
"ruff>=0.11.5",
90+
"mkdocs-material>=9.6.12",
91+
"mkdocstrings>=0.29.1",
92+
"pytest-asyncio>=0.26.0",
9093
]

0 commit comments

Comments
 (0)