| 1 |
name: macos |
| 2 |
|
| 3 |
concurrency: |
| 4 |
group: macos-${{ github.head_ref || github.ref }} |
| 5 |
cancel-in-progress: true |
| 6 |
|
| 7 |
on: |
| 8 |
push: |
| 9 |
branches: |
| 10 |
- master |
| 11 |
# Stable branches such as 0.56 or 1.0 |
| 12 |
- '[0-9]+.[0-9]+' |
| 13 |
paths: |
| 14 |
- "mesonbuild/**" |
| 15 |
- "test cases/**" |
| 16 |
- "unittests/**" |
| 17 |
- ".github/workflows/macos.yml" |
| 18 |
- "run*tests.py" |
| 19 |
pull_request: |
| 20 |
paths: |
| 21 |
- "mesonbuild/**" |
| 22 |
- "test cases/**" |
| 23 |
- "unittests/**" |
| 24 |
- ".github/workflows/macos.yml" |
| 25 |
- "run*tests.py" |
| 26 |
|
| 27 |
permissions: |
| 28 |
contents: read |
| 29 |
|
| 30 |
jobs: |
| 31 |
unittests-appleclang: |
| 32 |
runs-on: macos-latest |
| 33 |
steps: |
| 34 |
- uses: actions/checkout@v4 |
| 35 |
- run: | |
| 36 |
export PATH="$HOME/Library/Python/3.9/bin:$PATH" |
| 37 |
/usr/bin/python3 -m pip install --upgrade pip |
| 38 |
/usr/bin/python3 -m pip install pytest pytest-xdist pytest-subtests fastjsonschema |
| 39 |
- run: brew install pkg-config ninja llvm qt@5 |
| 40 |
- env: |
| 41 |
CPPFLAGS: "-I/opt/homebrew/include" |
| 42 |
LDFLAGS: "-L/opt/homebrew/lib" |
| 43 |
MESON_CI_JOBNAME: unittests-appleclang |
| 44 |
MESON_UNIT_TEST_BACKEND: ninja |
| 45 |
HOMEBREW_NO_AUTO_UPDATE: 1 |
| 46 |
# These cannot evaluate anything, so we cannot set PATH or SDKROOT here |
| 47 |
run: | |
| 48 |
export SDKROOT="$(xcodebuild -version -sdk macosx Path)" |
| 49 |
export PATH="$HOME/Library/Python/3.9/bin:$HOME/tools:/opt/homebrew/opt/qt@5/bin:/opt/homebrew/opt/llvm/bin:$PATH" |
| 50 |
export PKG_CONFIG_PATH="/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/Current/lib/pkgconfig:/opt/homebrew/opt/qt@5/lib/pkgconfig:$PKG_CONFIG_PATH" |
| 51 |
/usr/bin/python3 ./run_unittests.py |
| 52 |
|
| 53 |
|
| 54 |
project-tests-appleclang: |
| 55 |
runs-on: macos-latest |
| 56 |
strategy: |
| 57 |
fail-fast: false |
| 58 |
matrix: |
| 59 |
include: |
| 60 |
- NAME: macos-clang |
| 61 |
unity: off |
| 62 |
- NAME: macos-clang-unity |
| 63 |
unity: on |
| 64 |
|
| 65 |
name: ${{ matrix.NAME }} |
| 66 |
env: |
| 67 |
MESON_CI_JOBNAME: ${{ matrix.NAME }} |
| 68 |
HOMEBREW_NO_AUTO_UPDATE: 1 |
| 69 |
|
| 70 |
steps: |
| 71 |
- uses: actions/checkout@v4 |
| 72 |
# Avoid picking up an older version of LLVM that does not work. |
| 73 |
- run: brew update |
| 74 |
# github actions overwrites brew's python. Force it to reassert itself, by running in a separate step. |
| 75 |
- name: unbreak python in github actions |
| 76 |
run: | |
| 77 |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete |
| 78 |
sudo rm -rf /Library/Frameworks/Python.framework/ |
| 79 |
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3 |
| 80 |
# Delete nonsensical PEP 668 breakage. It is the wrong solution to the problem and isn't designed to be |
| 81 |
# productive -- only victim blaming -- however it bites particularly badly because this is a container/VM |
| 82 |
# See commit 5c479d7a13a518c18ccb4dc3b6bdd7bfc2a9bdb5 for a more thorough analysis. |
| 83 |
find /opt/homebrew/Cellar/python* -name EXTERNALLY-MANAGED -print0 | xargs -0 rm -vf |
| 84 |
# use python3 from homebrew because it is a valid framework, unlike the actions one: |
| 85 |
# https://github.com/actions/setup-python/issues/58 |
| 86 |
- run: brew install pkg-config ninja llvm qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 boost-python3 gtk-doc zstd ncurses objfw libomp |
| 87 |
- run: | |
| 88 |
python3 -m pip install cython |
| 89 |
- env: |
| 90 |
CPPFLAGS: "-I/opt/homebrew/include" |
| 91 |
LDFLAGS: "-L/opt/homebrew/lib" |
| 92 |
MESON_ARGS: --unity=${{ matrix.unity }} |
| 93 |
XML_CATALOG_FILES: "/opt/homebrew/etc/xml/catalog" |
| 94 |
CI: 1 |
| 95 |
# These cannot evaluate anything, so we cannot set PATH or SDKROOT here |
| 96 |
run: | |
| 97 |
export SDKROOT="$(xcodebuild -version -sdk macosx Path)" |
| 98 |
# Append LLVM's bin directory to PATH to prioritise Apple Clang over Homebrew Clang. |
| 99 |
# We need this to avoid objfw test failures. |
| 100 |
export PATH="$HOME/tools:/opt/homebrew/opt/qt@5/bin:/opt/homebrew/opt/ncurses/bin:$PATH:/opt/homebrew/opt/llvm/bin" |
| 101 |
export PKG_CONFIG_PATH="/opt/homebrew/opt/qt@5/lib/pkgconfig:/opt/homebrew/opt/lapack/lib/pkgconfig:/opt/homebrew/opt/ncurses/lib/pkgconfig:$PKG_CONFIG_PATH" |
| 102 |
./run_project_tests.py --backend=ninja |