Skip to content

Commit 78f8e85

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 78f8e85

File tree

2 files changed

+154
-1
lines changed

2 files changed

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

.github/workflows/build-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and upload to PyPi
33
on:
44
push:
55
branches:
6-
- master
6+
- master1
77
- 'branch-**'
88
pull_request:
99
paths-ignore:

0 commit comments

Comments
 (0)