|
3 | 3 | #
|
4 | 4 | # maturin generate-ci github
|
5 | 5 | #
|
6 |
| -name: CI |
| 6 | +name: Build and Publish |
7 | 7 |
|
8 | 8 | on:
|
9 | 9 | push:
|
10 | 10 | branches:
|
11 | 11 | - main
|
12 |
| - - master |
13 |
| - tags: |
14 |
| - - '*' |
15 | 12 | pull_request:
|
16 |
| - workflow_dispatch: |
17 |
| - |
18 |
| -permissions: |
19 |
| - contents: read |
| 13 | + branches: |
| 14 | + - main |
20 | 15 |
|
21 | 16 | jobs:
|
22 |
| - linux: |
23 |
| - runs-on: ${{ matrix.platform.runner }} |
| 17 | + build: |
| 18 | + runs-on: ${{ matrix.os }} |
24 | 19 | strategy:
|
25 | 20 | matrix:
|
26 |
| - platform: |
27 |
| - - runner: ubuntu-latest |
28 |
| - target: x86_64 |
29 |
| - - runner: ubuntu-latest |
30 |
| - target: x86 |
31 |
| - - runner: ubuntu-latest |
32 |
| - target: aarch64 |
33 |
| - - runner: ubuntu-latest |
34 |
| - target: armv7 |
35 |
| - - runner: ubuntu-latest |
36 |
| - target: s390x |
37 |
| - - runner: ubuntu-latest |
38 |
| - target: ppc64le |
39 |
| - steps: |
40 |
| - - uses: actions/checkout@v4 |
41 |
| - - uses: actions/setup-python@v5 |
42 |
| - with: |
43 |
| - python-version: '3.10' |
44 |
| - - name: Build wheels |
45 |
| - uses: PyO3/maturin-action@v1 |
46 |
| - with: |
47 |
| - target: ${{ matrix.platform.target }} |
48 |
| - args: --release --out dist --find-interpreter |
49 |
| - sccache: 'true' |
50 |
| - manylinux: auto |
51 |
| - - name: Upload wheels |
52 |
| - uses: actions/upload-artifact@v4 |
53 |
| - with: |
54 |
| - name: wheels-linux-${{ matrix.platform.target }} |
55 |
| - path: dist |
| 21 | + os: [ubuntu-latest, macos-latest, windows-latest] |
56 | 22 |
|
57 |
| - windows: |
58 |
| - runs-on: ${{ matrix.platform.runner }} |
59 |
| - strategy: |
60 |
| - matrix: |
61 |
| - platform: |
62 |
| - - runner: windows-latest |
63 |
| - target: x64 |
64 |
| - - runner: windows-latest |
65 |
| - target: x86 |
66 | 23 | steps:
|
67 |
| - - uses: actions/checkout@v4 |
68 |
| - - uses: actions/setup-python@v5 |
69 |
| - with: |
70 |
| - python-version: '3.10' |
71 |
| - architecture: ${{ matrix.platform.target }} |
72 |
| - - name: Build wheels |
73 |
| - uses: PyO3/maturin-action@v1 |
74 |
| - with: |
75 |
| - target: ${{ matrix.platform.target }} |
76 |
| - args: --release --out dist --find-interpreter |
77 |
| - sccache: 'true' |
78 |
| - - name: Upload wheels |
79 |
| - uses: actions/upload-artifact@v4 |
| 24 | + - uses: actions/checkout@v2 |
| 25 | + |
| 26 | + - name: Set up Python |
| 27 | + uses: actions/setup-python@v2 |
80 | 28 | with:
|
81 |
| - name: wheels-windows-${{ matrix.platform.target }} |
82 |
| - path: dist |
| 29 | + python-version: 3.9 # Use any version >=3.6 for the build |
83 | 30 |
|
84 |
| - macos: |
85 |
| - runs-on: ${{ matrix.platform.runner }} |
86 |
| - strategy: |
87 |
| - matrix: |
88 |
| - platform: |
89 |
| - - runner: macos-latest |
90 |
| - target: x86_64 |
91 |
| - - runner: macos-14 |
92 |
| - target: aarch64 |
93 |
| - steps: |
94 |
| - - uses: actions/checkout@v4 |
95 |
| - - uses: actions/setup-python@v5 |
| 31 | + - name: Install Rust |
| 32 | + uses: actions-rs/toolchain@v1 |
96 | 33 | with:
|
97 |
| - python-version: '3.10' |
| 34 | + toolchain: stable |
| 35 | + profile: minimal |
| 36 | + override: true |
| 37 | + |
| 38 | + - name: Install maturin |
| 39 | + run: pip install maturin |
| 40 | + |
98 | 41 | - name: Build wheels
|
99 |
| - uses: PyO3/maturin-action@v1 |
100 |
| - with: |
101 |
| - target: ${{ matrix.platform.target }} |
102 |
| - args: --release --out dist --find-interpreter |
103 |
| - sccache: 'true' |
104 |
| - - name: Upload wheels |
105 |
| - uses: actions/upload-artifact@v4 |
| 42 | + run: maturin build --release --strip |
| 43 | + |
| 44 | + - name: Upload artifact |
| 45 | + uses: actions/upload-artifact@v2 |
106 | 46 | with:
|
107 |
| - name: wheels-macos-${{ matrix.platform.target }} |
108 |
| - path: dist |
| 47 | + name: wheels |
| 48 | + path: target/wheels/*.whl |
109 | 49 |
|
110 |
| - sdist: |
| 50 | + publish: |
| 51 | + needs: build |
111 | 52 | runs-on: ubuntu-latest
|
112 | 53 | steps:
|
113 |
| - - uses: actions/checkout@v4 |
114 |
| - - name: Build sdist |
115 |
| - uses: PyO3/maturin-action@v1 |
116 |
| - with: |
117 |
| - command: sdist |
118 |
| - args: --out dist |
119 |
| - - name: Upload sdist |
120 |
| - uses: actions/upload-artifact@v4 |
| 54 | + - uses: actions/checkout@v2 |
| 55 | + |
| 56 | + - name: Download artifact |
| 57 | + uses: actions/download-artifact@v2 |
121 | 58 | with:
|
122 |
| - name: wheels-sdist |
| 59 | + name: wheels |
123 | 60 | path: dist
|
124 | 61 |
|
125 |
| - release: |
126 |
| - name: Release |
127 |
| - runs-on: ubuntu-latest |
128 |
| - if: "startsWith(github.ref, 'refs/tags/')" |
129 |
| - needs: [linux, windows, macos, sdist] |
130 |
| - steps: |
131 |
| - - uses: actions/download-artifact@v4 |
| 62 | + - name: Set up Python |
| 63 | + uses: actions/setup-python@v2 |
| 64 | + with: |
| 65 | + python-version: 3.x |
| 66 | + |
| 67 | + - name: Install twine |
| 68 | + run: pip install twine |
| 69 | + |
132 | 70 | - name: Publish to PyPI
|
133 |
| - uses: PyO3/maturin-action@v1 |
| 71 | + run: twine upload dist/* |
134 | 72 | env:
|
135 |
| - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
136 |
| - with: |
137 |
| - command: upload |
138 |
| - args: --non-interactive --skip-existing wheels-*/* |
| 73 | + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
| 74 | + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
0 commit comments