diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 900be67..a4fa5c8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,21 @@ version: 2 updates: - package-ecosystem: "github-actions" - directory: "/" + directories: + - "/" + - "/download-dist" + - "/run-cibuildwheel" + - "/setup" + - "/setup-cibuildwheel" + - "/setup-cibuildwheel-cache" + - "/test-sdist" + - "/test-wheel" + - "/upload-dist" schedule: - interval: "weekly" - labels: [] + interval: "monthly" + groups: + github-actions: + patterns: + - "*" + labels: + - "part: github_actions" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aece4ac..2b954da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,27 +17,26 @@ permissions: jobs: build: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: [ubuntu-latest] - python-version: [3.11] + python-version: ["3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 - name: Prework run: touch pyproject.toml - name: Setup Python - uses: actions-ext/python/setup@main + uses: ./setup with: - version: '3.11' + version: ${{ matrix.python-version }} - name: Setup cibuildwheel - uses: actions-ext/python/setup-cibuildwheel@main + uses: ./setup-cibuildwheel with: - version: '3.11' + version: ${{ matrix.python-version }} - name: Setup cibuildwheel caching - uses: actions-ext/python/setup-cibuildwheel-cache@main + uses: ./setup-cibuildwheel-cache diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..365dfea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +AGENTS.md +ROADMAP.md diff --git a/README.md b/README.md index a7732c1..29a1623 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ # python + Helper actions for Python projects -| Name | Action Reference | Description | -|:-----|:-----------------|:------------| -| [setup](./setup) | actions-ext/python/setup | Setup Python with `pip` caching and `uv` | -| [setup-cibuildwheel](./setup-cibuildwheel) | actions-ext/python/setup-cibuildwheel | Setup [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/) and caching | -| [setup-cibuildwheel-cache](./setup-cibuildwheel-cache) | actions-ext/python/setup-cibuildwheel-cache | Setup [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/) caching | -| [run-cibuildwheel](./run-cibuildwheel) | actions-ext/python/run-cibuildwheel | Run [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/) | -| [upload-dist](./upload-dist) | actions-ext/python/upload-dist | Upload a python sdist or wheel | -| [download-dist](./download-dist) | actions-ext/python/download-dist | Download and install a python sdist or wheel | +| Name | Action Reference | Description | +| :----------------------------------------------------- | :-------------------------------------------- | :--------------------------------------------------------------------------------- | +| [setup](./setup) | `actions-ext/python/setup` | Setup Python with `pip` caching and `uv` | +| [setup-cibuildwheel](./setup-cibuildwheel) | `actions-ext/python/setup-cibuildwheel` | Setup [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/) and caching | +| [setup-cibuildwheel-cache](./setup-cibuildwheel-cache) | `actions-ext/python/setup-cibuildwheel-cache` | Setup [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/) caching | +| [run-cibuildwheel](./run-cibuildwheel) | `actions-ext/python/run-cibuildwheel` | Run [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/) | +| [upload-dist](./upload-dist) | `actions-ext/python/upload-dist` | Upload a python sdist or wheel | +| [download-dist](./download-dist) | `actions-ext/python/download-dist` | Download and install a python sdist or wheel | +| [test-wheel](./test-wheel) | `actions-ext/python/test-wheel` | Install a wheel in a fresh venv and verify module import | +| [test-sdist](./test-sdist) | `actions-ext/python/test-sdist` | Install an sdist in a fresh venv and verify module import | diff --git a/download-dist/README.md b/download-dist/README.md index ffafac1..d555b52 100644 --- a/download-dist/README.md +++ b/download-dist/README.md @@ -7,7 +7,7 @@ The following example yaml code will download and install a `cp311` wheel for `m ```yaml - name: Download wheels - uses: actions-ext/python/download-dist@v1 + uses: actions-ext/python/download-dist@5f78fa2cadf4dad2a7cded3c72655bcdd3dda735 with: version: '3.11' kind: 'wheel' diff --git a/download-dist/action.yml b/download-dist/action.yml index f3cc4aa..303d48d 100644 --- a/download-dist/action.yml +++ b/download-dist/action.yml @@ -25,7 +25,7 @@ runs: using: 'composite' steps: - name: Download artifact (${{ inputs.kind }}) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 with: name: ${{ inputs.kind }} path: ./dist diff --git a/run-cibuildwheel/README.md b/run-cibuildwheel/README.md index 39f5d54..40a3940 100644 --- a/run-cibuildwheel/README.md +++ b/run-cibuildwheel/README.md @@ -7,7 +7,7 @@ The following example yaml code will build a `cp311` wheel for `manylinux-x86_64 ```yaml - name: Run cibuildwheel - uses: actions-ext/python/run-cibuildwheel@v1 + uses: actions-ext/python/run-cibuildwheel@5f78fa2cadf4dad2a7cded3c72655bcdd3dda735 with: version: '3.11' kind: 'cp' diff --git a/run-cibuildwheel/action.yml b/run-cibuildwheel/action.yml index 5ffb747..363d62e 100644 --- a/run-cibuildwheel/action.yml +++ b/run-cibuildwheel/action.yml @@ -27,7 +27,7 @@ runs: using: 'composite' steps: - name: Setup cibuildwheel caching - uses: actions-ext/python/setup-cibuildwheel@v1 + uses: ./setup-cibuildwheel with: version: ${{ inputs.version }} diff --git a/setup-cibuildwheel-cache/README.md b/setup-cibuildwheel-cache/README.md index fe09198..561c23a 100644 --- a/setup-cibuildwheel-cache/README.md +++ b/setup-cibuildwheel-cache/README.md @@ -7,5 +7,5 @@ The following example yaml code will setup cibuildwheel caching. ```yaml - name: Setup cibuildwheel caching - uses: actions-ext/python/setup-cibuildwheel-cache@v1 + uses: actions-ext/python/setup-cibuildwheel-cache@5f78fa2cadf4dad2a7cded3c72655bcdd3dda735 ``` diff --git a/setup-cibuildwheel-cache/action.yml b/setup-cibuildwheel-cache/action.yml index 0453416..196c861 100644 --- a/setup-cibuildwheel-cache/action.yml +++ b/setup-cibuildwheel-cache/action.yml @@ -30,7 +30,7 @@ runs: shell: python - name: Cache cibuildwheel tools - uses: actions/cache@v3 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ${{ steps.cibuildwheel-cache.outputs.dir }} key: ${{ runner.os }}-cibuildwheel-${{ inputs.version }} diff --git a/setup-cibuildwheel/README.md b/setup-cibuildwheel/README.md index bdb3da2..e9461fa 100644 --- a/setup-cibuildwheel/README.md +++ b/setup-cibuildwheel/README.md @@ -7,7 +7,7 @@ The following example yaml code will install cibuildwheel and configure caching. ```yaml - name: Setup cibuildwheel - uses: actions-ext/python/setup-cibuildwheel@v1 + uses: actions-ext/python/setup-cibuildwheel@5f78fa2cadf4dad2a7cded3c72655bcdd3dda735 with: version: '3.11' ``` diff --git a/setup-cibuildwheel/action.yml b/setup-cibuildwheel/action.yml index a3a9efb..0335d2d 100644 --- a/setup-cibuildwheel/action.yml +++ b/setup-cibuildwheel/action.yml @@ -10,13 +10,16 @@ inputs: - '3.10' - '3.11' - '3.12' - default: '3.9' + - '3.13' + - '3.13t' + - '3.14' + default: '3.11' runs: using: 'composite' steps: - name: Setup cibuildwheel caching - uses: actions-ext/python/setup-cibuildwheel-cache@v1 + uses: ./setup-cibuildwheel-cache with: version: ${{ inputs.version }} diff --git a/setup/README.md b/setup/README.md index 186283d..22eb429 100644 --- a/setup/README.md +++ b/setup/README.md @@ -7,7 +7,7 @@ The following example yaml code will setup Python 3.11 environment with pip cach ```yaml - name: Setup Python - uses: actions-ext/python/setup@v1 + uses: actions-ext/python/setup@5f78fa2cadf4dad2a7cded3c72655bcdd3dda735 with: version: '3.11' ``` diff --git a/setup/action.yml b/setup/action.yml index 52bcd3f..c9dc65f 100644 --- a/setup/action.yml +++ b/setup/action.yml @@ -10,27 +10,53 @@ inputs: - '3.10' - '3.11' - '3.12' + - '3.13' + - '3.13t' + - '3.14' + - '3.14t' default: '3.11' + uv: + type: boolean + description: "Use uv to install python packages" + default: 'true' runs: using: 'composite' steps: - name: Set up Python ${{ inputs.version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: python-version: ${{ inputs.version }} + allow-prereleases: true + if: ${{ inputs.uv == 'true' }} + + - name: Set up Python ${{ inputs.version }} + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: ${{ inputs.version }} + allow-prereleases: true cache: "pip" cache-dependency-path: | "**/pyproject.toml" "**/setup.py" + if: ${{ inputs.uv != 'true' }} - name: Install uv - uses: astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 with: + python-version: "${{ inputs.version }}" enable-cache: true ignore-nothing-to-cache: true prune-cache: false + if: ${{ inputs.uv == 'true' }} - name: Setup uv to use system python without extra flags shell: bash run: echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV + if: ${{ inputs.uv == 'true' }} + + - name: Install uv as a python package for use of `python -m uv` + shell: bash + run: python -m pip install uv + if: ${{ inputs.uv == 'true' }} diff --git a/test-sdist/action.yml b/test-sdist/action.yml new file mode 100644 index 0000000..06f4fdb --- /dev/null +++ b/test-sdist/action.yml @@ -0,0 +1,18 @@ +name: Test Sdist Install +description: 'Install an sdist from dist/ in a fresh venv and verify a module can be imported' + +inputs: + module: + description: "Python module name to test importing" + required: true + +runs: + using: 'composite' + steps: + - name: Test sdist install + shell: bash + run: | + python -m venv .test-sdist + VENV_BIN=".test-sdist/bin"; [ -d ".test-sdist/Scripts" ] && VENV_BIN=".test-sdist/Scripts" + for sdist in dist/*.tar.gz; do "$VENV_BIN/pip" install "$sdist"; done + "$VENV_BIN/python" -c "import ${{ inputs.module }}" diff --git a/test-wheel/action.yml b/test-wheel/action.yml new file mode 100644 index 0000000..0d65511 --- /dev/null +++ b/test-wheel/action.yml @@ -0,0 +1,18 @@ +name: Test Wheel Install +description: 'Install a wheel from dist/ in a fresh venv and verify a module can be imported' + +inputs: + module: + description: "Python module name to test importing" + required: true + +runs: + using: 'composite' + steps: + - name: Test wheel install + shell: bash + run: | + python -m venv .test-wheel + VENV_BIN=".test-wheel/bin"; [ -d ".test-wheel/Scripts" ] && VENV_BIN=".test-wheel/Scripts" + for whl in dist/*.whl; do "$VENV_BIN/pip" install "$whl"; done + "$VENV_BIN/python" -c "import ${{ inputs.module }}" \ No newline at end of file diff --git a/upload-dist/README.md b/upload-dist/README.md index 906cba0..75f5c94 100644 --- a/upload-dist/README.md +++ b/upload-dist/README.md @@ -7,7 +7,7 @@ The following example yaml code will upload `dist/*.tar.gz` as an asset called ` ```yaml - name: Upload sdist - uses: actions-ext/python/upload-dist@v1 + uses: actions-ext/python/upload-dist@5f78fa2cadf4dad2a7cded3c72655bcdd3dda735 with: kind: 'sdist' ``` @@ -16,7 +16,7 @@ The following example yaml code will upload `dist/*.whl` as an asset called `whe ```yaml - name: Upload wheel - uses: actions-ext/python/upload-dist@v1 + uses: actions-ext/python/upload-dist@5f78fa2cadf4dad2a7cded3c72655bcdd3dda735 with: kind: 'wheel' ``` diff --git a/upload-dist/action.yml b/upload-dist/action.yml index b7d49aa..4f55a73 100644 --- a/upload-dist/action.yml +++ b/upload-dist/action.yml @@ -13,14 +13,14 @@ runs: using: 'composite' steps: - name: Upload artifact (${{ inputs.kind }}) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: ${{ inputs.kind }} path: 'dist/*.whl' if: ${{ inputs.kind == 'wheel' }} - name: Upload artifact (${{ inputs.kind }}) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: ${{ inputs.kind }} path: 'dist/*.tar.gz'