arda-mapper v2.0.2 #1
Workflow file for this run
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: Publish To PyPI | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build tooling | |
| run: python -m pip install --upgrade pip build twine | |
| - name: Build source distribution | |
| run: python -m build --sdist | |
| - name: Check source distribution | |
| run: python -m twine check dist/* | |
| - name: Upload source distribution | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-sdist | |
| path: dist/ | |
| build-wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] # macos-latest = Apple Silicon arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.23.3 | |
| env: | |
| # arda ships a pybind11/scikit-build-core C++ ext (src/_markup); scikit-build-core | |
| # pulls cmake + ninja into the build env automatically. | |
| CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*" | |
| CIBW_SKIP: "*-musllinux_* *-manylinux_i686 *-win32" | |
| CIBW_TEST_SKIP: "*" | |
| - name: Upload wheel artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-wheels-${{ matrix.os }} | |
| path: wheelhouse/*.whl | |
| test-wheels: | |
| name: Smoke-test wheel (${{ matrix.os }}, py${{ matrix.python-version }}) | |
| needs: build-wheels | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| include: | |
| - os: ubuntu-latest | |
| artifact: python-wheels-ubuntu-latest | |
| - os: windows-latest | |
| artifact: python-wheels-windows-latest | |
| - os: macos-latest | |
| artifact: python-wheels-macos-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Download wheel artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: wheels/ | |
| - name: Install wheel and import arda | |
| shell: bash | |
| run: | | |
| pip install --upgrade pip | |
| tag="cp${{ matrix.python-version }}"; tag="${tag/./}" | |
| python - "$tag" <<'PY' | |
| import sys, glob, subprocess | |
| tag = sys.argv[1] | |
| matches = sorted(glob.glob(f"wheels/arda_mapper-*-{tag}-*.whl")) | |
| if len(matches) != 1: | |
| raise SystemExit(f"expected 1 wheel for {tag}, found {len(matches)}: {matches}") | |
| subprocess.check_call([sys.executable, "-m", "pip", "install", matches[0]]) | |
| PY | |
| python -c "import arda; print('[OK] arda', arda.__version__)" | |
| publish: | |
| name: Publish To PyPI | |
| needs: [build-sdist, build-wheels, test-wheels] | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| contents: read | |
| id-token: write # required for OIDC trusted publishing | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download distributions | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: python-* | |
| merge-multiple: true | |
| path: dist/ | |
| - name: Validate package version matches release tag | |
| if: github.event_name == 'release' | |
| run: | | |
| python - <<'PY' | |
| from pathlib import Path | |
| import tomllib | |
| version = tomllib.loads(Path("pyproject.toml").read_text())["project"]["version"] | |
| tag = "${{ github.event.release.tag_name }}" | |
| norm = tag[1:] if tag.startswith("v") else tag | |
| if version != norm: | |
| raise SystemExit(f"Version mismatch: pyproject.toml={version}, tag={tag}") | |
| print(f"Version check passed: {version} == {tag}") | |
| PY | |
| - name: List distributions | |
| run: ls -R dist/ | |
| - name: Publish distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |