|
3 | 3 | workflow_dispatch:
|
4 | 4 | push:
|
5 | 5 | branches: [ "main" ]
|
6 |
| - tags-ignore: [ "**" ] |
| 6 | + tags: [ "*" ] |
7 | 7 | pull_request:
|
8 | 8 | schedule:
|
9 | 9 | - cron: "0 8 * * *"
|
10 | 10 | concurrency:
|
11 | 11 | group: build-${{ github.ref }}
|
12 | 12 | cancel-in-progress: true
|
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
13 | 17 | jobs:
|
14 |
| - build_wheels: |
15 |
| - name: Build wheels on ${{ matrix.os }} |
16 |
| - runs-on: ${{ matrix.os }} |
| 18 | + linux: |
| 19 | + runs-on: ${{ matrix.platform.runner }} |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + platform: |
| 23 | + - runner: ubuntu-latest |
| 24 | + target: x86_64 |
| 25 | + - runner: ubuntu-latest |
| 26 | + target: x86 |
| 27 | + - runner: ubuntu-latest |
| 28 | + target: aarch64 |
| 29 | + - runner: ubuntu-latest |
| 30 | + target: armv7 |
| 31 | + - runner: ubuntu-latest |
| 32 | + target: s390x |
| 33 | + - runner: ubuntu-latest |
| 34 | + target: ppc64le |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + - uses: actions/setup-python@v5 |
| 38 | + with: |
| 39 | + python-version: '3.12' |
| 40 | + - name: Build wheels |
| 41 | + uses: PyO3/maturin-action@v1 |
| 42 | + with: |
| 43 | + target: ${{ matrix.platform.target }} |
| 44 | + args: --release --out dist |
| 45 | + sccache: 'true' |
| 46 | + manylinux: auto |
| 47 | + - name: Upload wheels |
| 48 | + uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: wheels-linux-${{ matrix.platform.target }} |
| 51 | + path: dist |
| 52 | + |
| 53 | + windows: |
| 54 | + runs-on: ${{ matrix.platform.runner }} |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + platform: |
| 58 | + - runner: windows-latest |
| 59 | + target: x64 |
| 60 | + - runner: windows-latest |
| 61 | + target: x86 |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + - uses: actions/setup-python@v5 |
| 65 | + with: |
| 66 | + python-version: '3.12' |
| 67 | + architecture: ${{ matrix.platform.target }} |
| 68 | + - name: Build wheels |
| 69 | + uses: PyO3/maturin-action@v1 |
| 70 | + with: |
| 71 | + target: ${{ matrix.platform.target }} |
| 72 | + args: --release --out dist |
| 73 | + sccache: 'true' |
| 74 | + - name: Upload wheels |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: wheels-windows-${{ matrix.platform.target }} |
| 78 | + path: dist |
| 79 | + |
| 80 | + macos: |
| 81 | + runs-on: ${{ matrix.platform.runner }} |
17 | 82 | strategy:
|
18 |
| - fail-fast: false |
19 | 83 | matrix:
|
20 |
| - os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ] |
21 |
| - env: |
22 |
| - CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y |
23 |
| - CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc |
24 |
| - CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH" |
| 84 | + platform: |
| 85 | + - runner: macos-latest |
| 86 | + target: x86_64 |
| 87 | + - runner: macos-14 |
| 88 | + target: aarch64 |
25 | 89 | steps:
|
26 | 90 | - uses: actions/checkout@v4
|
| 91 | + - uses: actions/setup-python@v5 |
| 92 | + with: |
| 93 | + python-version: '3.12' |
27 | 94 | - name: Build wheels
|
28 |
| - |
29 |
| - - uses: actions/upload-artifact@v4 |
| 95 | + uses: PyO3/maturin-action@v1 |
30 | 96 | with:
|
31 |
| - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
32 |
| - path: ./wheelhouse/*.whl |
| 97 | + target: ${{ matrix.platform.target }} |
| 98 | + args: --release --out dist |
| 99 | + sccache: 'true' |
| 100 | + - name: Upload wheels |
| 101 | + uses: actions/upload-artifact@v4 |
| 102 | + with: |
| 103 | + name: wheels-macos-${{ matrix.platform.target }} |
| 104 | + path: dist |
33 | 105 |
|
34 |
| - build_sdist: |
35 |
| - name: Build SDist |
| 106 | + sdist: |
36 | 107 | runs-on: ubuntu-latest
|
37 | 108 | steps:
|
38 | 109 | - uses: actions/checkout@v4
|
39 |
| - - name: Build SDist |
40 |
| - run: pipx run build --sdist |
41 |
| - - uses: actions/upload-artifact@v4 |
| 110 | + - name: Build sdist |
| 111 | + uses: PyO3/maturin-action@v1 |
42 | 112 | with:
|
43 |
| - name: cibw-sdist |
44 |
| - path: dist/*.tar.gz |
| 113 | + command: sdist |
| 114 | + args: --out dist |
| 115 | + - name: Upload sdist |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: wheels-sdist |
| 119 | + path: dist |
45 | 120 |
|
46 |
| - upload_pypi: |
47 |
| - needs: [ build_wheels, build_sdist ] |
| 121 | + release: |
| 122 | + name: Release |
48 | 123 | runs-on: ubuntu-latest
|
49 | 124 | environment:
|
50 | 125 | name: release
|
51 | 126 | url: https://pypi.org/p/pyproject-fmt
|
52 | 127 | permissions:
|
53 | 128 | id-token: write
|
54 |
| - if: github.event_name == 'release' && github.event.action == 'published' |
| 129 | + if: "startsWith(github.ref, 'refs/tags/')" |
| 130 | + needs: [ linux, windows, macos, sdist ] |
55 | 131 | steps:
|
56 | 132 | - uses: actions/download-artifact@v4
|
| 133 | + - name: Publish to PyPI |
| 134 | + uses: PyO3/maturin-action@v1 |
57 | 135 | with:
|
58 |
| - pattern: cibw-* |
59 |
| - path: dist |
60 |
| - merge-multiple: true |
61 |
| - - uses: pypa/gh-action-pypi-publish@release/v1 |
| 136 | + command: upload |
| 137 | + args: --non-interactive --skip-existing wheels-*/* |
0 commit comments