Skip to content

Commit

Permalink
Use matrix to test on macos builtin python, github actions python and…
Browse files Browse the repository at this point in the history
… brew python
  • Loading branch information
robtaylor committed Oct 16, 2023
1 parent 74771d2 commit 62a2f6b
Showing 1 changed file with 47 additions and 17 deletions.
64 changes: 47 additions & 17 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,40 @@ permissions:
jobs:
unittests-appleclang:
runs-on: macos-latest
strategy:
matrix:
include:
- python: homebrew
- python: osx-builtin
- python: github-action

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Install Python with setup-python action
if: ${{ matrix.python }} == "github-action"
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Homebrew Python
if: ${{ matrix.python }} == "homebrew"
run: |
eval "$(brew shellenv)"
echo HOMEBREW_PREFIX="$HOMEBREW_PREFIX" >> $GITHUB_ENV
echo HOMEBREW_REPOSITORY="$HOMEBREW_REPOSITORY" >> $GITHUB_ENV
echo HOMEBREW_CELLAR="$HOMEBREW_CELLAR" >> $GITHUB_ENV
echo PATH="$PATH" >> $GITHUB_ENV
echo MANPATH="$MANPATH" >> $GITHUB_ENV
echo INFOPATH="$INFOPATH" >> $GITHUB_ENV
brew install python@3
- run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-xdist pytest-subtests jsonschema coverage
- run: brew install pkg-config ninja llvm qt@5
- env:
CPPFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
MESON_CI_JOBNAME: unittests-appleclang
MESON_CI_JOBNAME: ${{ job.name }}
MESON_UNIT_TEST_BACKEND: ninja
# These cannot evaluate anything, so we cannot set PATH or SDKROOT here
run: |
Expand All @@ -65,27 +86,36 @@ jobs:
fail-fast: false
matrix:
include:
- NAME: macos-clang
unity: off
- NAME: macos-clang-unity
unity: on
- unity: clang-unity
- unity: clang
- python: homebrew
- python: osx-builtin
- python: github-action

name: ${{ matrix.NAME }}
name: Mac OSX Project, Python from ${{ matrix.python }}, compiler ${{ matrix.unity }}
env:
MESON_CI_JOBNAME: ${{ matrix.NAME }}
MESON_CI_JOBNAME: ${{ job.name }}

steps:
- uses: actions/checkout@v3
# Avoid picking up an older version of LLVM that does not work.
- run: brew update
# github actions overwrites brew's python. Force it to reassert itself, by running in a separate step.
- name: unbreak python in github actions
- name: Install Python with setup-python action
if: ${{ matrix.python }} == "github-action"
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Homebrew Python
if: ${{ matrix.python }} == "homebrew"
run: |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
# use python3 from homebrew because it is a valid framework, unlike the actions one:
# https://github.com/actions/setup-python/issues/58
eval "$(brew shellenv)"
echo HOMEBREW_PREFIX="$HOMEBREW_PREFIX" >> $GITHUB_ENV
echo HOMEBREW_REPOSITORY="$HOMEBREW_REPOSITORY" >> $GITHUB_ENV
echo HOMEBREW_CELLAR="$HOMEBREW_CELLAR" >> $GITHUB_ENV
echo PATH="$PATH" >> $GITHUB_ENV
echo MANPATH="$MANPATH" >> $GITHUB_ENV
echo INFOPATH="$INFOPATH" >> $GITHUB_ENV
brew install python@3
- run: brew install pkg-config ninja llvm qt@5 boost ldc hdf5 openmpi lapack scalapack sdl2 boost-python3 gtk-doc
- run: |
python3 -m pip install --upgrade setuptools
Expand Down

0 comments on commit 62a2f6b

Please sign in to comment.