Skip to content

Commit dfd363a

Browse files
committed
Update workflows
1 parent 52e0a3c commit dfd363a

File tree

4 files changed

+324
-150
lines changed

4 files changed

+324
-150
lines changed

.github/workflows/deploy.yml

+17-37
Original file line numberDiff line numberDiff line change
@@ -19,62 +19,42 @@ concurrency:
1919

2020

2121
jobs:
22-
build_and_publish_pypi:
22+
publish:
2323
runs-on: ubuntu-latest
24-
if: github.repository_owner == 'statnett'
2524
permissions:
2625
id-token: write
26+
if: github.repository_owner == 'statnett'
2727
steps:
2828
- name: Checkout code
2929
uses: actions/checkout@v4
3030
with:
3131
fetch-depth: 0
32-
- name: Install Python
33-
uses: actions/setup-python@v5
34-
with:
35-
python-version: 3.12
36-
- name: install poetry
37-
run: |
38-
python -m pip install --upgrade pip wheel pipx
39-
python -m pipx install poetry
40-
- name: install dependencies
41-
run: |
42-
poetry install
43-
poetry self add "poetry-dynamic-versioning[plugin]"
44-
- name: run tests and linter
45-
run: |
46-
poetry run pytest
47-
poetry run flake8 .
48-
poetry run black --check .
49-
poetry run isort -c .
50-
- name: build package
51-
run: |
52-
poetry build
32+
- name: Install the latest version of uv and set the python version
33+
uses: astral-sh/setup-uv@v5
34+
- name: Build package
35+
run: uv build
5336
- name: Publish package distributions to PyPI
54-
uses: pypa/gh-action-pypi-publish@release/v1
37+
uses: pypa/gh-action-pypi-publish@release/v1.12
38+
with:
39+
verbose: 'true'
40+
attestations: 'false'
5541

5642
build_docs:
57-
needs: build_and_publish_pypi
43+
needs: publish
5844
runs-on: ubuntu-latest
5945
if: github.repository_owner == 'statnett'
6046
steps:
6147
- name: Checkout code
6248
uses: actions/checkout@v4
63-
- name: Install Python
64-
uses: actions/setup-python@v5
6549
with:
66-
python-version: 3.12
67-
- name: install poetry
68-
run: |
69-
python -m pip install --upgrade pip wheel pipx
70-
python -m pipx install poetry
71-
- name: install dependencies
72-
run: |
73-
poetry install --with docs
74-
- name: build docs
50+
fetch-depth: 0
51+
- name: Install the latest version of uv and set the python version
52+
uses: astral-sh/setup-uv@v5
53+
- name: Build docs
7554
run: |
55+
uv sync --group docs
7656
cd docs
77-
poetry run make html
57+
uv run make html
7858
- name: Setup Pages
7959
id: pages
8060
uses: actions/configure-pages@v5

.github/workflows/tests.yml

+37-27
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
1-
name: tests
1+
---
2+
name: Lint and Test
23

3-
on: [push, pull_request]
4-
jobs:
5-
tests:
6-
strategy:
7-
matrix:
8-
os: [ubuntu-latest]
9-
python: ['3.9', '3.10', '3.11', '3.12']
10-
runs-on: ${{ matrix.os }}
11-
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v5
14-
with:
15-
python-version: ${{ matrix.python }}
16-
- name: install poetry
17-
run: |
18-
python -m pip install --upgrade pip wheel pipx
19-
python -m pipx install poetry
20-
- name: install dependencies
21-
run: poetry install
22-
- name: run tests
23-
run: poetry run pytest
24-
- name: run linter
25-
run: |
26-
poetry run flake8 .
27-
poetry run black --check .
28-
poetry run isort -c .
4+
on: [push, pull_request]
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Install the latest version of uv and set the python version
17+
uses: astral-sh/setup-uv@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Run linting
21+
run: |
22+
uv run --frozen pre-commit run --all-files
23+
24+
test:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
- name: Install the latest version of uv and set the python version
34+
uses: astral-sh/setup-uv@v5
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
- name: Test with python ${{ matrix.python-version }}
38+
run: uv run --frozen pytest

pyproject.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ dev = [
2626
"pytest-randomly==3.16.0",
2727
]
2828
docs = [
29-
"sphinx~=7.0.0",
30-
"sphinxcontrib-bibtex~=2.5.0",
31-
"sphinx-gallery~=0.19.0",
32-
"pydata-sphinx-theme~=0.16.0",
33-
"matplotlib~=3.6.0",
34-
"setuptools~=75.0.0",
29+
"sphinx",
30+
"sphinxcontrib-bibtex",
31+
"sphinx-gallery",
32+
"pydata-sphinx-theme",
33+
"matplotlib",
34+
"setuptools",
3535
]
3636

3737
[tool.setuptools_scm]

0 commit comments

Comments
 (0)