-
-
Notifications
You must be signed in to change notification settings - Fork 0
Optimize workflows, utilizing caching and better workflows #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,47 +9,32 @@ permissions: | |||||
| contents: read | ||||||
|
|
||||||
| jobs: | ||||||
| build: | ||||||
| name: Build distribution 📦 | ||||||
| runs-on: ubuntu-latest | ||||||
|
|
||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
| with: | ||||||
| persist-credentials: false | ||||||
| - name: Set up Python | ||||||
| uses: actions/setup-python@v5 | ||||||
| with: | ||||||
| python-version: "3.x" | ||||||
| - name: Install pypa/build | ||||||
| run: >- | ||||||
| python3 -m | ||||||
| pip install | ||||||
| uv | ||||||
| - name: Build a binary wheel and a source tarball | ||||||
| run: uv build --sdist --wheel --out-dir dist | ||||||
| - name: Store the distribution packages | ||||||
| uses: actions/upload-artifact@v4 | ||||||
| with: | ||||||
| name: python-package-distributions | ||||||
| path: dist/ | ||||||
|
|
||||||
| publish-to-pypi: | ||||||
| name: Publish Python 🐍 distribution 📦 to PyPI | ||||||
| needs: | ||||||
| - build | ||||||
| runs-on: ubuntu-latest | ||||||
| environment: | ||||||
| name: pypi | ||||||
| url: https://pypi.org/p/confkit | ||||||
| permissions: | ||||||
| id-token: write # IMPORTANT: mandatory for trusted publishing | ||||||
| contents: read | ||||||
|
|
||||||
| steps: | ||||||
| - name: Download all the dists | ||||||
| uses: actions/download-artifact@v4 | ||||||
| - name: Checkout | ||||||
| uses: actions/checkout@v4 | ||||||
| with: | ||||||
| name: python-package-distributions | ||||||
| path: dist/ | ||||||
| persist-credentials: false | ||||||
|
|
||||||
| - name: Install uv | ||||||
| uses: astral-sh/setup-uv@v7 | ||||||
| with: | ||||||
| enable-cache: true | ||||||
|
|
||||||
| - name: Set up Python | ||||||
| run: uv python install 3.14 | ||||||
|
|
||||||
| - name: Build distribution 📦 | ||||||
| run: uv build | ||||||
|
|
||||||
| - name: Publish distribution 📦 to PyPI | ||||||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||||||
| run: uv publish | ||||||
|
||||||
| run: uv publish | |
| uses: pypa/gh-action-pypi-publish@release/v1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ permissions: | |
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| check-cache: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
|
|
@@ -33,28 +33,34 @@ jobs: | |
| restore-keys: | | ||
| ${{ runner.os }}-pytest-${{ matrix.python-version }}- | ||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| needs: check-cache | ||
| if: needs.check-cache.outputs.cache-hit != 'true' | ||
| strategy: | ||
|
||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | ||
| fail-fast: false | ||
|
||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install uv | ||
| if: steps.cache-pytest.outputs.cache-hit != 'true' | ||
| uses: astral-sh/setup-uv@v4 | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| version: "latest" | ||
| enable-cache: true | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| if: steps.cache-pytest.outputs.cache-hit != 'true' | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| if: steps.cache-pytest.outputs.cache-hit != 'true' | ||
| run: uv sync --group dev | ||
|
|
||
| - name: Run tests | ||
| if: steps.cache-pytest.outputs.cache-hit != 'true' | ||
| run: uv run pytest . | ||
|
|
||
| - name: Run ruff check | ||
| if: steps.cache-pytest.outputs.cache-hit != 'true' | ||
| run: uv run ruff check . | ||
|
|
||
| - name: Run type checking | ||
| if: steps.cache-pytest.outputs.cache-hit != 'true' | ||
| run: uvx ty check . --ignore no-matching-overload | ||
|
Comment on lines
53
to
54
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow pins the build environment to Python 3.14 via
uv python install 3.14, which may be unavailable/unstable on GitHub runners and isn't required byrequires-python (>=3.11). Prefer a stable version you support (e.g., 3.12 or 3.13) for building and publishing.