util update #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-macos | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '3.10', '3.11'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install prerequisites | |
run: | | |
brew install geos | |
# brew install libomp | |
# Starting from libomp>=15.0, the libomp installation in homebrew is "keg-only", | |
# meaning that libomp is only installed in homebrew's directory, but not moved | |
# to /usr/local to avoid other OpenMP installations (such as with gcc's version | |
# of OpenMP). To use the homebrew's version of OpenMP,the following symbolic | |
# links are created. Without these, the installation will fail with the error | |
# of "fatal error: omp.h file found" | |
# ln -s /usr/local/opt/libomp/include/omp-tools.h /usr/local/include/omp-tools.h | |
# ln -s /usr/local/opt/libomp/include/omp.h /usr/local/include/omp.h | |
# ln -s /usr/local/opt/libomp/include/ompt.h /usr/local/include/ompt.h | |
# ln -s /usr/local/opt/libomp/lib/libomp.a /usr/local/lib/libomp.a | |
# ln -s /usr/local/opt/libomp/lib/libomp.dylib /usr/local/lib/libomp.dylib | |
# This is needed to import numpy in pypy3 (but not needed for | |
# pypy2 and CPython) | |
# brew install openblas | |
# OPENBLAS="$(brew --prefix openblas)" | |
# brew install lapack | |
# pip3 install numpy | |
- name: Install package and dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade numpy | |
python -m pip install --upgrade . | |
# This is to prevent the error "libomp is already initialized", | |
# which occurs only in MacOS. To circumvent the error, the | |
# following script will remove libomp.dylib from imate package, and | |
# copies libomp.dylib from restoreio to imate package. | |
# - name: Remove duplicate libomp | |
# run: | | |
# chmod +x scripts/fix_libomp.sh | |
# ./scripts/fix_libomp.sh `which python` | |
# shell: bash | |
# Temporarily do not perform test due to duplicate libomp error in MacOS. | |
- name: Test | |
run: | | |
python -m pip install --upgrade pytest | |
python -m pip install --upgrade pytest-cov | |
mv restoreio restoreio-DoNotImport | |
pytest | |
- name: Coverage | |
run: | | |
python -m pip install codecov | |
codecov |