build(deps): bump pip from 23.2.1 to 23.3 in /scripts #297
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Presubmit: build and test wheels" | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
mypy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install nox | |
run: | | |
python -m ensurepip | |
python -m pip install nox | |
- name: Run mypy | |
env: | |
# workaround for https://github.com/pypa/setuptools/issues/3557 | |
SETUPTOOLS_ENABLE_FEATURES: legacy-editable | |
run: | | |
nox -s mypy | |
build-wheels-linux: | |
name: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Build Wheels | |
uses: pypa/[email protected] | |
env: | |
# For presubmit, just build / test the most common arch | |
CIBW_ARCHS: native | |
# For presubmit, skip build / test for pypy | |
CIBW_SKIP: pp37* | |
CIBW_ENVIRONMENT: > | |
CRC32C_PURE_PYTHON="0" | |
CRC32C_INSTALL_PREFIX="$(pwd)/usr" | |
CIBW_BUILD_VERBOSITY: 1 | |
# Build the C library inside CIBW so that the manylinux image is | |
# used to link the share library; otherwise, our extension wouldn't | |
# be able to link with it. | |
CIBW_BEFORE_BUILD: > | |
python -m pip install --upgrade setuptools pip wheel && | |
python -m pip install cmake && | |
cmake -S google_crc32c -B build \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCRC32C_BUILD_TESTS=no \ | |
-DCRC32C_BUILD_BENCHMARKS=no \ | |
-DBUILD_SHARED_LIBS=yes \ | |
-DCMAKE_INSTALL_PREFIX:PATH=$(pwd)/usr && | |
make -C build all install | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: py.test -v {project}/tests/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: wheelhouse/ | |
build-wheels-macos: | |
name: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- macos-13 | |
# Wheels port forward | |
#- macos-11 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Get C library hash | |
id: get-c-lib-hash | |
run: | |
echo "::set-output name=hash::$(git -C google_crc32c log -n 1 --pretty=%H)" | |
- id: load-cache | |
name: Load cached C library | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/usr | |
key: | |
libcrc32c-${{ matrix.os }}-${{ steps.get-c-lib-hash.outputs.hash }} | |
- name: Build C Library | |
if: steps.load-cache.outputs.cache-hit != 'true' | |
run: > | |
python -m pip install --upgrade setuptools pip wheel && | |
python -m pip install cmake && | |
cmake -S google_crc32c -B build \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \ | |
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ | |
-DCRC32C_BUILD_TESTS=no \ | |
-DCRC32C_BUILD_BENCHMARKS=no \ | |
-DBUILD_SHARED_LIBS=yes \ | |
-DCMAKE_INSTALL_PREFIX:PATH=${{ github.workspace }}/usr \ | |
-DCMAKE_INSTALL_NAME_DIR:PATH=${{ github.workspace }}/usr/lib && | |
make -C build all install | |
- name: Build Wheels | |
uses: pypa/[email protected] | |
env: | |
# For presubmit, just build / test the most common arch | |
CIBW_ARCHS: native | |
# For presubmit, skip build / test for pypy | |
CIBW_SKIP: pp37* | |
CIBW_ENVIRONMENT: > | |
CRC32C_PURE_PYTHON="0" | |
CRC32C_INSTALL_PREFIX="$(pwd)/usr" | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: py.test -v {project}/tests/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: wheelhouse/ | |
build-wheels-windows: | |
name: ${{ matrix.os }} ( ${{ matrix.platform }} ) | |
strategy: | |
matrix: | |
os: | |
- windows-2019 | |
platform: | |
# For presubmit, just build / test the most common platform | |
- x64 | |
#- Win32 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Get C library hash | |
id: get-c-lib-hash | |
run: | |
echo "::set-output name=hash::$(git -C google_crc32c log -n 1 --pretty=%H)" | |
- id: load-cache | |
name: Load cached C library | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}\usr | |
key: | |
libcrc32c-${{ matrix.os }}-${{ matrix.platform }}-${{ steps.get-c-lib-hash.outputs.hash }} | |
- name: Build C Library | |
if: steps.load-cache.outputs.cache-hit != 'true' | |
run: | | |
echo "::group::Install cmake" | |
python -m pip install --upgrade setuptools pip wheel | |
python -m pip install cmake | |
echo "::endgroup::" | |
echo "::group::Run cmake to initialze build tree" | |
cmake -S google_crc32c -B build -G "Visual Studio 16 2019" -A ${{ matrix.platform }} -DCRC32C_BUILD_BENCHMARKS=no -DCRC32C_BUILD_TESTS=no -DBUILD_SHARED_LIBS=no -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=yes -DCRC32C_USE_GLOG=0 | |
echo "::endgroup::" | |
echo "::group::Run cmake to build library" | |
cmake --build build --verbose --config Release | |
echo "::endgroup::" | |
echo "::group::Run cmake to install library" | |
cmake --install build --verbose --config Release --prefix=${{ github.workspace }}\usr\ | |
echo "::endgroup::" | |
# Passing through ${{ github.workspace }} to CIBW_ENVIRONMENT mangles | |
# backslashes: compute a variant which uses only forward-slashses. | |
- id: crc32c-install-prefix | |
name: Dead-reckon a CIBW-compatible install prefix | |
shell: bash | |
run: | | |
python -c "import os; workspace = '/'.join(os.getenv('GITHUB_WORKSPACE').split(os.sep)); pfx = f'{workspace}/usr'; print(f'::set-output name=prefix::{pfx}')" | |
- id: platform-arch | |
name: Map platform -> wheel arch | |
shell: bash | |
run: | | |
if [[ "${{ matrix.platform }}" == "Win32" ]]; then | |
echo "::set-output name=arch::x86" | |
else | |
echo "::set-output name=arch::AMD64" | |
fi | |
- name: Build Wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS_WINDOWS: ${{ steps.platform-arch.outputs.arch }} | |
# For presubmit, skip build / test for pypy | |
CIBW_SKIP: pp37* | |
CIBW_ENVIRONMENT: CRC32C_PURE_PYTHON="0" CRC32C_INSTALL_PREFIX="${{ steps.crc32c-install-prefix.outputs.prefix }}" | |
CIBW_BUILD_VERBOSITY: 3 | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: py.test -v {project}/tests | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: wheelhouse/ |