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 817d43d
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,29 @@ permissions:
jobs:
unittests-appleclang:
runs-on: macos-latest
strategy:
matrix:
homebrew: [true, false]
builtin-python: [true, false]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Install Python with setup-python action
if: ${{ matrix.builtin_python }} == false
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Homebrew Python
if: ${{ matrix.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
Expand Down Expand Up @@ -69,23 +87,33 @@ jobs:
unity: off
- NAME: macos-clang-unity
unity: on
homebrew: [True, False]
builtin-python: [True, False]

name: ${{ matrix.NAME }}
env:
MESON_CI_JOBNAME: ${{ matrix.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.builtin_python }} == false
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Homebrew Python
if: ${{ matrix.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 817d43d

Please sign in to comment.