Skip to content

πŸ› fix(build): read the project metadata from the sdist #1285

πŸ› fix(build): read the project metadata from the sdist

πŸ› fix(build): read the project metadata from the sdist #1285

name: πŸ§ͺ tox-toml-fmt
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
name: πŸ” changes
runs-on: ubuntu-latest
outputs:
run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.run == 'true' }}
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: πŸ” Check for changes
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
run:
- 'toml-doc/**'
- 'common/**'
- 'toml-fmt-common/**'
- 'tox-rules/**'
- 'tox-toml-fmt/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- '.github/workflows/tox_toml_fmt_test.yaml'
clippy:
name: πŸ“Ž clippy
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: πŸ¦€ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: clippy
- name: πŸ“Ž Run Clippy
run: cargo clippy -p tox-toml-fmt -p tox-rules --locked --all-targets -- -D warnings
fmt:
name: 🎨 fmt
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: πŸ¦€ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: rustfmt
- name: 🎨 Check formatting
run: cargo fmt -p tox-toml-fmt -p tox-rules --check
build:
name: πŸ”¨ build
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: πŸ¦€ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
- name: πŸ”¨ Build
run: cargo build -p tox-toml-fmt --locked
test:
name: βœ… test
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
environment: test
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: πŸ¦€ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: llvm-tools-preview
- name: πŸ“¦ Install cargo-llvm-cov and cargo-nextest
uses: taiki-e/install-action@5b4d68e2e660441203ab128a23676f1e4faf1532 # v2.86.3
with:
tool: cargo-llvm-cov,cargo-nextest
- name: βœ… Run tests with coverage
run: cargo llvm-cov nextest -p tox-toml-fmt --no-default-features --locked --fail-under-lines 100 --codecov --output-path coverage.json
- name: πŸ“€ Upload coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.json
flags: tox-toml-fmt
# the tox rules are a crate of their own, so they prove their own coverage rather than leaning
# on the formatter that ships them
- name: βœ… Run the tox rule tests with coverage
run: cargo llvm-cov nextest -p tox-rules --no-default-features --locked --fail-under-lines 100 --codecov --output-path tox-rules.json
- name: πŸ“€ Upload the tox rule coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tox-rules.json
flags: tox-rules
py:
name: 🐍 ${{ matrix.py }} @ ${{ matrix.os }}
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
py: ["3.15", "3.15t", "3.14", "3.14t", "3.13", "3.12", "3.11", "3.10"]
os: [ubuntu-24.04, windows-2025, macos-15]
defaults:
run:
working-directory: tox-toml-fmt
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: πŸ“¦ Setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: πŸ”§ Install tox
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
- name: 🐍 Install Python ${{ matrix.py }}
if: matrix.py != '3.14'
run: uv python install --python-preference only-managed ${{ matrix.py }}
- name: πŸ¦€ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
- name: πŸ“ Generate README.rst
run: tox run -e readme
working-directory: tox-toml-fmt
- name: πŸ“ Generate pyproject-fmt README.rst
run: tox run -e readme
working-directory: pyproject-fmt
- name: πŸ”§ Setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
- name: βœ… Run tests
run: tox run --skip-pkg-install -e ${{ matrix.py }}
env:
PYTEST_ADDOPTS: "-vv --durations=20"
check:
name: πŸ”Ž ${{ matrix.env }}
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
env: [type, dev, pkg_meta, pkg_sdist]
defaults:
run:
working-directory: tox-toml-fmt
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: πŸ“¦ Setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: πŸ”§ Install tox
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
- name: πŸ¦€ Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
- name: πŸ“ Generate README.rst
run: tox run -e readme
working-directory: tox-toml-fmt
- name: πŸ“ Generate pyproject-fmt README.rst
run: tox run -e readme
working-directory: pyproject-fmt
- name: πŸ”§ Setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.env }}
- name: βœ… Run tests
run: tox run --skip-pkg-install -e ${{ matrix.env }}
env:
PYTEST_ADDOPTS: "-vv --durations=20"
all-pass:
name: βœ… tox-toml-fmt
if: always()
needs: [changes, clippy, fmt, build, test, py, check]
runs-on: ubuntu-latest
steps:
- name: Decide whether all jobs passed or were skipped
run: |
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "Some jobs failed or were canceled"
exit 1
fi
echo "All jobs passed or were skipped"