diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0422d3e..fee86c9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -3,10 +3,8 @@ on: workflow_dispatch: push: branches: [ "main" ] - tags-ignore: [ "**" ] + tags: [ "*" ] pull_request: - schedule: - - cron: "0 8 * * *" concurrency: group: check-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ac4545..31a56ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,59 +3,135 @@ on: workflow_dispatch: push: branches: [ "main" ] - tags-ignore: [ "**" ] + tags: [ "*" ] pull_request: schedule: - cron: "0 8 * * *" concurrency: group: build-${{ github.ref }} cancel-in-progress: true + +permissions: + contents: read + jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + linux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: ubuntu-latest + target: x86_64 + - runner: ubuntu-latest + target: x86 + - runner: ubuntu-latest + target: aarch64 + - runner: ubuntu-latest + target: armv7 + - runner: ubuntu-latest + target: s390x + - runner: ubuntu-latest + target: ppc64le + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist + sccache: 'true' + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.platform.target }} + path: dist + + windows: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: windows-latest + target: x64 + - runner: windows-latest + target: x86 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + architecture: ${{ matrix.platform.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-windows-${{ matrix.platform.target }} + path: dist + + macos: + runs-on: ${{ matrix.platform.runner }} strategy: - fail-fast: false matrix: - os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ] - env: - CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y - CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc - CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH" + platform: + - runner: macos-latest + target: x86_64 + - runner: macos-14 + target: aarch64 steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' - name: Build wheels - uses: pypa/cibuildwheel@v2.17.0 - - uses: actions/upload-artifact@v4 + uses: PyO3/maturin-action@v1 with: - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} - path: ./wheelhouse/*.whl + target: ${{ matrix.platform.target }} + args: --release --out dist + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-macos-${{ matrix.platform.target }} + path: dist - build_sdist: - name: Build SDist + sdist: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Build SDist - run: pipx run build --sdist - - uses: actions/upload-artifact@v4 + - name: Build sdist + uses: PyO3/maturin-action@v1 with: - name: cibw-sdist - path: dist/*.tar.gz + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels-sdist + path: dist - upload_pypi: - needs: [ build_wheels, build_sdist ] + release: + name: Release runs-on: ubuntu-latest environment: name: release url: https://pypi.org/p/pyproject-fmt permissions: id-token: write - if: github.event_name == 'release' && github.event.action == 'published' + if: "startsWith(github.ref, 'refs/tags/')" + needs: [ linux, windows, macos, sdist ] steps: - uses: actions/download-artifact@v4 + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 with: - pattern: cibw-* - path: dist - merge-multiple: true - - uses: pypa/gh-action-pypi-publish@release/v1 + command: upload + args: --non-interactive --skip-existing wheels-*/* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 137b809..e21fcf0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,11 +30,6 @@ repos: - id: ruff-format - id: ruff args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix" ] - - repo: https://github.com/doublify/pre-commit-rust - rev: v1.0 - hooks: - - id: fmt - - id: clippy - repo: meta hooks: - id: check-hooks-apply diff --git a/Cargo.lock b/Cargo.lock index 76bb996..678400c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -520,7 +520,7 @@ dependencies = [ [[package]] name = "pyproject-fmt-rust" -version = "2.0.0" +version = "1.0.0" dependencies = [ "indoc", "lexical-sort", diff --git a/Cargo.toml b/Cargo.toml index a67556d..43a5423 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyproject-fmt-rust" -version = "2.0.0" +version = "1.0.0" description = "Format pyproject.toml files" repository = "https://github.com/tox-dev/pyproject-fmt" readme = "README.md"