Skip to content

Commit

Permalink
build: remove builds via github actions (#238)
Browse files Browse the repository at this point in the history
* build: update github action permissions

* Remove building presubmits via github actions

* Update update sync-repo-settings to reflect change
  • Loading branch information
parthea authored Aug 27, 2024
1 parent 3ed3ff1 commit e88ad89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 180 deletions.
7 changes: 4 additions & 3 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ branchProtectionRules:
requiresStrictStatusChecks: true
# List of required status check contexts that must pass for commits to be accepted to matching branches.
requiredStatusCheckContexts:
- 'ubuntu-20.04'
- 'macos-13'
- 'windows-2022 ( x64 )'
- 'Kokoro - Linux'
- 'Kokoro - OS X'
- 'Kokoro - OS X Apple Silicon'
- 'Kokoro - Windows'
- 'cla/google'
# List of explicit permissions to add (additive only)
permissionRules:
Expand Down
180 changes: 3 additions & 177 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ on:
branches:
- main

jobs:
permissions:
contents: read

jobs:
mypy:
runs-on: ubuntu-22.04
steps:
Expand All @@ -25,179 +27,3 @@ jobs:
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@v4
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/

build-wheels-macos:
name: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-13
# Wheels port forward
#- macos-11
runs-on: ${{ matrix.os }}
steps:

- uses: actions/checkout@v4
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/

build-wheels-windows:
name: ${{ matrix.os }} ( ${{ matrix.platform }} )

strategy:
matrix:
os:
- windows-2022
platform:
# For presubmit, just build / test the most common platform
- x64

runs-on: ${{ matrix.os }}

steps:

- uses: actions/checkout@v4
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 17 2022" -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

0 comments on commit e88ad89

Please sign in to comment.