diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index b146f9c..ef6c494 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -10,22 +10,19 @@ on: jobs: build: name: Build package - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Provides system Python 3.10 steps: - uses: actions/checkout@v4 # We use Python 3.10 here because it's the minimum Python version supported by this library. - - name: Setup Python 3.10 - uses: actions/setup-python@v5 + - name: setup Python v3.10 with uv + uses: astral-sh/setup-uv@v6 with: python-version: '3.10' - - name: Install dependencies - run: pip install --upgrade pip build - - name: Build package - run: python -m build + run: uv build - name: Upload build artifacts uses: actions/upload-artifact@v4 @@ -33,39 +30,10 @@ jobs: name: dist_packages path: dist/ - test: - # This job tests the built package by installing it via pip and running unit tests (without tox). - name: Test package - needs: build - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: setup Python v3.10 with uv - uses: astral-sh/setup-uv@v6 - with: - python-version: '3.10' - - - name: install packages - run: uv pip install -r pyproject.toml --extra testing - - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: dist_packages - path: dist/ - - - name: Install built package - run: pip install dist/xml2python-*.whl - - - name: Run unit tests - run: python -m pytest - publish: name: Publish package - needs: test - runs-on: ubuntu-latest + needs: build + runs-on: ubuntu-22.04 steps: - name: Download build artifacts @@ -78,7 +46,7 @@ jobs: uses: AButler/upload-release-assets@v3.0 with: files: dist/* - repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.PYPI_API_TOKEN }} - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@v1.12.4 diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 4bb7040..e252e08 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -8,8 +8,25 @@ on: workflow_call: jobs: + prepare: + runs-on: ubuntu-22.04 # Provides system Python 3.10 + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup Python v3.10 with uv + uses: astral-sh/setup-uv@v6 + with: + python-version: '3.10' + enable-cache: true + + - name: install packages + run: uv venv && uv pip install -r pyproject.toml --extra testing + + lint: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Provides system Python 3.10 + needs: prepare steps: - name: checkout @@ -19,18 +36,20 @@ jobs: uses: astral-sh/setup-uv@v6 with: python-version: '3.10' + enable-cache: true - name: install packages - run: uv pip install -r pyproject.toml --extra testing + run: uv venv && uv pip install -r pyproject.toml --extra testing - name: lint using ruff - run: ruff check --output-format github ./src ./tests + run: uv run ruff check --output-format github ./src ./tests - name: format check using ruff - run: ruff format --check ./src ./tests + run: uv run ruff format --check ./src ./tests test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Provides system Python 3.10 + needs: prepare steps: @@ -41,9 +60,10 @@ jobs: uses: astral-sh/setup-uv@v6 with: python-version: '3.10' + enable-cache: true - name: install packages - run: uv pip install -r pyproject.toml --extra testing + run: uv venv && uv pip install -r pyproject.toml --extra testing - name: run pytest - run: python -m pytest tests + run: uv run pytest tests diff --git a/pyproject.toml b/pyproject.toml index 8ad7fee..22d57d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ source = "uv-dynamic-versioning" [tool.hatch.build.hooks.version] path = "src/xml2python/_version.py" template = ''' -version = "{version}" +version = '{version}' ''' [tool.uv-dynamic-versioning]