Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLIENT-2279] CI/CD: Add option to build debug wheels #508

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/actions/update-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Update version'
description: 'Update version in repo without committing. Repo must already be checked out'
inputs:
new_version:
description: Version string to set
required: true

runs:
using: "composite"
steps:
- name: Update __version__ in aerospike module
run: sed -i "s/const char version\[] = \".*\";/const char version\[] = \"${{ inputs.new_version }}\";/" src/main/aerospike.c
shell: bash

- name: Update VERSION metadata
run: echo ${{ inputs.new_version }} > VERSION
shell: bash
32 changes: 28 additions & 4 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build wheels
run-name: Build wheels (run_tests=${{ inputs.run_tests }}, use-server-rc=${{ inputs.use-server-rc }}, server-tag=${{ inputs.server-tag }}, test-macos-x86=${{ inputs.test-macos-x86 }})
run-name: Build wheels (run_tests=${{ inputs.run_tests }}, use-server-rc=${{ inputs.use-server-rc }}, server-tag=${{ inputs.server-tag }}, test-macos-x86=${{ inputs.test-macos-x86 }}, build-for-debugging=${{ inputs.build-for-debugging }})

# Builds manylinux wheels and source distribution
# If running tests, publish results in commit status
Expand Down Expand Up @@ -29,6 +29,11 @@ on:
type: boolean
default: false
description: 'Test macOS x86 wheels (unstable)'
build-for-debugging:
required: true
type: boolean
default: false
description: 'Apply -O0 when building C client and Python client? (Linux)'
workflow_call:
inputs:
# The "dev" tests test the artifacts against a server release
Expand All @@ -41,7 +46,7 @@ on:
ref:
type: string
required: false
# Calling workflow doesn't actually use the 2 options below
# Calling workflow doesn't actually use the options below
# But we need to set default values for workflow calls to use
use-server-rc:
required: false
Expand All @@ -55,6 +60,10 @@ on:
required: false
type: boolean
default: false
build-for-debugging:
required: false
type: boolean
default: false
secrets:
DOCKER_HUB_BOT_USERNAME:
required: false
Expand Down Expand Up @@ -151,9 +160,24 @@ jobs:
if: ${{ !inputs.run_tests }}
run: echo "TEST_COMMAND=python -c 'import aerospike'" >> $GITHUB_ENV

- name: Get current version if building a debug wheel
if: ${{ inputs.build-for-debugging }}
run: echo DEBUG_VERSION="$(cat VERSION)+unoptimized" >> $GITHUB_ENV

- name: Label version for debugging
if: ${{ inputs.build-for-debugging }}
uses: ./.github/actions/update-version
with:
new_version: ${{ env.DEBUG_VERSION }}

- name: Build without optimizations
if: ${{ inputs.build-for-debugging }}
run: echo "UNOPTIMIZED=1" >> $GITHUB_ENV

- name: Build wheel
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ENVIRONMENT_PASS_LINUX: ${{ inputs.build-for-debugging && 'UNOPTIMIZED' || '' }}
CIBW_BUILD: ${{ matrix.python }}-manylinux_${{ matrix.platform }}
CIBW_BUILD_FRONTEND: build
CIBW_BEFORE_ALL_LINUX: >
Expand Down Expand Up @@ -404,7 +428,7 @@ jobs:
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: ${{ matrix.python[0] }}-win_amd64
name: ${{ matrix.python[0] }}-win_amd64.build

- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v2.0.0
Expand Down Expand Up @@ -438,7 +462,7 @@ jobs:
- name: Download wheel
uses: actions/download-artifact@v3
with:
name: ${{ matrix.python[0] }}-win_amd64
name: ${{ matrix.python[0] }}-win_amd64.build
- name: Install wheel
run: python${{ matrix.python[1] }} -m pip install aerospike --force-reinstall --no-index --find-links=./
- name: Connect to Docker container on remote machine with Docker daemon
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ jobs:
token: ${{ secrets.CLIENT_BOT_PAT }}
ref: ${{ inputs.ref }}

- name: Update __version__ in aerospike module
run: sed -i "s/const char version\[] = \".*\";/const char version\[] = \"${{ inputs.new_version }}\";/" src/main/aerospike.c

- name: Update VERSION metadata
run: echo ${{ inputs.new_version }} > VERSION
- name: Update version in repo
uses: ./.github/actions/update-version
with:
new_version: ${{ inputs.new_version }}

- name: Commit new version
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
# Not for developers to use, unless you know what the workflow is doing!
COVERAGE = os.getenv('COVERAGE')

# Applies no optimizations on both the C client and Python client
UNOPTIMIZED = os.getenv('UNOPTIMIZED')

################################################################################
# GENERIC BUILD SETTINGS
################################################################################
Expand Down Expand Up @@ -107,13 +110,8 @@
extra_compile_args.append('-ftest-coverage')
extra_link_args.append('-lgcov')

# TODO: this conflicts with the C client's DEBUG mode when building it
# DEBUG = os.getenv('DEBUG')
# if DEBUG:
# extra_compile_args.append("-O0")
# else:
# # Release build
# extra_compile_args.append("-O1")
if UNOPTIMIZED:
extra_compile_args.append('-O0')

################################################################################
# STATIC SSL LINKING BUILD SETTINGS
Expand Down Expand Up @@ -228,6 +226,8 @@ def clean():
'make',
'V=' + str(self.verbose),
]
if UNOPTIMIZED:
cmd.append('O=0')

def compile():
print(cmd, library_dirs, libraries)
Expand Down
Loading