Skip to content

Commit 41e86cb

Browse files
authored
Small fixes for CICD (#414)
* cicd: trigger workflows only when it is needed * cicd: make build-push workflow to be reusable * cicd: make pre-release workflow manually triggerable 1. Make it reuse `lib-build-and-push` 2. Make it manually triggerable only This workflow is checking 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 a77ea62 commit 41e86cb

File tree

5 files changed

+337
-265
lines changed

5 files changed

+337
-265
lines changed
+26-47
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,28 @@
1-
name: Build pre release python versions
2-
3-
on: [push, pull_request]
4-
5-
env:
6-
CIBW_TEST_COMMAND_LINUX: "pytest {project}/tests/unit"
7-
CIBW_BEFORE_TEST: "pip install -r {project}/test-requirements.txt"
8-
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"
9-
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CFLAGS='-g0 -O3'"
10-
CIBW_PRERELEASE_PYTHONS: True
11-
CIBW_SKIP: cp35* cp36* *musllinux*
12-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
1+
name: Test building on pre-release python version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
python-version:
7+
description: 'Python version to run against'
8+
required: true
9+
type: string
10+
11+
target:
12+
type: string
13+
description: "target os to build for: linux,macos,windows"
14+
default: "linux,macos,windows"
15+
16+
cibw-skip:
17+
type: string
18+
description: 'CIBUILDWHEEL builds pattern to skip, goes to CIBW_SKIP env'
19+
required: false
20+
default: 'cp36* cp37* pp*i686 *musllinux*'
1321

1422
jobs:
15-
build_wheels:
16-
name: Build wheels ${{ matrix.os }} (${{ matrix.platform }})
17-
if: "(!contains(github.event.pull_request.labels.*.name, 'disable-test-build')) || github.event_name == 'push' && endsWith(github.event.ref, 'scylla')"
18-
runs-on: ${{ matrix.os }}
19-
strategy:
20-
fail-fast: false
21-
matrix:
22-
include:
23-
- os: ubuntu-20.04
24-
platform: x86_64
25-
steps:
26-
- uses: actions/checkout@v4
27-
28-
- uses: actions/setup-python@v5
29-
name: Install Python
30-
with:
31-
python-version: '3.13'
32-
33-
- name: Install cibuildwheel
34-
run: |
35-
python3 -m pip install cibuildwheel==2.22.0
36-
37-
- name: Overwrite for Linux 64
38-
if: runner.os == 'Linux' && matrix.platform == 'x86_64'
39-
run: |
40-
echo "CIBW_BUILD=cp313*_x86_64" >> $GITHUB_ENV
41-
42-
- name: Build wheels
43-
run: |
44-
python3 -m cibuildwheel --output-dir wheelhouse
45-
46-
- uses: actions/upload-artifact@v4
47-
with:
48-
name: wheels-${{ matrix.os }}-${{ matrix.platform }}
49-
path: ./wheelhouse/*.whl
23+
build-and-publish:
24+
uses: ./.github/workflows/lib-build-and-push.yml
25+
with:
26+
python-version: ${{ inputs.python-version }}
27+
target: ${{ inputs.target }}
28+
cibw-skip: ${{ inputs.cibw-skip }}

.github/workflows/build-push.yml

+24-215
Original file line numberDiff line numberDiff line change
@@ -1,220 +1,29 @@
11
name: Build and upload to PyPi
22

3-
on: [push, pull_request]
4-
5-
6-
env:
7-
CIBW_TEST_COMMAND_LINUX: >
8-
pytest {project}/tests/unit &&
9-
EVENT_LOOP_MANAGER=gevent pytest {project}/tests/unit/io/test_geventreactor.py
10-
11-
CIBW_TEST_COMMAND_MACOS: "pytest {project}/tests/unit -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation)' "
12-
CIBW_TEST_COMMAND_WINDOWS: "pytest {project}/tests/unit -k \"not (test_deserialize_date_range_year or test_datetype or test_libevreactor)\" "
13-
CIBW_BEFORE_TEST: "pip install -r {project}/test-requirements.txt"
14-
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"
15-
CIBW_ENVIRONMENT: "CASS_DRIVER_BUILD_CONCURRENCY=2 CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST=yes CFLAGS='-g0 -O3'"
16-
CIBW_SKIP: cp36* cp37* pp*i686 *musllinux*
17-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
18-
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
19-
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
20-
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux_2_28
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'branch-**'
8+
pull_request:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- docs/*
13+
- examples/*
14+
- .gitignore
15+
- '*.rst'
16+
- '*.ini'
17+
- LICENSE
18+
- .github/dependabot.yml
19+
- .github/pull_request_template.md
20+
workflow_dispatch:
2121

2222
jobs:
23-
build_wheels:
24-
name: Build wheels ${{ matrix.os }} (${{ matrix.platform }})
23+
build-and-publish:
2524
if: "(!contains(github.event.pull_request.labels.*.name, 'disable-test-build')) || github.event_name == 'push' && endsWith(github.event.ref, 'scylla')"
26-
runs-on: ${{ matrix.os }}
27-
strategy:
28-
fail-fast: false
29-
matrix:
30-
include:
31-
- os: ubuntu-24.04
32-
platform: x86_64
33-
34-
- os: ubuntu-24.04
35-
platform: PyPy
36-
37-
- os: windows-2022
38-
platform: win64
39-
40-
- os: windows-latest
41-
platform: PyPy
42-
43-
- os: macos-14
44-
platform: all
45-
46-
- os: macos-13
47-
platform: all
48-
49-
- os: macos-latest
50-
platform: PyPy
51-
52-
steps:
53-
- uses: actions/checkout@v4
54-
55-
- uses: actions/setup-python@v5
56-
name: Install Python
57-
with:
58-
python-version: '3.13'
59-
- name: Enable pip installing globally
60-
if: runner.os == 'MacOs' || runner.os == 'Windows'
61-
run: |
62-
echo "PIP_BREAK_SYSTEM_PACKAGES=1" >> $GITHUB_ENV
63-
64-
- name: Install cibuildwheel
65-
run: |
66-
python3 -m pip install cibuildwheel==2.22.0
67-
68-
- name: Install OpenSSL for Windows
69-
if: runner.os == 'Windows'
70-
run: |
71-
choco install openssl --version=3.4.1 -f -y
72-
73-
- name: Install Conan
74-
if: runner.os == 'Windows'
75-
uses: turtlebrowser/get-conan@main
76-
77-
- name: configure libev for Windows
78-
if: runner.os == 'Windows'
79-
run: |
80-
conan profile detect
81-
conan install conanfile.py
82-
83-
- name: Install OpenSSL for MacOS
84-
if: runner.os == 'MacOs'
85-
run: |
86-
brew install libev
87-
88-
- name: Overwrite for Linux 64
89-
if: runner.os == 'Linux' && matrix.platform == 'x86_64'
90-
run: |
91-
echo "CIBW_BUILD=cp3*_x86_64" >> $GITHUB_ENV
92-
93-
- name: Overwrite for Linux PyPy
94-
if: runner.os == 'Linux' && matrix.platform == 'PyPy'
95-
run: |
96-
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
97-
echo "CIBW_TEST_COMMAND_LINUX=" >> $GITHUB_ENV
98-
99-
- name: Overwrite for Windows 64
100-
if: runner.os == 'Windows' && matrix.platform == 'win64'
101-
run: |
102-
echo "CIBW_BUILD=cp*win_amd64" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
103-
echo "CIBW_ENVIRONMENT_WINDOWS= CC=clang CXX=clang++" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
104-
105-
- name: Overwrite for Windows PyPY
106-
if: runner.os == 'Windows' && matrix.platform == 'PyPy'
107-
run: |
108-
echo "CIBW_BUILD=pp*" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
109-
echo "CIBW_TEST_COMMAND_WINDOWS=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
110-
111-
- name: Overwrite for MacOs
112-
if: runner.os == 'MacOs' && matrix.platform == 'all'
113-
run: |
114-
echo "CIBW_BUILD=cp39* cp310* cp311* cp312* cp313*" >> $GITHUB_ENV
115-
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
116-
if [ "${{ matrix.os }}" == "macos-13" ]; then
117-
echo "MACOSX_DEPLOYMENT_TARGET=13.0" >> $GITHUB_ENV;
118-
echo "Enforcing target deployment for 13.0"
119-
elif [ "${{ matrix.os }}" == "macos-14" ]; then
120-
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV;
121-
echo "Enforcing target deployment for 14.0"
122-
else
123-
echo "Unknown macos version" && false;
124-
fi
125-
- name: Overwrite for MacOs PyPy
126-
if: runner.os == 'MacOs' && matrix.platform == 'PyPy'
127-
run: |
128-
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV
129-
echo "CIBW_BEFORE_TEST_MACOS=pip install -r {project}/test-requirements.txt pytest" >> $GITHUB_ENV
130-
echo "CIBW_TEST_COMMAND_MACOS=" >> $GITHUB_ENV
131-
132-
- name: Build wheels
133-
run: |
134-
python3 -m cibuildwheel --output-dir wheelhouse
135-
136-
- uses: actions/upload-artifact@v4
137-
with:
138-
name: wheels-${{ matrix.os }}-${{ matrix.platform }}
139-
path: ./wheelhouse/*.whl
140-
141-
build_sdist:
142-
name: Build source distribution
143-
if: "(!contains(github.event.pull_request.labels.*.name, 'disable-test-build'))|| github.event_name == 'push' && endsWith(github.event.ref, 'scylla')"
144-
runs-on: ubuntu-24.04
145-
steps:
146-
- uses: actions/checkout@v4
147-
148-
- uses: actions/setup-python@v5
149-
name: Install Python
150-
151-
- name: Build sdist
152-
run: |
153-
pip install build
154-
python -m build --sdist
155-
156-
- uses: actions/upload-artifact@v4
157-
with:
158-
name: source-dist
159-
path: dist/*.tar.gz
160-
161-
build_wheels_extra_arch:
162-
if: "(!contains(github.event.pull_request.labels.*.name, 'disable-test-build'))|| github.event_name == 'push' && endsWith(github.event.ref, 'scylla')"
163-
# The host should always be linux
164-
runs-on: ubuntu-24.04
165-
name: Build extra arch ${{ matrix.archs }} wheels
166-
strategy:
167-
fail-fast: false
168-
matrix:
169-
archs: [ aarch64,] # ppc64le ]
170-
171-
steps:
172-
- uses: actions/checkout@v4
173-
174-
- name: Set up QEMU
175-
id: qemu
176-
uses: docker/setup-qemu-action@v3
177-
with:
178-
platforms: all
179-
image: 'docker.io/tonistiigi/binfmt:desktop-v8.1.5'
180-
if: runner.os == 'Linux'
181-
182-
- uses: actions/setup-python@v5
183-
name: Install Python
184-
with:
185-
python-version: '3.13'
186-
187-
- name: Install cibuildwheel
188-
run: |
189-
python -m pip install cibuildwheel==2.22.0
190-
191-
- name: Build wheels
192-
env:
193-
CIBW_BUILD: "cp39* cp310* cp311* cp312* cp313*" # limit to specific version since it take much more time than jobs limit
194-
run: |
195-
python -m cibuildwheel --archs ${{ matrix.archs }} --output-dir wheelhouse
196-
197-
- uses: actions/upload-artifact@v4
198-
with:
199-
name: wheels-${{ matrix.archs }}
200-
path: ./wheelhouse/*.whl
201-
202-
upload_pypi:
203-
needs: [build_wheels, build_wheels_extra_arch, build_sdist]
204-
runs-on: ubuntu-24.04
205-
permissions:
206-
id-token: write
207-
208-
# upload to PyPI on every tag starting with 'v'
209-
if: github.event_name == 'push' && endsWith(github.event.ref, 'scylla')
210-
# alternatively, to publish when a GitHub Release is created, use the following rule:
211-
# if: github.event_name == 'release' && github.event.action == 'published'
212-
steps:
213-
- uses: actions/download-artifact@v4
214-
with:
215-
path: dist
216-
merge-multiple: true
217-
218-
- uses: pypa/gh-action-pypi-publish@release/v1
219-
with:
220-
skip-existing: true
25+
uses: ./.github/workflows/lib-build-and-push.yml
26+
with:
27+
upload: ${{ github.event_name == 'push' && endsWith(github.event.ref, 'scylla') }}
28+
python-version: '3.13'
29+
target: linux,macos,windows

.github/workflows/docs-pr.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ on:
66
pull_request:
77
branches:
88
- master
9+
- 'branch-**'
910
paths:
1011
- "docs/**"
12+
workflow_dispatch:
1113

1214
jobs:
1315
build:

.github/workflows/integration-tests.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
name: Integration tests
22

33
on:
4-
pull_request:
5-
branches:
6-
- master
74
push:
85
branches:
96
- master
7+
- 'branch-**'
8+
pull_request:
9+
paths-ignore:
10+
- docs/*
11+
- examples/*
12+
- scripts/*
13+
- .gitignore
14+
- '*.rst'
15+
- '*.ini'
16+
- LICENSE
17+
- .github/dependabot.yml
18+
- .github/pull_request_template.md
19+
workflow_dispatch:
1020

1121
jobs:
1222
tests:

0 commit comments

Comments
 (0)