Skip to content

Commit

Permalink
ci: fix caching and documentation builds
Browse files Browse the repository at this point in the history
at some point, I'll want to replace the shell tasks with Python ones

Signed-off-by: Bryant Finney <[email protected]>
  • Loading branch information
bryant-finney committed Sep 8, 2024
1 parent d9c3fb6 commit fb32f71
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/push-poetry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ jobs:
path: docs

- uses: ./.github/actions/poetry
with:
artifacts: ""
command: setup-versioning
with: { artifacts: "", command: setup-versioning }

- uses: ./.github/actions/poetry
with: { artifacts: "", command: dynamic-versioning }

- uses: ./.github/actions/poetry
with:
Expand Down Expand Up @@ -192,7 +193,6 @@ jobs:

- uses: actions/setup-python@v5
with:
architecture: ${{ matrix.python-architecture || 'x64' }}
python-version: 3.x

- uses: ./.github/actions/poetry
Expand All @@ -218,6 +218,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x

- uses: ./.github/actions/poetry
with: { artifacts: "", command: setup-versioning, groups: build }

- uses: ./.github/actions/poetry
with: { artifacts: "", command: dynamic-versioning, groups: build }

- uses: PyO3/maturin-action@v1
with:
command: sdist
Expand Down
37 changes: 14 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ name = "dicom-echo"
description = "A lightweight, cross-platform, blazingly fast implementation of the C-ECHO DICOM procedure. 🔥"
readme = "README.md"
license = { file = "LICENSE.md" }
authors = [
{ name = "Bryant Finney", email = "[email protected]" },
]
authors = [ { name = "Bryant Finney", email = "[email protected]" } ]
requires-python = ">=3.8.1,<4"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
Expand Down Expand Up @@ -83,9 +81,7 @@ mdformat-frontmatter = "^2.0.8"
mdformat-footnote = "^0.1.1"

[tool.poetry.group.test.dependencies]
coverage = { extras = [
"toml",
], version = ">=6.4,<8.0" }
coverage = { extras = [ "toml" ], version = ">=6.4,<8.0" }
pytest = ">=7.4.4,<9.0.0"
pytest-clarity = "^1.0.1"
pytest-cov = ">=3,<6"
Expand Down Expand Up @@ -119,15 +115,8 @@ python-source = "src"

[tool.ruff]
line-length = 120
src = [
"echoscu",
"src",
"tests",
]

extend-include = [
"*.ipynb",
]
src = [ "echoscu", "src", "tests" ]
extend-include = [ "*.ipynb" ]
fix = true
show-fixes = true
output-format = "full"
Expand Down Expand Up @@ -679,13 +668,16 @@ post_publish = "maturin-upload"

[tool.poe.tasks]
_version.cmd = "poetry version --short"
_missing_cargo.shell = "command -v cargo >/dev/null || echo cargo not found"

[tool.poe.tasks.which-cargo]
expr = "shutil.which('cargo') or ''"
imports = [ "shutil" ]

[tool.poe.tasks.cargo]
help = "Invoke <c1>cargo</c1> commands after applying `poetry-dynamic-versioning` substitutions"
shell = """test -n "$CARGO_MISSING" || cargo $cmd"""
args = [ { name = "cmd", positional = true } ]
uses = { CARGO_MISSING = "_missing_cargo" }
expr = "subprocess.check_output([${CARGO}, *sys.argv[1:]], encoding='utf-8') if ${CARGO} else ''"
imports = [ "subprocess", "sys" ]
uses = { CARGO = "which-cargo" }

[tool.poe.tasks.check-for-prerelease]
capture_stdout = "check-for-prerelease.out"
Expand All @@ -700,7 +692,7 @@ help = "Generate this package's docs"
uses = { PACKAGE_VERSION = "_version" }

[[tool.poe.tasks.docs.sequence]]
ref = "cargo doc -- --target-dir ./docs"
ref = "cargo doc --target-dir docs"

[[tool.poe.tasks.docs.sequence]]
ref = "docs-serve --output-directory ./docs"
Expand All @@ -723,7 +715,6 @@ cmd = """
typer
typing
unittest
unittest.mock
--docformat google
--footer "$PACKAGE_VERSION"
--mermaid
Expand Down Expand Up @@ -808,13 +799,13 @@ cmd = "maturin build --out dist --sdist"
[tool.poe.tasks.maturin-develop]
help = "Install the crate as a module in the poetry-managed virtualenv"
shell = """
if [ -n "$CARGO_MISSING" ]; then
if [ -z "${CARGO}" ]; then
poetry pth
else
maturin develop
fi
"""
uses = { CARGO_MISSING = "_missing_cargo" }
uses = { CARGO = "which-cargo" }

[tool.poe.tasks.maturin-upload]
help = "Invoke <c1>maturin upload</c1> to publish this package to a PyPI registry"
Expand Down

0 comments on commit fb32f71

Please sign in to comment.