Merge pull request #50 from koxudaxi/release-version-fix #141
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Check | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: release-check-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| version-check: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Validate lockstep package versions | |
| run: python3 scripts/manage_versions.py check | |
| verify-package-distributions: | |
| needs: version-check | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "3.14" | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@1.94.0 | |
| - name: Build pure Python distributions | |
| run: | | |
| uv build tstring-core --out-dir dist | |
| uv build json-tstring --out-dir dist | |
| uv build toml-tstring --out-dir dist | |
| uv build yaml-tstring --out-dir dist | |
| - name: Build bindings source distribution | |
| run: uvx maturin sdist --manifest-path rust/python-bindings/Cargo.toml --out dist | |
| - name: Check distribution metadata | |
| run: uvx twine check dist/* | |
| verify-bindings-wheels: | |
| needs: version-check | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux | |
| runner: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| maturin_args: --release --manifest-path rust/python-bindings/Cargo.toml --out dist --compatibility pypi -i python3.14 | |
| - os: macos | |
| runner: macos-14 | |
| target: aarch64-apple-darwin | |
| maturin_args: --release --manifest-path rust/python-bindings/Cargo.toml --out dist --compatibility pypi | |
| - os: windows | |
| runner: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| maturin_args: --release --manifest-path rust/python-bindings/Cargo.toml --out dist --compatibility pypi | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: "3.14" | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@1.94.0 | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build pure Python wheels | |
| run: | | |
| uv build tstring-core --wheel --out-dir dist | |
| uv build json-tstring --wheel --out-dir dist | |
| uv build toml-tstring --wheel --out-dir dist | |
| uv build yaml-tstring --wheel --out-dir dist | |
| - name: Build bindings wheel (Linux manylinux) | |
| if: ${{ matrix.os == 'linux' }} | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: ${{ matrix.maturin_args }} | |
| manylinux: "2_28" | |
| sccache: "true" | |
| - name: Build bindings wheel (host) | |
| if: ${{ matrix.os != 'linux' }} | |
| shell: bash | |
| run: | | |
| PYTHON_BIN="$(uv run --python 3.14 python - <<'PY' | |
| import sys | |
| print(sys.executable) | |
| PY | |
| )" | |
| uvx maturin build --release --manifest-path rust/python-bindings/Cargo.toml --out dist --compatibility pypi -i "$PYTHON_BIN" | |
| - name: Check distribution metadata | |
| shell: bash | |
| run: uvx twine check dist/* | |
| - name: Smoke test installed wheels | |
| shell: bash | |
| run: | | |
| uv venv --python 3.14 .smoke-venv | |
| if [ -x .smoke-venv/bin/python ]; then | |
| PYTHON_BIN=.smoke-venv/bin/python | |
| else | |
| PYTHON_BIN=.smoke-venv/Scripts/python.exe | |
| fi | |
| "$PYTHON_BIN" - <<'PY' | |
| from pathlib import Path | |
| import subprocess | |
| import sys | |
| wheels = sorted(str(path) for path in Path("dist").glob("*.whl")) | |
| if not wheels: | |
| raise SystemExit("No wheels were built.") | |
| subprocess.run( | |
| ["uv", "pip", "install", "--python", sys.executable, "--force-reinstall", *wheels], | |
| check=True, | |
| ) | |
| PY | |
| "$PYTHON_BIN" -c "import json_tstring, toml_tstring, yaml_tstring, tstring_bindings, tstring_core" |