chore(renovate): check for pre-commit updates #42
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Code checks | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.*.* | |
pull_request: | |
branches: | |
- main | |
types: [opened, synchronize, reopened, ready_for_review] | |
workflow_dispatch: | |
inputs: | |
force_release: | |
description: Force release | |
required: false | |
type: boolean | |
default: false | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }}-checks | |
cancel-in-progress: true | |
env: | |
UV_LINK_MODE: copy | |
UV_PYTHON_PREFERENCE: only-managed | |
UV_CACHE_DIR: /tmp/.uv-cache | |
jobs: | |
pre-commit: | |
name: Pre-commit | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: jdx/mise-action@v2 | |
with: | |
install: true | |
cache: true | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.UV_CACHE_DIR }} | |
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
uv-${{ runner.os }} | |
- name: Setup venv | |
run: | | |
uv python install | |
make setup-venv | |
- name: Check if uv lock file is up to date | |
env: | |
UV_KEYRING_PROVIDER: subprocess | |
run: | | |
echo "::group::Check if uv lock file is up to date" | |
echo "Detect files that could affect the dynamic versioning if any (git dirty state)" | |
git status --porcelain --untracked-files | |
echo "Performing 'uv lock' in dry-run mode" | |
uv lock --dry-run | |
echo "Performing 'uv lock'" | |
if ! uv lock --locked ; then | |
echo "::error title=uv lock file::The lockfile at 'uv.lock' needs to be updated. To update the lockfile, run 'uv lock'" | |
exit 1 | |
fi | |
echo "::endgroup::" | |
- name: Minimize uv cache | |
run: uv cache prune --ci | |
- name: Detect Python version | |
id: detect-python-version | |
run: | | |
echo "python_version=$(python --version | cut -d " " -f2 | cut -d . -f1-2)" >> "${GITHUB_OUTPUT}" | |
- name: Restore pre-commit cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ steps.detect-python-version.outputs.python_version }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Run pre-commit checks | |
run: | | |
echo "::group::Run pre-commit checks" | |
pre-commit run --all-files --show-diff-on-failure | |
echo "::endgroup::" | |
python-checks: | |
name: Python checks | |
runs-on: ubuntu-latest | |
outputs: | |
deploy_env: ${{ steps.detect-deploy-env.outputs.deploy_env }} | |
needs: | |
- pre-commit | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: jdx/mise-action@v2 | |
with: | |
install: true | |
cache: true | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.uv-cache | |
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
uv-${{ runner.os }} | |
- name: Setup venv | |
run: | | |
uv python install | |
make setup-venv | |
- name: Python checks | |
run: | | |
echo "::group::make lint" | |
make lint | |
echo "::endgroup::" | |
echo "::group::make test" | |
make test | |
echo "::endgroup::" | |
echo "::group::make test-python-versions" | |
make test-python-versions | |
echo "::endgroup::" | |
- name: Run Integration tests | |
run: | | |
echo "::group::make integration-tests" | |
make integration-tests | |
echo "::endgroup::" | |
- name: Minimize uv cache | |
run: uv cache prune --ci | |
- name: Check we can build the distribution | |
run: | | |
echo "::group::make dist" | |
make dist | |
echo "::endgroup::" | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
if: ${{ github.event_name == 'push' || inputs.force_release }} | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Detect environment | |
if: ${{ github.event_name == 'push' || inputs.force_release }} | |
id: detect-deploy-env | |
run: | | |
echo "deploy_env=${{ startsWith(github.ref, 'refs/tags') && 'pypi' || 'testpypi' }}" >> "${GITHUB_OUTPUT}" | |
deploy-release: | |
name: Deploy Release | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' || inputs.force_release }} | |
environment: | |
name: ${{ needs.python-checks.outputs.deploy_env }} | |
url: ${{ needs.python-checks.outputs.deploy_env == 'pypi' && 'https://pypi.org/project/yamkix/' || 'https://test.pypi.org/project/yamkix/' }} | |
permissions: | |
id-token: write | |
needs: | |
- python-checks | |
steps: | |
- name: Download the distribution packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish package distributions to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: ${{ needs.python-checks.outputs.deploy_env == 'pypi' && 'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/' }} |