Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI macOS: Fix failure with macos-13-homebrew, add tests on M1 runners, add timeouts #37237

Merged
merged 17 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f4e2aff
.github/workflows/macos.yml: Install tox from PyPI, not homebrew
mkoeppe Feb 3, 2024
15193b3
.github/workflows/macos.yml: Add tests on M1 runners
mkoeppe Feb 4, 2024
6b7c9a6
.github/workflows/macos.yml: Increase SAGE_NUM_THREADS to 6
mkoeppe Feb 4, 2024
7b1d6c9
.github/workflows/ci-macos.yml (local-nohomebrew): Increase SAGE_NUM_…
mkoeppe Feb 4, 2024
9d924c8
.github/workflows/ci-macos.yml (local-nohomebrew): Also test on M1
mkoeppe Feb 4, 2024
c885e54
.github/workflows/ci-macos.yml (local-nohomebrew): Add self-destruct …
mkoeppe Feb 4, 2024
50d1eaf
.github/workflows/macos.yml: Add input 'timeout'
mkoeppe Feb 4, 2024
52654ea
.github/workflows/macos.yml: Use pipx to install tox
mkoeppe Feb 4, 2024
700a939
.github/workflows/macos.yml: Use tox via 'pipx run'
mkoeppe Feb 4, 2024
c8ee8e7
.github/workflows/ci-macos.yml: Set timeout for stage 1 to 4 hours
mkoeppe Feb 4, 2024
49fdc95
tox.ini (local-conda): Use 'uname -m' to determine arch for installer
mkoeppe Feb 5, 2024
5f4e0fe
.github/workflows/macos.yml: Remove failing test of macos-14-minimal
mkoeppe Feb 5, 2024
1f2d9f9
build/pkgs/dsdp/spkg-install.in: Increase verbosity
mkoeppe Feb 6, 2024
628c219
src/bin/sage-env [macOS]: Detect ld-classic when full XCode is in use
mkoeppe Feb 6, 2024
d26937b
.github/workflows/ci-macos.yml (dist): Do not use tag to bump the ver…
mkoeppe Feb 7, 2024
d47f100
src/bin/sage-env: Do not set the ld-classic flag when LD is set
mkoeppe Feb 7, 2024
2165bef
.github/workflows/macos.yml: Pass inputs.extra_sage_packages to tox
mkoeppe Feb 20, 2024
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
10 changes: 6 additions & 4 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
uses: ./.github/workflows/macos.yml
with:
stage: "1"
timeout: 14400

stage-2:
uses: ./.github/workflows/macos.yml
Expand Down Expand Up @@ -90,7 +91,7 @@ jobs:
run: |
git config --global user.email "nobody@example.com"
git config --global user.name "Sage GitHub CI"
SAGE_ROOT=. SAGE_SRC=./src src/bin/sage-update-version $(git describe --tags) || echo "(ignoring error)"
SAGE_ROOT=. SAGE_SRC=./src src/bin/sage-update-version $(cat src/VERSION.txt).dev0 || echo "(ignoring error)"
- name: make dist
run: |
./configure --enable-download-from-upstream-url && make dist
Expand All @@ -108,7 +109,7 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
os: [ macos-11, macos-12 ]
os: [ macos-11, macos-12, macos-14 ]
tox_system_factor: [macos-nobootstrap]
tox_packages_factor: [minimal]
xcode_version_factor: [default]
Expand All @@ -129,7 +130,7 @@ jobs:
if: contains(matrix.tox_system_factor, 'nobootstrap')
- name: Move homebrew away
run: |
(cd /usr/local && for a in bin etc include lib opt sbin share; do sudo mv $a $a-moved; done)
(cd $(brew --prefix) && for a in bin etc include lib opt sbin share; do sudo mv $a $a-moved; done)
- name: Select Xcode version
run: |
if [ ${{ matrix.xcode_version_factor }} != default ]; then sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version_factor }}.app; fi
Expand All @@ -140,7 +141,8 @@ jobs:
# We use a high parallelization on purpose in order to catch possible parallelization bugs in the build scripts.
# For doctesting, we use a lower parallelization to avoid timeouts.
run: |
MAKE="make -j12" tox -e $TOX_ENV -- SAGE_NUM_THREADS=4 $TARGETS
(sleep 20000; pkill make) &
MAKE="make -j12" tox -e $TOX_ENV -- SAGE_NUM_THREADS=6 $TARGETS
- name: Prepare logs artifact
run: |
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; cp -r .tox/*/log "artifacts/$LOGS_ARTIFACT_NAME"
Expand Down
33 changes: 24 additions & 9 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ on:
type: string
# System configuration
osversion_xcodeversion_toxenv_tuples:
# As of 2024-02, "runs-on: macos-latest" is macos-12.
# and "runs-on: macos-14" selects the new M1 runners.
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
description: 'Stringified JSON object'
default: >-
[["latest", "", "homebrew-macos-usrlocal-minimal"],
["latest", "", "homebrew-macos-usrlocal-standard"],
["11", "xcode_13.2.1", "homebrew-macos-usrlocal-minimal"],
[["11", "xcode_13.2.1", "homebrew-macos-usrlocal-minimal"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the overall execution time constant (to not increase the priority of the portability ci runs over the PR runs even more), please remove macos-11 (it's past its end of life anyway)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the overall execution time constant

That's not a relevant criterion. These platforms are tested because we want them tested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a relevant criterion.

For me it's a very relevant criterion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll not be negotiating with you how I run the portability CI.

For reference: #36726 (comment), #36726 (comment)

["12", "", "homebrew-macos-usrlocal-minimal"],
["12", "", "homebrew-macos-usrlocal-standard"],
["12", "", "homebrew-macos-usrlocal-python3_xcode-standard"],
["12", "", "homebrew-macos-usrlocal-maximal"],
["13", "xcode_15.0", "homebrew-macos-usrlocal-standard"],
["latest", "", "homebrew-macos-usrlocal-maximal"],
["latest", "", "homebrew-macos-usrlocal-python3_xcode-standard"],
["14", "", "homebrew-macos-opthomebrew-standard"],
["latest", "", "conda-forge-macos-minimal"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails, can we disable it until someone finds the time to fix it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's useful as a reminder what needs fixing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An issue would serve that purpose better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Source: I'm the person who monitors the portability CI.

["latest", "", "conda-forge-macos-standard"]]
["latest", "", "conda-forge-macos-standard"],
["14", "", "conda-forge-macos-standard"]]
type: string
extra_sage_packages:
description: 'Extra Sage packages to install as system packages'
Expand All @@ -41,6 +45,10 @@ on:
free_disk_space:
default: false
type: boolean
timeout:
description: 'Elapsed time (seconds) at which to kill the build'
default: 20000
type: number
#
# For use in upstream CIs.
#
Expand Down Expand Up @@ -74,10 +82,16 @@ jobs:
repository: ${{ inputs.sage_repo }}
ref: ${{ inputs.sage_ref }}
fetch-depth: 10000

- uses: actions/setup-python@v5
# As of 2024-02-03, the macOS M1 runners do not have preinstalled python or pipx.
# Installing pipx follows the approach of https://github.com/pypa/cibuildwheel/pull/1743
id: python
with:
python-version: "3.8 - 3.12"
update-environment: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you set update-environment to false? Otherwise you could just use python below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because i want to use this Python only for running tox, not for influencing the Sage build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it would have a preinstalled python, it would also influence the sage build.

- name: Install test prerequisites
run: |
brew install tox
"${{ steps.python.outputs.python-path }}" -m pip install pipx
- name: Download upstream artifact
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -129,7 +143,8 @@ jobs:
*) export TARGETS_PRE="${{ inputs.targets_pre }}" TARGETS="${{ inputs.targets }} TARGETS_OPTIONAL="${{ inputs.targets_optional }}
;;
esac
MAKE="make -j12" tox -e $TOX_ENV -- SAGE_NUM_THREADS=4 $TARGETS
(sleep ${{ inputs.timeout }}; pkill make) &
MAKE="make -j12" EXTRA_SAGE_PACKAGES="${{ inputs.extra_sage_packages }}" "${{ steps.python.outputs.python-path }}" -m pipx run tox -e $TOX_ENV -- SAGE_NUM_THREADS=6 $TARGETS
- name: Prepare logs artifact
run: |
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; cp -r .tox/*/log "artifacts/$LOGS_ARTIFACT_NAME"
Expand Down
1 change: 1 addition & 0 deletions build/pkgs/dsdp/spkg-install.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cd src
cp ../patches/CMakeLists.txt .
sdh_cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DBUILD_SHARED_LIBS=ON \
-DBLA_VENDOR=OpenBLAS \
-DBLAS_LIBRARIES="$(pkg-config --libs blas)" \
Expand Down
11 changes: 9 additions & 2 deletions src/bin/sage-env
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fi
# The compilers are set in order of priority by
# 1) environment variables
# 2) compiler installed by sage
# 3) compiler set at configuration time
# 3) compiler set at configuration time
if [ -z "$CC" ]; then
if [ -n "$SAGE_LOCAL" -a -x "$SAGE_LOCAL/bin/gcc" ]; then
CC=gcc
Expand Down Expand Up @@ -373,7 +373,14 @@ if [ -n "$SAGE_LOCAL" ]; then
# On OS X, test whether "ld-classic" is present in the installed
# version of the command-line tools. If so, we add "-ld_classic"
# to LD_FLAGS. See #36599.
if [ "$UNAME" = "Darwin" ] && [ -x "$(xcode-select -p)/usr/bin/ld-classic" ] ; then
# When the full XCode is installed and in use, for example after
# "sudo xcode-select -s /Applications/Xcode.app", then "xcode-select -p"
# gives "/Applications/Xcode.app/Contents/Developer", but "ld-classic"
# is not in the subdirectory "usr/bin/" but rather in the subdirectory
# "Toolchains/XcodeDefault.xctoolchain/usr/bin/". See #37237.
# However, if LD is set explicitly, as it is within conda on macOS,
# do not not do this.
if [ "$UNAME" = "Darwin" ] && [ -z "$LD" ] && [ -x "$(xcode-select -p)/usr/bin/ld-classic" -o -x "$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-classic" ] ; then
LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-ld_classic,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
else
LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
Expand Down
8 changes: 6 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,9 @@ setenv =
# brew caches downloaded files in ${HOME}/Library/Caches. We share it between different toxenvs.
homebrew: SYSTEM=homebrew
local-homebrew: HOMEBREW={envdir}/homebrew
# /opt/homebrew is the default install location on arm64 macOS
local-homebrew-opthomebrew: HOMEBREW=/opt/homebrew
# /usr/local is the default install location on x86_64 macOS
local-{homebrew-usrlocal,nohomebrew}: HOMEBREW=/usr/local
# local-macos-nohomebrew: "best effort" isolation to avoid using a homebrew installation in /usr/local
# We use liblzma from the macOS system - which is available but its headers are not (neither is the xz executable).
Expand All @@ -538,10 +541,11 @@ setenv =
local-conda: PATH={env:CONDA_PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin
local-conda: CONDA_PKGS_DIRS={env:SHARED_CACHE_DIR}/conda_pkgs
local-conda: CONDA_OS=$(uname | sed 's/^Darwin/MacOSX/;')
local-conda: CONDA_ARCH=$(uname -m)
local-conda-forge: CONDA_INSTALLER_URL_BASE=https://github.com/conda-forge/miniforge/releases/latest/download/
local-conda-forge: CONDA_INSTALLER_FILE=Miniforge3-{env:CONDA_OS}-x86_64.sh
local-conda-forge: CONDA_INSTALLER_FILE=Miniforge3-{env:CONDA_OS}-{env:CONDA_ARCH}.sh
local-conda-miniconda: CONDA_INSTALLER_URL_BASE=https://repo.anaconda.com/miniconda/
local-conda-miniconda: CONDA_INSTALLER_FILE=Miniconda3-latest-{env:CONDA_OS}-x86_64.sh
local-conda-miniconda: CONDA_INSTALLER_FILE=Miniconda3-latest-{env:CONDA_OS}-{env:CONDA_ARCH}.sh
local-conda: SETENV=. {env:CONDA_PREFIX}/bin/activate base
local-conda-environment: CONDA_SAGE_ENVIRONMENT=sage-build
local-conda-environment: CONDA_SAGE_ENVIRONMENT_DIR=
Expand Down
Loading