Adopt rtichoke_viz v0.20.2 #894
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
| # Build and test the Python package. Documentation is handled separately in docs.yml. | |
| name: Python package | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12", "3.13", "3.14"] | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv and set the Python version | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install the project | |
| run: uv sync --all-extras --dev | |
| - name: Check lint | |
| run: uv run ruff check . | |
| - name: Check format | |
| run: uv run ruff format --check . | |
| - name: Check types | |
| run: uv run ty check src/rtichoke | |
| - name: Build package | |
| run: uv build | |
| - name: Verify vendored browser assets in wheel | |
| run: | | |
| uv run python - <<'PY' | |
| from pathlib import Path | |
| import zipfile | |
| wheel = next(Path("dist").glob("*.whl")) | |
| with zipfile.ZipFile(wheel) as archive: | |
| names = set(archive.namelist()) | |
| prefix = "rtichoke/_vendor/rtichoke_viz/" | |
| required = { | |
| f"{prefix}VENDORED_FROM", | |
| f"{prefix}rtichoke-viz-0.20.2.tar.gz", | |
| f"{prefix}rtichoke-viz.js", | |
| f"{prefix}rtichoke-viz.css", | |
| f"{prefix}rtichoke-viz.schema.json", | |
| f"{prefix}rtichoke-viz-v2.schema.json", | |
| f"{prefix}rtichoke-viz-report.schema.json", | |
| } | |
| assert required <= names | |
| assert f"{prefix}rtichoke-viz-0.20.1.tar.gz" not in names | |
| assert f"{prefix}rtichoke-viz-0.20.0.tar.gz" not in names | |
| assert f"{prefix}rtichoke-viz-0.19.0.tar.gz" not in names | |
| assert f"{prefix}rtichoke-viz-0.14.0.tar.gz" not in names | |
| PY | |
| - name: Run tests | |
| run: uv run pytest tests | |
| - name: Show package version | |
| run: grep -r "version" pyproject.toml || grep -r "__version__" rtichoke/ || python -c "import rtichoke; print(rtichoke.__version__)" | |
| release: | |
| if: github.event_name == 'push' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check for intentional release marker change | |
| id: marker | |
| shell: bash | |
| run: | | |
| if git diff --name-only HEAD^ HEAD | grep -qx '.github/release-version'; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install uv | |
| if: steps.marker.outputs.changed == 'true' | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Validate release version | |
| if: steps.marker.outputs.changed == 'true' | |
| id: version | |
| shell: bash | |
| run: | | |
| RELEASE_VERSION=$(tr -d '[:space:]' < .github/release-version) | |
| PACKAGE_VERSION=$(sed -n 's/^version = "\([^"]*\)"/\1/p' pyproject.toml | head -n 1) | |
| test -n "$RELEASE_VERSION" | |
| test "$RELEASE_VERSION" = "$PACKAGE_VERSION" | |
| echo "version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Build package | |
| if: steps.marker.outputs.changed == 'true' | |
| run: uv build | |
| - name: Publish to PyPI | |
| if: steps.marker.outputs.changed == 'true' | |
| run: uv publish | |
| - name: Create GitHub release | |
| if: steps.marker.outputs.changed == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: gh release create "v${VERSION}" --target "${GITHUB_SHA}" --generate-notes --title "v${VERSION}" |