Skip to content

Commit

Permalink
Try to fix the macOS CI builds by always building universal-2 binaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
scoder committed Mar 29, 2023
1 parent dfdd910 commit 5dbc44b
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tools/ci-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -x
GCC_VERSION=${GCC_VERSION:=9}
TEST_CFLAGS=
EXTRA_CFLAGS=
EXTRA_LDFLAGS=
SAVED_GITHUB_API_TOKEN="${GITHUB_API_TOKEN}"
unset GITHUB_API_TOKEN # remove from env

Expand All @@ -22,12 +23,13 @@ if [ -z "${OS_NAME##ubuntu*}" ]; then
export CC="gcc"
export PATH="/usr/lib/ccache:$PATH"
TEST_CFLAGS="-Og -g -fPIC"
EXTRA_CFLAGS="$TEST_CFLAGS -Wall -Wextra"
EXTRA_CFLAGS="-Wall -Wextra"

elif [ -z "${OS_NAME##macos*}" ]; then
export CC="clang -Wno-deprecated-declarations"
TEST_CFLAGS="-Og -g -fPIC"
EXTRA_CFLAGS="$TEST_CFLAGS -Wall -Wextra"
TEST_CFLAGS="-Og -g -fPIC -arch arm64 -arch x86_64"
EXTRA_LDFLAGS="-arch arm64 -arch x86_64"
EXTRA_CFLAGS="-Wall -Wextra -arch arm64 -arch x86_64"
fi

# Log versions in use
Expand Down Expand Up @@ -60,12 +62,13 @@ else
fi
if [[ "$COVERAGE" == "true" ]]; then
python -m pip install "coverage<5" || exit 1
python -m pip install --pre 'Cython>=3.0a0' || exit 1
python -m pip install --pre 'Cython>=3.0b2' || exit 1
fi

# Build
GITHUB_API_TOKEN="${SAVED_GITHUB_API_TOKEN}" \
CFLAGS="$CFLAGS $EXTRA_CFLAGS" \
CFLAGS="$CFLAGS $TEST_CFLAGS $EXTRA_CFLAGS" \
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" \
python -u setup.py build_ext --inplace \
$(if [ -n "${PYTHON_VERSION##2.*}" ]; then echo -n " -j7 "; fi ) \
$(if [[ "$COVERAGE" == "true" ]]; then echo -n " --with-coverage"; fi ) \
Expand All @@ -75,12 +78,14 @@ ccache -s || true

# Run tests
GITHUB_API_TOKEN="${SAVED_GITHUB_API_TOKEN}" \
CFLAGS="$TEST_CFLAGS" PYTHONUNBUFFERED=x \
CFLAGS="$TEST_CFLAGS $EXTRA_CFLAGS" \
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" \
PYTHONUNBUFFERED=x \
make test || exit 1

GITHUB_API_TOKEN="${SAVED_GITHUB_API_TOKEN}" \
CFLAGS="-O3 -g1 -mtune=generic -fPIC -flto" \
LDFLAGS="-flto" \
CFLAGS="$EXTRA_CFLAGS -O3 -g1 -mtune=generic -fPIC -flto" \
LDFLAGS="-flto $EXTRA_LDFLAGS" \
make clean wheel || exit 1

ccache -s || true

0 comments on commit 5dbc44b

Please sign in to comment.