Skip to content

Commit 8799748

Browse files
committed
refactor: enhance pyproject.toml structure and simplify CI conditions
1 parent 43b7a39 commit 8799748

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

.github/workflows/cd.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ jobs:
6060
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
6161
git tag -a "${VERSION}" -m "Release ${VERSION}"
6262
git push origin "${VERSION}"
63-
if: ${{ env.PIPELINE_TAG == 'true' && env.RELEASE_MODE == 'true' }}
63+
if: ${{ env.RELEASE_MODE == 'true' }}
6464

6565
- name: Build package
6666
shell: bash
6767
run: uv build
68-
if: ${{ env.PIPELINE_TAG == 'true' && env.RELEASE_MODE == 'true' }}
68+
if: ${{ env.RELEASE_MODE == 'true' }}
6969

7070
- name: Upload package to artifact registry
7171
uses: actions/upload-artifact@v6
7272
with:
7373
name: uvtask
7474
path: dist/
75-
if: ${{ env.PIPELINE_TAG == 'true' && env.RELEASE_MODE == 'true' }}
75+
if: ${{ env.RELEASE_MODE == 'true' }}
7676

7777
- name: Publish package
7878
shell: bash
79-
run: uv publish
80-
if: ${{ env.PIPELINE_TAG == 'true' && env.RELEASE_MODE == 'true' }}
79+
run: uv publish --token "${{ secrets.UV_PUBLISH_TOKEN }}"
80+
if: ${{ env.RELEASE_MODE == 'true' }}
8181

8282
- name: Clean
8383
shell: bash

pyproject.toml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,28 +125,31 @@ exclude = [
125125
]
126126

127127
[tool.run-script]
128-
install = "uv sync --frozen --no-dev"
129-
upgrade-install = "uv sync --frozen --no-dev --upgrade --refresh"
130-
dev-install = "uv sync --dev --all-extras"
131-
upgrade-dev-install = "uv sync --dev --all-extras --upgrade --refresh"
132-
code-formatter = "uv run ruff format uvtask tests"
133-
"security-analysis:licenses" = "uv run pip-licenses"
134-
"security-analysis:vulnerabilities" = "uv run bandit -r -c pyproject.toml uvtask tests"
135-
"static-analysis:linter" = "uv run ruff check uvtask tests"
136-
"static-analysis:types" = "uv run ty check uvtask tests"
137-
unit-tests = "uv run pytest tests/unit"
138-
integration-tests = "uv run pytest tests/integration"
139-
functional-tests = "uv run pytest -n1 tests/functional"
140-
coverage = "uv run pytest -n1 --cov --cov-report=html"
141-
clean = """python3 -c "
128+
install = { command = "uv sync --frozen --no-dev", description = "Install dependencies as specified in lockfile, excluding dev dependencies" }
129+
upgrade-install = { command = "uv sync --frozen --no-dev --upgrade --refresh", description = "Upgrade and refresh installation of non-dev dependencies" }
130+
dev-install = { command = "uv sync --dev --all-extras", description = "Install all dependencies including dev and extras" }
131+
upgrade-dev-install = { command = "uv sync --dev --all-extras --upgrade --refresh", description = "Upgrade and refresh installation of all dependencies including dev and extras" }
132+
code-formatter = { command = "ruff format uvtask tests", description = "Format code with ruff" }
133+
"security-analysis" = { command = ["security-analysis:licenses", "security-analysis:vulnerabilities"], description = "Run all security analysis checks" }
134+
"security-analysis:licenses" = { command = "pip-licenses", description = "Check third-party dependencies licenses using pip-licenses" }
135+
"security-analysis:vulnerabilities" = { command = "bandit -r -c pyproject.toml uvtask tests", description = "Scan code for security vulnerabilities using bandit" }
136+
"static-analysis" = { command = ["static-analysis:linter", "static-analysis:types"], description = "Run all static analysis checks" }
137+
"static-analysis:linter" = { command = "ruff check uvtask tests", description = "Run linter checks using ruff" }
138+
"static-analysis:types" = { command = "ty check uvtask tests", description = "Run type checks using ty" }
139+
test = { command = ["unit-tests", "integration-tests", "functional-tests"], description = "Run all tests with pytest" }
140+
unit-tests = { command = "pytest tests/unit", description = "Run unit tests with pytest" }
141+
integration-tests = { command = "pytest tests/integration", description = "Run integration tests with pytest" }
142+
functional-tests = { command = "pytest -n1 tests/functional", description = "Run functional tests with pytest" }
143+
coverage = { command = "pytest -n1 --cov --cov-report=html", description = "Run tests with coverage report in HTML using pytest" }
144+
clean = { command = """python3 -c "
142145
from glob import iglob
143146
from shutil import rmtree
144147
145148
for pathname in ['./build', './*.egg-info', './dist', './var', '**/__pycache__']:
146149
for path in iglob(pathname, recursive=True):
147150
rmtree(path, ignore_errors=True)
148151
"
149-
"""
152+
""", description = "Clean build artifacts" }
150153

151154
[project.scripts]
152155
uvtask = "uvtask.cli:main"

0 commit comments

Comments
 (0)