Skip to content

Commit 0888d4c

Browse files
author
Fran
committed
python package workflow
1 parent 535ebff commit 0888d4c

File tree

1 file changed

+47
-71
lines changed

1 file changed

+47
-71
lines changed

.github/workflows/CI.yml

Lines changed: 47 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,24 @@ name: CI
77

88
on:
99
push:
10-
# branches:
11-
# - main
12-
# - master
10+
branches:
11+
- main
12+
- master
1313
tags:
1414
- '*'
15-
# pull_request:
15+
pull_request:
1616
workflow_dispatch:
1717

1818
permissions:
1919
contents: read
2020

2121
jobs:
2222
linux:
23-
runs-on: ${{ matrix.platform.runner }}
23+
runs-on: ubuntu-22.04
2424
strategy:
2525
matrix:
26-
platform:
27-
- runner: ubuntu-22.04
28-
target: x86_64
29-
- runner: ubuntu-22.04
30-
target: x86
31-
- runner: ubuntu-22.04
32-
target: aarch64
33-
- runner: ubuntu-22.04
34-
target: armv7
35-
- runner: ubuntu-22.04
36-
target: s390x
37-
- runner: ubuntu-22.04
38-
target: ppc64le
26+
target: [x86_64, aarch64, ppc64le]
27+
fail-fast: false
3928
steps:
4029
- uses: actions/checkout@v4
4130
- uses: actions/setup-python@v5
@@ -44,29 +33,22 @@ jobs:
4433
- name: Build wheels
4534
uses: PyO3/maturin-action@v1
4635
with:
47-
target: ${{ matrix.platform.target }}
36+
target: ${{ matrix.target }}
4837
args: --release --out dist --find-interpreter
4938
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
5039
manylinux: auto
5140
- name: Upload wheels
5241
uses: actions/upload-artifact@v4
5342
with:
54-
name: wheels-linux-${{ matrix.platform.target }}
43+
name: wheels-linux-${{ matrix.target }}
5544
path: dist
5645

5746
musllinux:
58-
runs-on: ${{ matrix.platform.runner }}
47+
runs-on: ubuntu-22.04
5948
strategy:
6049
matrix:
61-
platform:
62-
- runner: ubuntu-22.04
63-
target: x86_64
64-
- runner: ubuntu-22.04
65-
target: x86
66-
- runner: ubuntu-22.04
67-
target: aarch64
68-
- runner: ubuntu-22.04
69-
target: armv7
50+
target: [x86_64, aarch64]
51+
fail-fast: false
7052
steps:
7153
- uses: actions/checkout@v4
7254
- uses: actions/setup-python@v5
@@ -75,52 +57,50 @@ jobs:
7557
- name: Build wheels
7658
uses: PyO3/maturin-action@v1
7759
with:
78-
target: ${{ matrix.platform.target }}
60+
target: ${{ matrix.target }}
7961
args: --release --out dist --find-interpreter
8062
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
8163
manylinux: musllinux_1_2
8264
- name: Upload wheels
8365
uses: actions/upload-artifact@v4
8466
with:
85-
name: wheels-musllinux-${{ matrix.platform.target }}
67+
name: wheels-musllinux-${{ matrix.target }}
8668
path: dist
8769

8870
windows:
89-
runs-on: ${{ matrix.platform.runner }}
71+
runs-on: windows-latest
9072
strategy:
9173
matrix:
92-
platform:
93-
- runner: windows-latest
94-
target: x64
95-
- runner: windows-latest
96-
target: x86
74+
target: [x64]
75+
fail-fast: false
9776
steps:
9877
- uses: actions/checkout@v4
9978
- uses: actions/setup-python@v5
10079
with:
10180
python-version: 3.x
102-
architecture: ${{ matrix.platform.target }}
81+
architecture: x64
10382
- name: Build wheels
10483
uses: PyO3/maturin-action@v1
10584
with:
106-
target: ${{ matrix.platform.target }}
85+
target: ${{ matrix.target }}
10786
args: --release --out dist --find-interpreter
10887
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
10988
- name: Upload wheels
11089
uses: actions/upload-artifact@v4
11190
with:
112-
name: wheels-windows-${{ matrix.platform.target }}
91+
name: wheels-windows-${{ matrix.target }}
11392
path: dist
11493

11594
macos:
116-
runs-on: ${{ matrix.platform.runner }}
95+
runs-on: ${{ matrix.runner }}
11796
strategy:
11897
matrix:
119-
platform:
98+
include:
12099
- runner: macos-13
121100
target: x86_64
122101
- runner: macos-14
123102
target: aarch64
103+
fail-fast: false
124104
steps:
125105
- uses: actions/checkout@v4
126106
- uses: actions/setup-python@v5
@@ -129,13 +109,13 @@ jobs:
129109
- name: Build wheels
130110
uses: PyO3/maturin-action@v1
131111
with:
132-
target: ${{ matrix.platform.target }}
112+
target: ${{ matrix.target }}
133113
args: --release --out dist --find-interpreter
134114
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
135115
- name: Upload wheels
136116
uses: actions/upload-artifact@v4
137117
with:
138-
name: wheels-macos-${{ matrix.platform.target }}
118+
name: wheels-macos-${{ matrix.target }}
139119
path: dist
140120

141121
sdist:
@@ -153,29 +133,25 @@ jobs:
153133
name: wheels-sdist
154134
path: dist
155135

156-
# release:
157-
# name: Release
158-
# runs-on: ubuntu-latest
159-
# if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
160-
# needs: [linux, musllinux, windows, macos, sdist]
161-
# permissions:
162-
# # Use to sign the release artifacts
163-
# id-token: write
164-
# # Used to upload release artifacts
165-
# contents: write
166-
# # Used to generate artifact attestation
167-
# attestations: write
168-
# steps:
169-
# - uses: actions/download-artifact@v4
170-
# - name: Generate artifact attestation
171-
# uses: actions/attest-build-provenance@v2
172-
# with:
173-
# subject-path: 'wheels-*/*'
174-
# - name: Publish to PyPI
175-
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
176-
# uses: PyO3/maturin-action@v1
177-
# env:
178-
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
179-
# with:
180-
# command: upload
181-
# args: --non-interactive --skip-existing wheels-*/*
136+
release:
137+
name: Release
138+
runs-on: ubuntu-latest
139+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
140+
needs: [linux, musllinux, windows, macos, sdist]
141+
permissions:
142+
id-token: write
143+
contents: write
144+
attestations: write
145+
steps:
146+
- uses: actions/download-artifact@v4
147+
- name: Generate artifact attestation
148+
uses: actions/attest-build-provenance@v2
149+
with:
150+
subject-path: 'wheels-*/*'
151+
- name: Publish to PyPI
152+
uses: PyO3/maturin-action@v1
153+
env:
154+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
155+
with:
156+
command: upload
157+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)