Skip to content

Commit e6b79eb

Browse files
committed
cicd: make pre-release workflow manually triggerable
This workflow checks if driver works with next pre-release python version. We don't want to have them in PRs, if it fails it does not mean that PR is bad. It would be better to manually trigger it for now, and later we will make it check on existing pre-release versions and run on them once a month.
1 parent 66b951f commit e6b79eb

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: Build pre release python versions
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
workflow_dispatch:
9+
inputs:
10+
python-version:
11+
description: 'Python version to run against'
12+
required: true
13+
type: string
14+
default: "1.13"
15+
16+
target:
17+
type: string
18+
description: "target os to build for: linux, macos, windows"
19+
default: "linux,macos,windows"
20+
21+
cibw-skip:
22+
type: string
23+
description: 'CIBUILDWHEEL builds pattern to skip, goes to CIBW_SKIP env'
24+
required: false
25+
default: 'cp36* cp37* pp*i686 *musllinux*'
26+
27+
env:
28+
CIBW_TEST_COMMAND_LINUX: >
29+
pytest {project}/tests/unit &&
30+
EVENT_LOOP_MANAGER=gevent pytest {project}/tests/unit/io/test_geventreactor.py
31+
CIBW_TEST_COMMAND_MACOS: "pytest {project}/tests/unit -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation)' "
32+
CIBW_TEST_COMMAND_WINDOWS: "pytest {project}/tests/unit -k \"not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\" "
33+
CIBW_BEFORE_TEST: "pip install -r {project}/test-requirements.txt"
34+
CIBW_BEFORE_BUILD_LINUX: "rm -rf ~/.pyxbld && rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && yum install -y libffi-devel libev libev-devel openssl openssl-devel"
35+
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST=yes CFLAGS='-g0 -O3'"
36+
CIBW_SKIP: ${{ inputs.cibw-skip }}
37+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
38+
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
39+
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
40+
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux_2_28
41+
42+
jobs:
43+
prepare-matrix:
44+
name: "Prepare matrix to run on"
45+
runs-on: ubuntu-24.04
46+
outputs:
47+
matrix: ${{ steps.prepare.outputs.matrix }}
48+
steps:
49+
- name: Prepare matrix json from input matrix list
50+
id: prepare
51+
run: |
52+
echo "[" > /tmp/matrix.json
53+
was_added=""
54+
for os in $(echo "{{ inputs.target }}" | tr -d " " | tr "," "\n")
55+
do
56+
if [[ "${os}" == "linux" ]]; then
57+
echo '{"os":"ubuntu-20.04","platform":"x86_64"},{"os":"ubuntu-20.04","platform":"PyPy"}' >> /tmp/matrix.json
58+
elif [[ "${os}" == "windows" ]]; then
59+
[ -nz "$was_added" ] && echo "," >> /tmp/matrix.json
60+
echo '{"os":"windows-latest","platform":"win64"},{"os":"windows-latest","platform":"PyPy"}' >> /tmp/matrix.json
61+
elif [[ "${os}" == "macos" ]]; then
62+
[ -nz "$was_added" ] && echo "," >> /tmp/matrix.json
63+
echo '{"os":"macos-latest","platform":"all"},{"os":"macos-13","platform":"all"},{"os":"macos-latest","platform":"PyPy"}' >> /tmp/matrix.json
64+
fi
65+
done
66+
echo "]" > /tmp/matrix.json
67+
echo "matrix='$(cat /tmp/matrix.json)'" >> $GITHUB_ENV
68+
69+
build-wheels:
70+
needs: prepare-matrix
71+
name: Build wheels on python ${{ inputs.python-version }} for ${{ matrix.os }} (${{ matrix.platform }})
72+
runs-on: ${{ matrix.os }}
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
include: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
77+
steps:
78+
- uses: actions/checkout@v4
79+
80+
- uses: actions/setup-python@v5
81+
name: Install Python
82+
with:
83+
python-version: ${{ inputs.python-version }}
84+
85+
- name: Enable pip installing globally
86+
if: runner.os == 'MacOs' || runner.os == 'Windows'
87+
run: |
88+
echo "PIP_BREAK_SYSTEM_PACKAGES=1" >> $GITHUB_ENV
89+
90+
- name: Install cibuildwheel
91+
run: |
92+
python3 -m pip install cibuildwheel==2.22.0
93+
94+
- name: Install OpenSSL for Windows
95+
if: runner.os == 'Windows'
96+
run: |
97+
choco install openssl --version=3.3.2 -f -y
98+
99+
- name: Install Conan
100+
if: runner.os == 'Windows'
101+
uses: turtlebrowser/get-conan@main
102+
103+
- name: configure libev for Windows
104+
if: runner.os == 'Windows'
105+
run: |
106+
conan profile detect
107+
conan install conanfile.py
108+
109+
- name: Install OpenSSL for MacOS
110+
if: runner.os == 'MacOs'
111+
run: |
112+
brew install libev
113+
114+
- name: Overwrite for Linux 64
115+
if: runner.os == 'Linux' && matrix.platform == 'x86_64'
116+
run: |
117+
echo "CIBW_BUILD=cp3*_x86_64" >> $GITHUB_ENV
118+
119+
- name: Overwrite for Linux PyPy
120+
if: runner.os == 'Linux' && matrix.platform == 'PyPy'
121+
run: |
122+
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
123+
echo "CIBW_TEST_COMMAND_LINUX=" >> $GITHUB_ENV
124+
125+
- name: Overwrite for Windows 64
126+
if: runner.os == 'Windows' && matrix.platform == 'win64'
127+
run: |
128+
echo "CIBW_BUILD=cp*win_amd64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
129+
130+
- name: Overwrite for Windows PyPY
131+
if: runner.os == 'Windows' && matrix.platform == 'PyPy'
132+
run: |
133+
echo "CIBW_BUILD=pp*" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
134+
echo "CIBW_TEST_COMMAND_WINDOWS=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
135+
136+
- name: Overwrite for MacOs
137+
if: runner.os == 'MacOs' && matrix.platform == 'all'
138+
run: |
139+
echo "CIBW_BUILD=cp39* cp310* cp311* cp312* cp313*" >> $GITHUB_ENV
140+
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
141+
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV
142+
143+
- name: Overwrite for MacOs PyPy
144+
if: runner.os == 'MacOs' && matrix.platform == 'PyPy'
145+
run: |
146+
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
147+
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
148+
echo "CIBW_TEST_COMMAND_MACOS=" >> $GITHUB_ENV
149+
150+
- name: Build wheels
151+
run: |
152+
python3 -m cibuildwheel --output-dir wheelhouse

0 commit comments

Comments
 (0)