diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84cff6f..ce26245 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,17 +18,17 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + os: [ubuntu-24.04, macos-15, windows-latest] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] exclude: # Reduce matrix size: test all Python versions on Linux, min/max on others - - os: macos-latest + - os: macos-15 python-version: "3.10" - - os: macos-latest + - os: macos-15 python-version: "3.11" - - os: macos-latest + - os: macos-15 python-version: "3.12" - - os: macos-latest + - os: macos-15 python-version: "3.13" - os: windows-latest python-version: "3.10" @@ -39,29 +39,30 @@ jobs: - os: windows-latest python-version: "3.13" steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: ${{ matrix.python-version }} - name: Build wheels - uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1 + uses: PyO3/maturin-action@423a6347767a8b16e65c2a7a7042e4a921528da8 # v1 with: + maturin-version: "1.16.0" args: --release --out dist - name: Install and test run: | - pip install path-jail --find-links dist --force-reinstall + pip install --no-index --find-links dist path-jail pip install pytest pytest -v lint: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable with: components: clippy, rustfmt - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: "3.12" - run: cargo fmt --check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3bb5c65..0fcd43a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,95 +2,117 @@ name: Release on: push: - tags: - - 'v*' + tags: ['v*'] + pull_request: + branches: [main] permissions: contents: read jobs: - linux: - runs-on: ubuntu-latest + wheels: strategy: + fail-fast: false matrix: - target: [x86_64, aarch64] + include: + - os: ubuntu-24.04 + target: x86_64 + - os: ubuntu-24.04-arm + target: aarch64 + - os: macos-15-intel + target: x86_64-apple-darwin + - os: macos-15 + target: aarch64-apple-darwin + - os: windows-2025 + target: x86_64-pc-windows-msvc + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: - python-version: "3.12" - - name: Build wheels - uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1 + python-version: '3.9' + - uses: PyO3/maturin-action@423a6347767a8b16e65c2a7a7042e4a921528da8 # v1 with: + maturin-version: '1.16.0' target: ${{ matrix.target }} args: --release --out dist manylinux: auto - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + - name: Test built wheel + run: | + python -m pip install --no-index --find-links dist path-jail + python -m pip install pytest + python -m pytest -v + python -c "import importlib.resources as r; p = r.files('path_jail'); assert p.joinpath('py.typed').is_file(); assert p.joinpath('__init__.pyi').is_file()" + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: - name: wheels-linux-${{ matrix.target }} - path: dist - - macos: - runs-on: macos-latest - strategy: - matrix: - target: [x86_64, aarch64] - steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 - with: - python-version: "3.12" - - name: Build wheels - uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1 - with: - target: ${{ matrix.target }}-apple-darwin - args: --release --out dist - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - with: - name: wheels-macos-${{ matrix.target }} - path: dist + name: wheels-${{ matrix.os }} + path: dist/*.whl + if-no-files-found: error + retention-days: 7 - windows: - runs-on: windows-latest + source: + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: - python-version: "3.12" - - name: Build wheels - uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1 + python-version: '3.14' + - uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable with: - args: --release --out dist - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + toolchain: '1.85' + - name: Check versions and build source archive + shell: bash + run: | + python - <<'PYCODE' + import os, tomllib + from pathlib import Path + cargo = tomllib.loads(Path('Cargo.toml').read_text())['package']['version'] + project = tomllib.loads(Path('pyproject.toml').read_text())['project']['version'] + assert cargo == project, (cargo, project) + if os.environ['GITHUB_REF_TYPE'] == 'tag': + assert os.environ['GITHUB_REF_NAME'] == f'v{project}' + PYCODE + python -m pip install maturin==1.16.0 pytest twine + maturin sdist --out dist + python -m twine check --strict dist/* + python -m pip install dist/*.tar.gz + python -m pytest -v + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: - name: wheels-windows - path: dist + name: wheels-sdist + path: dist/*.tar.gz + if-no-files-found: error + retention-days: 7 - sdist: - runs-on: ubuntu-latest + validate: + runs-on: ubuntu-24.04 + needs: [wheels, source] steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - name: Build sdist - uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1 + - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: - command: sdist - args: --out dist - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + python-version: '3.14' + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 with: - name: wheels-sdist + pattern: wheels-* path: dist + merge-multiple: true + - name: Validate complete distribution set + run: | + python -m pip install twine + python -m twine check --strict dist/* + python -c "from pathlib import Path; p=Path('dist'); assert len(list(p.glob('*.whl'))) == 5; assert len(list(p.glob('*.tar.gz'))) == 1" publish: - name: Publish to PyPI - runs-on: ubuntu-latest - needs: [linux, macos, windows, sdist] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-24.04 + needs: [validate] steps: - - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 with: pattern: wheels-* path: dist merge-multiple: true - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1 + - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1 with: password: ${{ secrets.PYPI_TOKEN }} + skip-existing: true diff --git a/CHANGELOG.md b/CHANGELOG.md index eaa87b2..2f3c13f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.4.1 - 2026-12-02 + +- Deliver the 0.4.0 guarded filesystem APIs to PyPI after its artifact upload failure. +- Update PyO3 to 0.30.1 and require Maturin 1.16 for builds. +- Declare Rust 1.85 as the source-build minimum and test Python 3.9–3.15. +- Refresh pinned release actions and test native wheels on all five platforms before publication. +- Validate release versions and distribution metadata, and test installation from the source archive. + ## 0.4.0 - 2026-11-10 - Add `FdJail` guarded file operations, policy options, capabilities, and attestations. diff --git a/Cargo.toml b/Cargo.toml index 70b6c55..0e94932 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "path_jail_py" -version = "0.4.0" +version = "0.4.1" edition = "2021" +rust-version = "1.85" license = "MIT OR Apache-2.0" description = "Python bindings for path_jail - secure filesystem sandbox" repository = "https://github.com/tenuo-ai/path-jail-python" @@ -11,8 +12,8 @@ name = "path_jail" crate-type = ["cdylib"] [dependencies] -path_jail = { version = "0.6", features = ["guard"] } -pyo3 = { version = "0.30", features = ["extension-module", "abi3-py39"] } +path_jail = { version = "0.6.0", features = ["guard"] } +pyo3 = { version = "0.30.1", features = ["extension-module", "abi3-py39"] } [package.metadata] authors = ["Niki A. "] diff --git a/pyproject.toml b/pyproject.toml index 7ca7d9b..64dc868 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["maturin>=1.0,<2.0"] +requires = ["maturin>=1.16,<2.0"] build-backend = "maturin" [project] name = "path-jail" -version = "0.4.0" +version = "0.4.1" description = "Secure filesystem sandbox. Restricts paths to a root directory, preventing traversal attacks." readme = "README.md" license = { text = "MIT OR Apache-2.0" } @@ -22,6 +22,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Programming Language :: Rust", "Topic :: Security", "Typing :: Typed",