Skip to content
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
36 changes: 36 additions & 0 deletions .kokoro/release/crc32c/linux/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Store built wheels for audit/SBOM/dry-run inspection
action {
define_artifacts {
regex: "github/google-cloud-python/packages/google-crc32c/wheels/*.whl"
strip_prefix: "github/google-cloud-python/packages/google-crc32c"
}
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "yoshi-automation-github-key"
}
}
}

# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google-cloud-pypi-token-keystore-3"
}
}
}
8 changes: 8 additions & 0 deletions .kokoro/release/crc32c/linux/linux_wheel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "PACKAGE"
value: "crc32c"
}

build_file: "google-cloud-python/.kokoro/release/crc32c/release-manylinux-wheel.sh"
36 changes: 36 additions & 0 deletions .kokoro/release/crc32c/osx/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Store built wheels for audit/SBOM/dry-run inspection
action {
define_artifacts {
regex: "github/google-cloud-python/packages/google-crc32c/wheels/*.whl"
strip_prefix: "github/google-cloud-python/packages/google-crc32c"
}
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "yoshi-automation-github-key"
}
}
}

# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google-cloud-pypi-token-keystore-3"
}
}
}
8 changes: 8 additions & 0 deletions .kokoro/release/crc32c/osx/osx-slcn_wheel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "PACKAGE"
value: "crc32c"
}

build_file: "google-cloud-python/.kokoro/release/crc32c/release-osx-wheel.sh"
8 changes: 8 additions & 0 deletions .kokoro/release/crc32c/osx/osx_wheel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "PACKAGE"
value: "crc32c"
}

build_file: "google-cloud-python/.kokoro/release/crc32c/release-osx-wheel.sh"
23 changes: 23 additions & 0 deletions .kokoro/release/crc32c/release-manylinux-wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

cd github/google-cloud-python/packages/google-crc32c

export PUBLISH_WHEELS="${PUBLISH_WHEELS:-true}"

# Build and publish ManyLinux wheels
./scripts/manylinux/build.sh
24 changes: 24 additions & 0 deletions .kokoro/release/crc32c/release-osx-wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

export REPO_ROOT=$(pwd)/github/google-cloud-python/packages/google-crc32c
cd "${REPO_ROOT}"

export PUBLISH_WHEELS="${PUBLISH_WHEELS:-true}"

# Build and publish OSX wheels
./scripts/osx/build.sh
54 changes: 54 additions & 0 deletions .kokoro/release/crc32c/release-windows-wheel.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@rem Copyright 2019 Google LLC. All rights reserved.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.

@echo "Starting Windows release"

cd /d %~dp0..\..\..\packages\google-crc32c || goto :error

if "%PUBLISH_WHEELS%"=="" set PUBLISH_WHEELS=true

@echo "Build and Test Wheels"
call scripts\windows\build.bat || goto :error

@echo "Ensure that we have the latest versions of Twine, Wheel, Setuptools, and pkginfo."
call py -3 -m pip install --upgrade twine wheel setuptools pkginfo || goto :error

@echo "Build the source distribution (sdist) and validate with twine check"
call py -3 setup.py sdist || goto :error
call py -3 -m twine check dist/* wheels/google_crc32c* || goto :error

if "%PUBLISH_WHEELS%"=="true" (
@echo "Start the releasetool reporter"
call py -3 -m pip install gcp-releasetool || goto :error
if not exist C:\temp mkdir C:\temp
call py -3 -m releasetool publish-reporter-script > C:\temp\publisher-script || goto :error

@echo "Disable buffering, so that the logs stream through."
set PYTHONUNBUFFERED=1

@echo "## RELEASE WORKFLOW SUCCESSFUL ##"
@echo "## Uploading Wheels and sdist ##"

set /p TWINE_PASSWORD=<%KOKORO_KEYSTORE_DIR%/73713_google-cloud-pypi-token-keystore-3
call py -3 -m twine upload --skip-existing --username __token__ --password "%TWINE_PASSWORD%" dist/* wheels/google_crc32c* || goto :error
dir wheels
dir dist
) else (
@echo "PUBLISH_WHEELS is '%PUBLISH_WHEELS%'. Skipping PyPI upload after sdist and wheel validation."
)

goto :EOF

:error
exit /b 1
42 changes: 42 additions & 0 deletions .kokoro/release/crc32c/windows/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Store built wheels and sdist for audit/SBOM/dry-run inspection
action {
define_artifacts {
regex: "github/google-cloud-python/packages/google-crc32c/wheels/*.whl"
strip_prefix: "github/google-cloud-python/packages/google-crc32c"
}
}
action {
define_artifacts {
regex: "github/google-cloud-python/packages/google-crc32c/dist/*.tar.gz"
strip_prefix: "github/google-cloud-python/packages/google-crc32c"
}
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "yoshi-automation-github-key"
}
}
}

# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google-cloud-pypi-token-keystore-3"
}
}
}
8 changes: 8 additions & 0 deletions .kokoro/release/crc32c/windows/windows_wheel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "PACKAGE"
value: "crc32c"
}

build_file: "google-cloud-python/.kokoro/release/crc32c/release-windows-wheel.bat"
1 change: 1 addition & 0 deletions librarian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,7 @@ libraries:
default_version: v1
- name: google-crc32c
version: 1.8.0
skip_release: true
python:
library_type: OTHER
- name: google-developer-knowledge
Expand Down
6 changes: 3 additions & 3 deletions packages/google-crc32c/scripts/manylinux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ docker run \
--interactive \
--volume ${REPO_ROOT}:/var/code/python-crc32c/ \
--env BUILD_PYTHON=${BUILD_PYTHON} \
--env CRC32C_PURE_PYTHON=0 \
quay.io/pypa/manylinux2014_x86_64 \
/var/code/python-crc32c/scripts/manylinux/build_on_centos.sh

Expand All @@ -49,9 +50,8 @@ docker run \
--interactive \
--volume ${REPO_ROOT}:/var/code/python-crc32c/ \
--env BUILD_PYTHON=${BUILD_PYTHON} \
--env CRC32C_PURE_PYTHON=0 \
quay.io/pypa/manylinux2014_aarch64 \
/var/code/python-crc32c/scripts/manylinux/build_on_centos.sh

if [[ "${PUBLISH_WHEELS}" == "true" ]]; then
. /${MANYLINUX_DIR}/publish_python_wheel.sh
fi
. /${MANYLINUX_DIR}/publish_python_wheel.sh
64 changes: 28 additions & 36 deletions packages/google-crc32c/scripts/manylinux/build_on_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# limitations under the License.

set -e -x
MAIN_PYTHON_BIN="/opt/python/cp39-cp39/bin/"
export CRC32C_PURE_PYTHON=0
MAIN_PYTHON_BIN="/opt/python/cp312-cp312/bin"
echo "BUILD_PYTHON: ${BUILD_PYTHON}"
REPO_ROOT=/var/code/python-crc32c/

Expand Down Expand Up @@ -45,36 +46,26 @@ make all install

PYTHON_VERSIONS=""
if [[ -z ${BUILD_PYTHON} ]]; then
# Collect all target Python versions.
for PYTHON_BIN in /opt/python/*/bin; do
# H/T: https://stackoverflow.com/a/229606/1068170
if [[ "${PYTHON_BIN}" == *"310"* ]]; then
for VER in $(awk -F': ' '/^versions:/ {print $2}' "${REPO_ROOT}/scripts/python_versions.yaml"); do
SHORT=$(echo "$VER" | cut -d. -f1,2)
ABI="cp${SHORT//.}-cp${SHORT//.}"
Comment thread
daniel-sanche marked this conversation as resolved.
PYTHON_BIN="/opt/python/${ABI}/bin"
if [[ -d "${PYTHON_BIN}" ]]; then
PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}"
continue
elif [[ "${PYTHON_BIN}" == *"311"* ]]; then
PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}"
continue
elif [[ "${PYTHON_BIN}" == *"312"* ]]; then
PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}"
continue
elif [[ "${PYTHON_BIN}" == *"313"* && "${PYTHON_BIN}" != *"313t"* ]]; then
PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}"
continue
elif [[ "${PYTHON_BIN}" == *"314"* && "${PYTHON_BIN}" != *"314t"* ]]; then
PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}"
continue
else
echo "Ignoring unsupported version: ${PYTHON_BIN}"
echo "====================================="
echo "ERROR: Required Python version ${VER} (${PYTHON_BIN}) not found in container."
exit 1
fi
done
else
STRIPPED_PYTHON=$(echo ${BUILD_PYTHON} | sed -e "s/\.//g" | sed -e "s/-dev$//")
for PYTHON_BIN in /opt/python/*/bin; do
if [[ "${PYTHON_BIN}" == *"${STRIPPED_PYTHON}"* ]]; then
PYTHON_VERSIONS="${PYTHON_VERSIONS} ${PYTHON_BIN}"
fi
done
PYTHON_BIN="/opt/python/cp${STRIPPED_PYTHON}-cp${STRIPPED_PYTHON}/bin"
if [[ -d "${PYTHON_BIN}" ]]; then
PYTHON_VERSIONS="${PYTHON_BIN}"
else
echo "ERROR: Requested BUILD_PYTHON ${BUILD_PYTHON} (${PYTHON_BIN}) not found in container."
exit 1
fi
fi

# Build the wheels.
Expand All @@ -93,20 +84,21 @@ done

# Install and test wheels
for PYTHON_BIN in ${PYTHON_VERSIONS}; do
# Identify the short python version e.g. "39", "310"
# Get the ABI tag from the Python binary's path, e.g., "cp310-cp310"
ABI_TAG=$(basename $(dirname ${PYTHON_BIN}))
ARCH=$(uname -m)
# Create a virtual environment to install and test the wheel
${PYTHON_BIN}/python -m venv /tmp/venv
# Find the correct wheel file using the precise ABI tag and architecture.
WHEEL_FILE=$(ls ${REPO_ROOT}/wheels/google_crc32c-*-${ABI_TAG}-*manylinux*${ARCH}*.whl) # Install the wheel
/tmp/venv/bin/pip install "${WHEEL_FILE}"
# Get the ABI tag from the Python binary's path, e.g., "cp310-cp310"
ABI_TAG=$(basename $(dirname ${PYTHON_BIN}))
ARCH=$(uname -m)
# Create a virtual environment to install and test the wheel
${PYTHON_BIN}/python -m venv /tmp/venv

# Find the correct wheel file using the precise ABI tag and architecture.
WHEEL_FILE=$(ls ${REPO_ROOT}/wheels/google_crc32c-*-${ABI_TAG}-*manylinux*${ARCH}*.whl)
# Install the wheel and pytest
/tmp/venv/bin/pip install "${WHEEL_FILE}" pytest

# Verify that the module is installed and peek at contents.
/tmp/venv/bin/python ${REPO_ROOT}/scripts/check_crc32c_extension.py

/tmp/venv/bin/pytest ${REPO_ROOT}/tests --junitxml="${REPO_ROOT}/${ABI_TAG}_${ARCH}_sponge_log.xml"

# Clean up the virtual environment
rm -rf /tmp/venv
done
Expand Down
Loading
Loading