-
Notifications
You must be signed in to change notification settings - Fork 1
114 lines (102 loc) · 3.09 KB
/
linux.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: linux
on: push
jobs:
sdist:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
env:
RUST_TOOLCHAIN: "1.72" # MSRV
steps:
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_TOOLCHAIN -y
- run: rustup default $RUST_TOOLCHAIN
- uses: actions/checkout@v4
- run: python3 -m pip install --user --upgrade pip "maturin>=1,<2" wheel
- run: maturin build
- run: cargo fetch
- run: mkdir .cargo
- run: maturin sdist --out=dist
- run: python3 -m pip install --user dist/rust_x3dh*.tar.gz
env:
CARGO_NET_OFFLINE: "true"
- name: Store sdist
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
retention-days: 1
musllinux_1_2:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python: [
{ version: '3.12' },
{ version: '3.11' },
{ version: '3.10' },
{ version: '3.9' },
{ version: '3.8' },
]
platform:
- target: aarch64-unknown-linux-musl
arch: aarch64
platform: linux/arm64
- target: x86_64-unknown-linux-musl
arch: x86_64
platform: linux/amd64
steps:
- uses: actions/checkout@v4
- name: Build
uses: PyO3/maturin-action@v1
env:
CC: "gcc"
CFLAGS: "-O2"
LDFLAGS: "-O2 -flto -Wl,--as-needed"
RUSTFLAGS: "-C target-feature=-crt-static -Z mir-opt-level=4"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
with:
rust-toolchain: nightly-2024-02-13
rustup-components: rust-src
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_2
args: --release --strip --out=dist -i python${{ matrix.python.version }}
- name: Set up QEMU
if: matrix.platform.arch != 'x86_64'
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v8.1.4
platforms: ${{ matrix.platform.platform }}
- name: Store wheels
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
retention-days: 1
pypi:
name: PyPI
permissions:
# trusted publisher
id-token: write
contents: write
runs-on: ubuntu-22.04
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ musllinux_1_2, sdist ]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install pip "maturin>=1,<2"
- run: ls -1 .
- name: deploy wheel
run: maturin upload --skip-existing --username "${{ secrets.PYPI_USER_NAME }}" *.whl
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
- name: deploy sdist
run: maturin upload --skip-existing --username "${{ secrets.PYPI_USER_NAME }}" *.tar.gz
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}