Some checks failed
CI (tests + ruff) and stable tag / unittest (py3.10) (push) Has been cancelled
CI (tests + ruff) and stable tag / unittest (py3.11) (push) Has been cancelled
CI (tests + ruff) and stable tag / unittest (py3.12) (push) Has been cancelled
CI (tests + ruff) and stable tag / unittest (py3.13) (push) Has been cancelled
CI (tests + ruff) and stable tag / ruff (py3.12) (push) Has been cancelled
CI (tests + ruff) and stable tag / Tag stable (if version commit) (push) Has been cancelled
https://chatgpt.com/share/69468609-0584-800f-a3e0-9d58210fb0e8
107 lines
2.6 KiB
YAML
107 lines
2.6 KiB
YAML
name: CI (tests + ruff) and stable tag
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
test:
|
|
name: unittest (py${{ matrix.python-version }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: pip
|
|
|
|
- name: Install (editable)
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e .
|
|
|
|
- name: Run tests
|
|
run: |
|
|
make test
|
|
|
|
ruff:
|
|
name: ruff (py3.12)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: pip
|
|
|
|
- name: Install (editable) + ruff
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e .
|
|
pip install ruff
|
|
|
|
- name: Ruff check
|
|
run: |
|
|
ruff check .
|
|
|
|
# Optional: falls du ruff format nutzt
|
|
# - name: Ruff format (check)
|
|
# run: |
|
|
# ruff format --check .
|
|
|
|
stable:
|
|
name: Tag stable (if version commit)
|
|
runs-on: ubuntu-latest
|
|
needs: [test, ruff]
|
|
if: >
|
|
github.event_name == 'push' &&
|
|
github.ref == 'refs/heads/main' &&
|
|
github.repository_owner == 'kevinveenbirkenbach'
|
|
steps:
|
|
- name: Checkout (full history for tags)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check commit message for version
|
|
id: version
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
msg="$(git log -1 --pretty=%B)"
|
|
echo "Commit message:"
|
|
echo "$msg"
|
|
if echo "$msg" | grep -Eq '(^|[^0-9])(v?[0-9]+\.[0-9]+\.[0-9]+)([^0-9]|$)'; then
|
|
echo "has_version=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "has_version=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Update stable tag
|
|
if: steps.version.outputs.has_version == 'true'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
# Force-update lightweight tag "stable" to current commit
|
|
git tag -f stable
|
|
|
|
# Push (force) the tag
|
|
git push -f origin stable
|