-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (134 loc) · 4.55 KB
/
build.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
# This workflow only runs for tags. It takes a lot of time to complete because
# it has to bundle Z3 statically into the final binary.
# Specifically, we:
# - Build the library using static Z3 on linux/windows/macOS and upload the result to GitHub storage.
# - Create a release package from the uploaded wheel files and push it to PyPI.
# - Do the same thing for conda, but also for different versions of Python.
name: build
on:
push:
tags:
- '*'
env:
# A fixed version used for testing, so that the builds don't
# spontaneously break after a few years.
# Make sure to update this from time to time.
RUST_VERSION: "1.84.0"
# This is the version currently used by `z3-sys`.
# If this ever changes, you might also need to increase
# the minimum macOS version below.
Z3_VERSION: "4.13.4"
MACOS_TARGET: "11.0"
PYTHON_VERSION: "3.12"
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout.
uses: actions/checkout@v4
# On linux, everything is installed in the container,
# so we don't really need any dependencies here.
- name: Maturin build.
uses: PyO3/maturin-action@v1
with:
target: x86_64
container: daemontus/manylinux-aeon:latest
args: "--release --features static-z3 --compatibility manylinux_2_28 --out=target/dist"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux
path: target/dist
build-macos:
runs-on: macos-latest
steps:
- name: Checkout.
uses: actions/checkout@v4
- name: Setup Python.
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
# The considered version of z3 needs at least this version of macOS.
- run: echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV
- run: echo "CMAKE_OSX_DEPLOYMENT_TARGET=${{ env.MACOS_TARGET }}" >> $GITHUB_ENV
- name: Maturin build.
uses: PyO3/maturin-action@v1
with:
command: build
args: "--release --target universal2-apple-darwin --features static-z3 --out=target/dist"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: target/dist
build-windows:
runs-on: windows-latest
steps:
- name: Checkout.
uses: actions/checkout@v4
- name: Setup Python.
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
# Surprisingly, windows is the easiest. Just build the thing.
- name: Maturin build.
uses: PyO3/maturin-action@v1
with:
target: x64
args: "--release --features static-z3 --out=target/dist"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: target/dist
release:
name: Release
runs-on: ubuntu-latest
needs: [ build-macos, build-windows, build-linux ]
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: 'true'
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing *
conda_deployment_with_new_tag:
name: Conda deployment (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
# For now, windows builds are broken...
os: [macos-latest, ubuntu-latest]
python: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Conda environment creation and activation
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python }}
environment-file: conda_env.yaml
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Build and upload the conda packages
uses: uibcdf/[email protected]
with:
python-version: ${{ matrix.python }}
meta_yaml_dir: "conda"
user: daemontus
label: main
overwrite: false
token: ${{ secrets.ANACONDA_TOKEN }}