diff --git a/.github/actions/update-version/action.yml b/.github/actions/update-version/action.yml new file mode 100644 index 000000000..0a9695ef7 --- /dev/null +++ b/.github/actions/update-version/action.yml @@ -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 diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 2036b69d0..3a4323faf 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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: > diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 0f51501e9..f716ac7eb 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -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 diff --git a/setup.py b/setup.py index cc95a5eeb..6466a0d46 100644 --- a/setup.py +++ b/setup.py @@ -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 ################################################################################ @@ -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 @@ -228,6 +226,8 @@ def clean(): 'make', 'V=' + str(self.verbose), ] + if UNOPTIMIZED: + cmd.append('O=0') def compile(): print(cmd, library_dirs, libraries)