-
Notifications
You must be signed in to change notification settings - Fork 12
179 lines (159 loc) · 6.53 KB
/
pip-nightly.yml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Pip Nightly
on: workflow_dispatch
jobs:
manylinux_2_28-nightly:
name: Build manylinux_2_28 wheels nightly
runs-on: ubuntu-latest
strategy:
matrix:
python: [
{ version: "3.8", abi: "cp38-cp38" },
{ version: "3.9", abi: "cp39-cp39" },
{ version: "3.10", abi: "cp310-cp310" },
{ version: "3.11", abi: "cp311-cp311" },
]
container:
image: quay.io/pypa/manylinux_2_28_x86_64
options: --user root
steps:
- uses: actions/checkout@v1
# Insert steps here to install you other dependencies.
# Note that you're running inside of AlmaLinux 8, not ubuntu
- name: Setup necessary packages
run: |
dnf update -y
dnf install -y \
gtk3-devel \
webkit2gtk3-devel \
openssl-devel \
curl \
wget \
squashfs-tools \
make \
file
- name: Setup dev tools
run: |
yum groupinstall -y "Development Tools"
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2022-07-26 --profile minimal -y
- run: source $HOME/.cargo/env && rustup component add rust-src --toolchain nightly-2022-07-26-x86_64-unknown-linux-gnu
- uses: actions/checkout@v2
- name: Update version in Cargo-linux.toml and pyproject.toml
run: |
sed -i '2s/name = ".*"/name = "pywry-nightly"/' Cargo-linux.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1-dev$(date +%Y%m%d)\"/" Cargo-linux.toml
head Cargo-linux.toml
sed -i '2s/name = ".*"/name = "pywry-nightly"/' pyproject.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1.dev$(date +%Y%m%d)\"/" pyproject.toml
head pyproject.toml
sed -i 's/pip install pywry/pip install pywry-nightly/' README.md
# We remove the Cargo.toml and Cargo.lock files and replace them with
# Cargo-linux.toml and Cargo-linux.lock files, which are configured to build for linux.
- name: Build
run: |
source $HOME/.cargo/env
rm Cargo.toml && rm Cargo.lock
mv Cargo-linux.toml Cargo.toml && mv Cargo-linux.lock Cargo.lock
for PYBIN in /opt/python/${{ matrix.python.abi }}/bin; do
"${PYBIN}/pip" install --upgrade pip wheel auditwheel setuptools-rust toml maturin
"${PYBIN}/maturin" build -m Cargo.toml -o dist/wheels -i "${PYBIN}/python" --release --manylinux off
done
- name: Auditwheel repair
run: |
for wheel in dist/wheels/pywry*.whl; do
auditwheel repair "${wheel}" --plat manylinux_2_28_x86_64 -w dist
done
# Try to install and test importing the package
- name: Test Build
run: |
source $HOME/.cargo/env
for PYBIN in /opt/python/${{ matrix.python.abi }}/bin; do
"${PYBIN}/pip" install --force-reinstall dist/pywry*.whl
"${PYBIN}/python" -c 'from pywry import PyWry; PyWry(); import platform; print(platform.python_version());'
done
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Update version in Cargo.toml and pyproject.toml
run: |
(Get-Content Cargo.toml) -replace '(?m)^name = ".*"', 'name = "pywry-nightly"' | Set-Content Cargo.toml
(Get-Content Cargo.toml) -replace '(?m)^(version = ")(.*)(")', "`$1`$2-dev$(Get-Date -Format "yyyyMMddmm")`$3" | Set-Content Cargo.toml
Get-Content Cargo.toml -Head 4
(Get-Content pyproject.toml) -replace '(?m)^name = ".*"', 'name = "pywry-nightly"' | Set-Content pyproject.toml
(Get-Content pyproject.toml) -replace '(?m)^(version = ")(.*)(")', "`$1`$2.dev$(Get-Date -Format "yyyyMMddmm")`$3" | Set-Content pyproject.toml
Get-Content pyproject.toml -Head 4
(Get-Content README.md) -replace 'pip install pywry', 'pip install pywry-nightly' | Set-Content README.md
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Update version in Cargo.toml and pyproject.toml
run: |
sed -i '' '2s/name = ".*"/name = "pywry-nightly"/' Cargo.toml
sed -i '' "3s/version = \"\(.*\)\"/version = \"\1-dev$(date +%Y%m%d%M)\"/" Cargo.toml
head Cargo.toml
sed -i '' '2s/name = ".*"/name = "pywry-nightly"/' pyproject.toml
sed -i '' "3s/version = \"\(.*\)\"/version = \"\1.dev$(date +%Y%m%d%M)\"/" pyproject.toml
head pyproject.toml
sed -i '' 's/pip install pywry/pip install pywry-nightly/' README.md
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist --target universal2-apple-darwin --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update version in Cargo.toml and pyproject.toml
run: |
sed -i '2s/name = ".*"/name = "pywry-nightly"/' Cargo.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1-dev$(date +%Y%m%d%M)\"/" Cargo.toml
head Cargo.toml
sed -i '2s/name = ".*"/name = "pywry-nightly"/' pyproject.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1.dev$(date +%Y%m%d%M)\"/" pyproject.toml
head pyproject.toml
sed -i 's/pip install pywry/pip install pywry-nightly/' README.md
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
release:
name: Release
runs-on: ubuntu-latest
needs: [macos, windows, sdist, manylinux_2_28-nightly]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.NIGHTLY_PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing *