From 2d578d8c53a7ae8175e9c5c8fb2b3ee7c5aa7a41 Mon Sep 17 00:00:00 2001 From: David Lord Date: Tue, 17 Jun 2025 09:55:49 -0700 Subject: [PATCH] work --- .github/actions/python-versions/action.yml | 26 ++++++++++ .github/actions/python-versions/run.py | 15 ++++++ .github/workflows/lock.yaml | 24 --------- .github/workflows/publish.yaml | 45 ---------------- .../{pre-commit.yaml => shared.yaml} | 10 +--- .github/workflows/tests.yaml | 51 ------------------- 6 files changed, 43 insertions(+), 128 deletions(-) create mode 100644 .github/actions/python-versions/action.yml create mode 100644 .github/actions/python-versions/run.py delete mode 100644 .github/workflows/lock.yaml delete mode 100644 .github/workflows/publish.yaml rename .github/workflows/{pre-commit.yaml => shared.yaml} (52%) delete mode 100644 .github/workflows/tests.yaml diff --git a/.github/actions/python-versions/action.yml b/.github/actions/python-versions/action.yml new file mode 100644 index 00000000..802c8956 --- /dev/null +++ b/.github/actions/python-versions/action.yml @@ -0,0 +1,26 @@ +name: get test environments +description: Inspect a Python project and generate a test environment matrix. +inputs: + windows-env: + description: Include a Windows environment with the latest Python version. + required: false + default: 'false' + macos-env: + description: Include a macOS environment with the latest Python version. + required: false + default: 'false' + extra-envs: + description: Add these additional environments to the output. + required: false + default: '' +outputs: + matrix: + description: A JSON list of test environments. + value: ${{ steps.run.outputs.matrix }} +runs: + using: composite + steps: + - name: get test environments + id: run + shell: bash + run: python3 -Iu '${{github.action_path}}/run.py' diff --git a/.github/actions/python-versions/run.py b/.github/actions/python-versions/run.py new file mode 100644 index 00000000..e65784bb --- /dev/null +++ b/.github/actions/python-versions/run.py @@ -0,0 +1,15 @@ +import configparser +import os +import tomllib + +tox_conf = configparser.ConfigParser(interpolation=None) +tox_conf.read("tox.ini", "utf-8") + +with open("pyproject.toml", "rb") as f: + pyproj = tomllib.load(f) + +print(tox_conf) +print(tomllib) + +with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as f: + print("[]", file=f) diff --git a/.github/workflows/lock.yaml b/.github/workflows/lock.yaml deleted file mode 100644 index f3055c54..00000000 --- a/.github/workflows/lock.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Lock inactive closed issues -# Lock closed issues that have not received any further activity for two weeks. -# This does not close open issues, only humans may do that. It is easier to -# respond to new issues with fresh examples rather than continuing discussions -# on old issues. - -on: - schedule: - - cron: '0 0 * * *' -permissions: - issues: write - pull-requests: write - discussions: write -concurrency: - group: lock -jobs: - lock: - runs-on: ubuntu-latest - steps: - - uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1 - with: - issue-inactive-days: 14 - pr-inactive-days: 14 - discussion-inactive-days: 14 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 2462f71f..00000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: Publish -on: - push: - tags: ['*'] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0 - with: - enable-cache: true - prune-cache: false - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version-file: pyproject.toml - - run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV - - run: uv build - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - path: ./dist - create-release: - needs: [build] - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - - name: create release - run: gh release create --draft --repo ${{ github.repository }} ${{ github.ref_name }} artifact/* - env: - GH_TOKEN: ${{ github.token }} - publish-pypi: - needs: [build] - environment: - name: publish - url: https://pypi.org/project/Flask/${{ github.ref_name }} - runs-on: ubuntu-latest - permissions: - id-token: write - steps: - - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 - with: - packages-dir: artifact/ diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/shared.yaml similarity index 52% rename from .github/workflows/pre-commit.yaml rename to .github/workflows/shared.yaml index eda8c518..286e3afc 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/shared.yaml @@ -1,4 +1,4 @@ -name: pre-commit +name: shared on: pull_request: push: @@ -16,10 +16,4 @@ jobs: id: setup-python with: python-version-file: pyproject.toml - - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ~/.cache/pre-commit - key: pre-commit|${{ hashFiles('pyproject.toml', '.pre-commit-config.yaml') }} - - run: uv run --locked --group pre-commit pre-commit run --show-diff-on-failure --color=always --all-files - - uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0 - if: ${{ !cancelled() }} + - uses: ./.github/actions/python-versions diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml deleted file mode 100644 index 4765995b..00000000 --- a/.github/workflows/tests.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: Tests -on: - pull_request: - paths-ignore: ['docs/**', 'README.md'] - push: - branches: [main, stable] - paths-ignore: ['docs/**', 'README.md'] -jobs: - tests: - name: ${{ matrix.name || matrix.python }} - runs-on: ${{ matrix.os || 'ubuntu-latest' }} - strategy: - fail-fast: false - matrix: - include: - - {python: '3.13'} - - {name: Windows, python: '3.13', os: windows-latest} - - {name: Mac, python: '3.13', os: macos-latest} - - {python: '3.12'} - - {python: '3.11'} - - {python: '3.10'} - - {name: PyPy, python: 'pypy-3.11', tox: pypy3.11} - - {name: Minimum Versions, python: '3.13', tox: tests-min} - - {name: Development Versions, python: '3.10', tox: tests-dev} - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0 - with: - enable-cache: true - prune-cache: false - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: ${{ matrix.python }} - - run: uv run --locked tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }} - typing: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0 - with: - enable-cache: true - prune-cache: false - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version-file: pyproject.toml - - name: cache mypy - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ./.mypy_cache - key: mypy|${{ hashFiles('pyproject.toml') }} - - run: uv run --locked tox run -e typing