From 26bed3993354ba4f0435a1440a4aaa0ceec5c77f Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Fri, 3 Oct 2025 18:31:06 +0200 Subject: [PATCH 1/2] add workflow to check eof --- .github/workflows/validate-versions.yml | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/validate-versions.yml diff --git a/.github/workflows/validate-versions.yml b/.github/workflows/validate-versions.yml new file mode 100644 index 000000000..48cad4630 --- /dev/null +++ b/.github/workflows/validate-versions.yml @@ -0,0 +1,44 @@ +name: Validate Versions +on: + workflow_call: + inputs: + python-version: + required: true + type: string + matplotlib-version: + required: true + type: string + +jobs: + validate-versions: + runs-on: ubuntu-latest + steps: + - name: Install tools + run: | + python3 -m pip install --upgrade pip + pip install requests packaging + + - name: Validate Python version + run: | + PY_VERSION="${{ inputs.python-version }}" + echo "Checking Python version: $PY_VERSION" + + curl -s https://endoflife.date/api/python.json > python_eol.json + + SUPPORTED=$(python3 - <<'PYCODE' +import json +from datetime import date +data = json.load(open("python_eol.json")) +today = date.today() +supported = [d["cycle"] for d in data if d.get("eol") in (False, None) or date.fromisoformat(str(d["eol"])) >= today] +print(",".join(supported)) +PYCODE +) + echo "Supported Python versions: $SUPPORTED" + + if ! echo "$SUPPORTED" | grep -qw "$PY_VERSION"; then + echo "❌ Python $PY_VERSION is EOL!" + exit 1 + else + echo "✅ Python $PY_VERSION is supported." + fi From 9c477bc8e8d2e958816dda5a6d337b4fe482b2c6 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Fri, 3 Oct 2025 18:32:45 +0200 Subject: [PATCH 2/2] version 2 --- .github/workflows/validate-versions.yml | 59 ++++++++++--------------- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/.github/workflows/validate-versions.yml b/.github/workflows/validate-versions.yml index 48cad4630..188154838 100644 --- a/.github/workflows/validate-versions.yml +++ b/.github/workflows/validate-versions.yml @@ -1,44 +1,33 @@ -name: Validate Versions +name: Version Check + on: - workflow_call: - inputs: - python-version: - required: true - type: string - matplotlib-version: - required: true - type: string + workflow_dispatch: + push: + branches: + - main + pull_request: jobs: - validate-versions: + check-versions: runs-on: ubuntu-latest + steps: - - name: Install tools - run: | - python3 -m pip install --upgrade pip - pip install requests packaging + - name: Checkout repository + uses: actions/checkout@v4 - - name: Validate Python version - run: | - PY_VERSION="${{ inputs.python-version }}" - echo "Checking Python version: $PY_VERSION" + - name: Install yq for toml parsing + run: pip install yq - curl -s https://endoflife.date/api/python.json > python_eol.json + - name: Read Python versions from pyproject.toml + id: versions + run: | + PYTHON_VERSION=$(tomlq -r .tool.poetry.dependencies.python < pyproject.toml | tr -d '"') + MATPLOTLIB_VERSION=$(tomlq -r .tool.poetry.dependencies.matplotlib < pyproject.toml | tr -d '"') - SUPPORTED=$(python3 - <<'PYCODE' -import json -from datetime import date -data = json.load(open("python_eol.json")) -today = date.today() -supported = [d["cycle"] for d in data if d.get("eol") in (False, None) or date.fromisoformat(str(d["eol"])) >= today] -print(",".join(supported)) -PYCODE -) - echo "Supported Python versions: $SUPPORTED" + echo "python_version=$PYTHON_VERSION" >> $GITHUB_OUTPUT + echo "matplotlib_version=$MATPLOTLIB_VERSION" >> $GITHUB_OUTPUT - if ! echo "$SUPPORTED" | grep -qw "$PY_VERSION"; then - echo "❌ Python $PY_VERSION is EOL!" - exit 1 - else - echo "✅ Python $PY_VERSION is supported." - fi + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ steps.versions.outputs.python_version }}