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] Re-enable python tests for MacOS #1082

Merged
merged 9 commits into from
Dec 23, 2024
12 changes: 4 additions & 8 deletions .github/actions/test-ttk-unix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@ runs:
- name: Test Python example
shell: bash
run: |
if [ "${{ matrix.os }}" != "macos-13" ] && [ "${{ matrix.os }}" != "macos-14" ] && [ "${{ matrix.os }}" != "macos-15" ]; then
cd $GITHUB_WORKSPACE/examples/python
python3 example.py ../data/inputData.vtu
fi
cd $GITHUB_WORKSPACE/examples/python
python3 example.py ../data/inputData.vtu

- name: Test pvpython example
shell: bash
run: |
if [ "${{ matrix.os }}" != "macos-13" ] && [ "${{ matrix.os }}" != "macos-14" ] && [ "${{ matrix.os }}" != "macos-15" ]; then
cd $GITHUB_WORKSPACE/examples/pvpython
pvpython example.py ../data/inputData.vtu
fi
cd $GITHUB_WORKSPACE/examples/pvpython
pvpython example.py ../data/inputData.vtu

- name: Test standalone
shell: bash
Expand Down
42 changes: 27 additions & 15 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,23 @@ jobs:
- uses: actions/checkout@v4
name: Checkout TTK source code

- name: Remove hosted Python
run: |
sudo rm -rf /Library/Frameworks/Python.framework/
sudo rm -rf /usr/local/Frameworks/Python.framework/
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install macOS dependencies
run: |
# ParaView dependencies
brew reinstall python
brew install --cask xquartz
brew install llvm mesa glew qt@5 ninja
# TTK dependencies
brew install boost eigen graphviz spectra sqlite zlib numpy qhull

- name: Install and setup sccache
uses: f3d-app/sccache-setup-action@v1
with:
key: macos-0

- name: Install optional dependencies
uses: ./.github/actions/install-deps-unix

Expand All @@ -210,7 +213,11 @@ jobs:
wget https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-${{ env.PV_TAG }}-${{ matrix.os }}.tar.gz
tar xzf ttk-paraview-${{ env.PV_TAG }}-${{ matrix.os }}.tar.gz
sudo cp -r ttk-paraview/* /usr/local
# pvpython does not embed the correct PYTHONPATH
echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:$PYTHONPATH" >> $GITHUB_ENV
pvpython -m pip install --break-system-packages scikit-learn
# pvpython is expecting a vtkpython executable at this path
sudo ln -s /usr/local/bin/pvpython /Library/Frameworks/Python.framework/Versions/3.12/vtkpython

- name: Set compilers as environment variables
run: |
Expand All @@ -224,8 +231,6 @@ jobs:
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 \
-DPython3_FIND_STRATEGY=LOCATION \
-DPython3_ROOT_DIR=$(brew --prefix python) \
-DTTK_BUILD_PARAVIEW_PLUGINS=TRUE \
-DTTK_BUILD_VTK_WRAPPERS=TRUE \
-DTTK_BUILD_STANDALONE_APPS=TRUE \
Expand Down Expand Up @@ -267,25 +272,30 @@ jobs:
- uses: actions/checkout@v4
name: Checkout TTK source code

- name: Remove hosted Python
run: |
sudo rm -rf /Library/Frameworks/Python.framework
sudo rm -rf /usr/local/Frameworks/Python.framework
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install macOS dependencies
run: |
# ParaView dependencies
brew reinstall python
brew install --cask xquartz
brew install llvm mesa glew qt@5 ninja
# TTK dependencies
brew install boost eigen graphviz spectra sqlite zlib numpy qhull

- name: Install and setup sccache
uses: f3d-app/sccache-setup-action@v1
with:
key: macos-0

- name: Install optional dependencies
uses: ./.github/actions/install-deps-unix

- name: Fetch TTK-ParaView
run: |
wget -O ttk-paraview.tar.gz https://github.com/${{ env.PV_REPO }}/releases/download/${{ env.PV_TAG }}/ttk-paraview-${{ env.PV_TAG }}-${{ matrix.os }}.tar.gz


- name: Fetch TTK .tar.gz artifact
uses: actions/download-artifact@v4.1.7
with:
Expand All @@ -305,7 +315,9 @@ jobs:
echo "CXX=$(brew --prefix llvm)/bin/clang++" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$(brew --prefix qt@5)/lib/cmake:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
# pvpython does not embed the correct PYTHONPATH
echo "PYTHONPATH=/usr/local/lib/python3.13/site-packages:$PYTHONPATH" >> $GITHUB_ENV
echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:$PYTHONPATH" >> $GITHUB_ENV
# pvpython is expecting a vtkpython executable at this path
sudo ln -s /usr/local/bin/pvpython /Library/Frameworks/Python.framework/Versions/3.12/vtkpython

- name: Run TTK tests
uses: ./.github/actions/test-ttk-unix
Expand All @@ -326,7 +338,7 @@ jobs:
# remove examples which fill up the memory
rm python/topologicalOptimization_darkSky.py
# some cases fail only with version 12
if [[ "${{ matrix.os }}" == "macos-12" ]]; then
if [[ "${{ matrix.os }}" == "macos-13" ]]; then
rm python/contourTreeAlignment.py
rm python/geometryApproximation.py
rm python/harmonicSkeleton.py
Expand Down
26 changes: 12 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,13 @@ jobs:
- uses: actions/checkout@v4
name: Checkout TTK source code

- name: Remove hosted Python
run: |
sudo rm -rf /Library/Frameworks/Python.framework/
sudo rm -rf /usr/local/Frameworks/Python.framework/
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install macOS dependencies
run: |
# ParaView dependencies
brew reinstall python
brew install --cask xquartz
brew install llvm ninja open-mpi
# TTK dependencies
Expand All @@ -310,7 +309,11 @@ jobs:
run: |
tar xzf ttk-paraview-headless.tar.gz
sudo cp -r ttk-paraview/* /usr/local
# pvpython does not embed the correct PYTHONPATH
echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:$PYTHONPATH" >> $GITHUB_ENV
pvpython -m pip install --break-system-packages scikit-learn
# pvpython is expecting a vtkpython executable at this path
sudo ln -s /usr/local/bin/pvpython /Library/Frameworks/Python.framework/Versions/3.12/vtkpython

- name: Set compilers as environment variables
run: |
Expand Down Expand Up @@ -349,11 +352,6 @@ jobs:
shell: bash
run: sccache --show-stats

- name: Set PYTHONPATH for macOS pvpython
run: |
# pvpython does not embed the correct PYTHONPATH
echo "PYTHONPATH=/usr/local/lib/python3.13/site-packages:$PYTHONPATH" >> $GITHUB_ENV

- name: Run TTK tests
uses: ./.github/actions/test-ttk-unix

Expand All @@ -365,7 +363,6 @@ jobs:
name: Checkout ttk-data

- name: Run ttk-data states [NOT ENFORCED]
if: false
id: validate
continue-on-error: true
run: |
Expand All @@ -374,6 +371,8 @@ jobs:
rm ttk-data/states/nestedTrackingFromOverlap.py
# remove examples which fill up the memory
rm ttk-data/states/topologicalOptimization_darkSky.pvsm
# remove examples that take too long to render under mac
rm ttk-data/states/persistentGenerators_householdAnalysis.pvsm
cd ttk-data/tests
mkdir output_screenshots
pvpython -u validate.py || (tar zcf screenshots.tar.gz output_screenshots && false)
Expand All @@ -384,12 +383,11 @@ jobs:
if: steps.validate.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: screenshots-macOS.tar.gz
name: screenshots-${{ matrix.os }}.tar.gz
path: ttk-data/tests/screenshots.tar.gz
retention-days: 10

- name: Run ttk-data Python scripts [TEMPORARILY NOT ENFORCED]
continue-on-error: true
- name: Run ttk-data Python scripts
run: |
cd ttk-data
# remove buggy example
Expand Down
26 changes: 20 additions & 6 deletions paraview/patch/headless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,15 @@ jobs:
- uses: actions/checkout@v4
name: Checkout TTK-ParaView source code

- name: Remove hosted Python
run: |
sudo rm -rf /Library/Frameworks/Python.framework/
sudo rm -rf /usr/local/Frameworks/Python.framework/
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install macOS dependencies
run: |
# ParaView dependencies
brew reinstall python
brew install --cask xquartz
brew install ninja
brew install ninja open-mpi

- name: Create & configure ParaView build directory
run: |
Expand All @@ -112,6 +110,22 @@ jobs:
cd build
cpack -G TGZ

- name: Install ParaView
run: |
cd build
sudo cmake --build . --target install
# pvpython does not embed the correct PYTHONPATH
echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:$PYTHONPATH" >> $GITHUB_ENV

- name: Test Python imports
run: |
python3 -m vtk
python3 -m paraview.simple
pvpython -m vtk
pvpython -m paraview.simple
env:
DYLD_LIBRARY_PATH: /usr/local/lib

- name: Upload compressed binaries
uses: actions/upload-artifact@v4
with:
Expand Down
28 changes: 22 additions & 6 deletions paraview/patch/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,20 @@ jobs:
strategy:
matrix:
os: [macos-13, macos-14, macos-15]
env:
CCACHE_DIR: /Users/runner/work/ttk/.ccache
CCACHE_MAXSIZE: 200M
steps:
- uses: actions/checkout@v4
name: Checkout TTK-ParaView source code

- name: Remove hosted Python
run: |
sudo rm -rf /Library/Frameworks/Python.framework/
sudo rm -rf /usr/local/Frameworks/Python.framework
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install macOS dependencies
run: |
# ParaView dependencies
brew reinstall python
brew install --cask xquartz
brew install mesa glew qt@5 ninja

Expand All @@ -98,7 +99,6 @@ jobs:
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 \
-DPython3_ROOT_DIR=$(brew --prefix python) \
-GNinja \
$GITHUB_WORKSPACE

Expand All @@ -112,6 +112,22 @@ jobs:
cd build
cpack -G TGZ

- name: Install ParaView
run: |
cd build
sudo cmake --build . --target install
# pvpython does not embed the correct PYTHONPATH
echo "PYTHONPATH=/usr/local/lib/python3.12/site-packages:$PYTHONPATH" >> $GITHUB_ENV

- name: Test Python imports
run: |
python3 -m vtk
python3 -m paraview.simple
pvpython -m vtk
pvpython -m paraview.simple
env:
DYLD_LIBRARY_PATH: /usr/local/lib

- name: Upload compressed binaries
uses: actions/upload-artifact@v4
with:
Expand Down
Loading