From 3c92d79e9631a2f1283599160d7a392b4f34af06 Mon Sep 17 00:00:00 2001 From: John Bartholomew Date: Sat, 22 Feb 2025 18:20:03 +0000 Subject: [PATCH] ci: python cibuildwheel updates for go-jsonnet - Checkout with submodules, otherwise the sdist won't include libjsonnet.h - Install golang in the cibuildwheel build container. - Skip musllinux build; it's not working for me. - Skip Windows platform builds; they're not working for me. It would be nice to get the other platforms working but I have already spent hours on this and haven't succeeded yet. Previous go-jsonnet releases on PyPI didn't have prebuilt wheel packages anyway, so it's still strictly better to have some rather than none even if not all platforms are covered. --- .github/workflows/install-go.sh | 24 ++++++++++++++++++++++++ .github/workflows/publish-python.yml | 17 +++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100755 .github/workflows/install-go.sh diff --git a/.github/workflows/install-go.sh b/.github/workflows/install-go.sh new file mode 100755 index 0000000..3413d14 --- /dev/null +++ b/.github/workflows/install-go.sh @@ -0,0 +1,24 @@ +#!/usr/bin/bash + +# Helper script to install Go dev tools. +# This is run _inside_ the manylinux container(s) +# used in cibuildwheel to build the wheels. + +set -euo pipefail + +TDIR="$(mktemp -d)" +>&2 echo "Working dir: ${TDIR}" +trap "rm -rf ${TDIR}" EXIT + +>&2 echo "Downloading Go 1.23.6 distribution file." +curl -fL -o "${TDIR}/go1.23.6.linux-amd64.tar.gz" 'https://go.dev/dl/go1.23.6.linux-amd64.tar.gz' + +>&2 echo "Checking distribution file integrity" +GO_DIST_SHA256='9379441ea310de000f33a4dc767bd966e72ab2826270e038e78b2c53c2e7802d' +printf '%s %s/go1.23.6.linux-amd64.tar.gz\n' "${GO_DIST_SHA256}" "${TDIR}" | sha256sum -c + +>&2 echo "Unpacking to /usr/local/go" +rm -rf /usr/local/go && tar -C /usr/local -xzf "${TDIR}/go1.23.6.linux-amd64.tar.gz" + +>&2 echo "Installed Go version:" +/usr/local/go/bin/go version diff --git a/.github/workflows/publish-python.yml b/.github/workflows/publish-python.yml index bba8cab..1bf45f1 100644 --- a/.github/workflows/publish-python.yml +++ b/.github/workflows/publish-python.yml @@ -29,6 +29,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + submodules: true - uses: actions/setup-python@v5 with: @@ -50,22 +52,29 @@ jobs: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - #os: [ubuntu-22.04, windows-latest, macos-latest] - os: [ubuntu-22.04, windows-latest] + os: [ubuntu-22.04] permissions: contents: read steps: - uses: actions/checkout@v4 + with: + submodules: true - name: Build wheels uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0 env: - # Skip PyPy, 32-bit Windows, 32-bit Linux, and CPython before 3.9. + # Skip PyPy, 32-bit Windows, 32-bit Linux, musllinux and CPython before 3.9. # See https://cibuildwheel.readthedocs.io/en/stable/options/#examples_1 - CIBW_SKIP: "*-win32 pp* *-manylinux_i686 *-musllinux_i686 cp36-* cp37-* cp38-*" + CIBW_SKIP: "*-win32 pp* *-manylinux_i686 *-musllinux* cp36-* cp37-* cp38-*" + CIBW_BEFORE_ALL_LINUX: > + bash {package}/.github/workflows/install-go.sh && + export PATH="$PATH":/usr/local/go/bin && + command -v go > /dev/null + CIBW_ENVIRONMENT: PATH=$PATH:/usr/local/go/bin CIBW_TEST_COMMAND: > python {package}/python/_jsonnet_test.py