Update dependency ruff to v0.12.0 #296
This file contains hidden or 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: ci | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
env: | |
POETRY_HOME: /opt/poetry | |
POETRY_CACHE: /opt/poetry_cache | |
POETRY_VERSION: 1.7.1 | |
jobs: | |
lint_and_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event. Selected python version is ${{ matrix.python-version }}." | |
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install | |
run: | | |
task install | |
task uv:debug | |
env: | |
UV_PYTHON: ${{ matrix.python-version }} | |
- name: Run lint | |
run: | | |
if [ "${{ matrix.python-version }}" = "3.8" ]; then | |
# As we have mypy issues with 3.8 => let's skip | |
export LINT_MYPY=0 | |
fi | |
task lint | |
task uv:debug | |
env: | |
FIX: 0 | |
- name: Run tests | |
run: | | |
task test | |
- name: Run doc | |
if: matrix.python-version == '3.12' | |
run: | | |
task doc | |
- name: Check modified files | |
if: matrix.python-version == '3.12' | |
run: | | |
task no-dirty | |
- name: Clean | |
if: matrix.python-version == '3.12' | |
run: | | |
task clean | |
- name: Check modified files (after clean) | |
if: matrix.python-version == '3.12' | |
run: | | |
task no-dirty | |
publish_pypi: | |
runs-on: ubuntu-latest | |
needs: lint_and_test | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6 | |
with: | |
version: "latest" | |
python-version: 3.12 | |
- name: Install | |
run: | | |
task install | |
- name: Override BASEURL in README.md | |
env: | |
BASEURL: https://github.com/fabien-marty/jinja-tree/blob/main/ | |
run: | | |
task doc | |
- name: Publish on Pypi | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's|refs/tags/v||') | |
echo "VERSION: $VERSION" | |
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version "$VERSION" | |
task publish | |
env: | |
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
publish_docker: | |
runs-on: ubuntu-latest | |
needs: ["lint_and_test"] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | |
latest=true | |
tags: | | |
type=ref,event=tag | |
- name: Build and push Docker image | |
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6 | |
with: | |
push: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
mergify-ci-status: # this is a special job for mergify | |
runs-on: ubuntu-24.04 | |
needs: ["lint_and_test", "publish_docker"] | |
steps: | |
- name: Status | |
run: | | |
echo "OK" |