Skip to content

Extend testing workflow to test on mac (intel and arm) #31

Extend testing workflow to test on mac (intel and arm)

Extend testing workflow to test on mac (intel and arm) #31

Workflow file for this run

name: Test PyMEOS
on:
push:
branches: [ "develop", "master" ]
paths-ignore:
- "docs/**"
- ".readthedocs.yml"
- "README.md"
pull_request:
branches: [ "develop", "master" ]
paths-ignore:
- "docs/**"
- ".readthedocs.yml"
- "README.md"
jobs:
test:
name: Test PyMEOS for Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
os: [ ubuntu-latest, macos-13, macos-14 ]
exclude:
# Necessary due to issue with macOS runners. See
# https://github.com/actions/setup-python/issues/808
# Can be removed once this PR is merged:
# https://github.com/actions/python-versions/pull/259
- os: macos-14
python-version: "3.8"
- os: macos-14
python-version: "3.9"
include:
- ld_path: "/usr/local/lib"
- os: macos-14
ld_path: "/opt/homebrew/lib"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get dependencies from apt (cache)
uses: awalsh128/cache-apt-pkgs-action@latest
if: runner.os == 'Linux'
with:
packages: build-essential cmake postgresql-server-dev-14 libproj-dev libjson-c-dev libgsl-dev libgeos-dev
version: 1.0
- name: Update brew
if: matrix.os == 'macos-13'
# Necessary to avoid issue with macOS runners. See
# https://github.com/actions/runner-images/issues/4020
run: |
brew reinstall [email protected] || brew link --overwrite [email protected]
brew reinstall [email protected] || brew link --overwrite [email protected]
brew update
- name: Get dependencies from homebrew (cache)
uses: tecolicom/actions-use-homebrew-tools@v1
if: runner.os == 'macOS'
with:
tools: cmake libpq proj json-c gsl geos
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Fetch MEOS sources
env:
BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
run: |
git clone --branch ${{ env.BRANCH_NAME }} --depth 1 https://github.com/MobilityDB/MobilityDB
- name: Patch MEOS for macOS
if: runner.os == 'macOS'
run: |
cd MobilityDB
sed -i "" "s,#define HAVE_STRCHRNUL 1,//#define HAVE_STRCHRNUL 1,g" ./meos/postgres/pg_config.h
sed -i "" "s,#define HAVE__GET_CPUID 1,//#define HAVE__GET_CPUID 1,g" ./meos/postgres/pg_config.h
- name: Patch MEOS for arm macOS
if: matrix.os == 'macos-14'
run: |
cd MobilityDB
sed -i "" "s,#define HAVE_X86_64_POPCNTQ 1,//#define HAVE_X86_64_POPCNTQ 1,g" ./meos/postgres/pg_config.h
sed -i "" "s,/* #undef USE_ARMV8_CRC32C */,#define USE_ARMV8_CRC32C 1,g" ./meos/postgres/pg_config.h
sed -i '' '392s;.*;&\nprintf("Hey 1")\; ;' ./meos/src/general/tnumber_mathfuncs_meos.c
sed -i '' '165s;.*;&\nprintf("Hey 2")\; ;' ./meos/src/general/tnumber_mathfuncs.c
sed -i '' '343s;.*;&\nprintf("Hey 3")\; ;' ./meos/src/general/type_util.c
cat ./meos/src/general/tnumber_mathfuncs_meos.c
- name: Install MEOS
run: |
mkdir MobilityDB/build
cd MobilityDB/build
cmake .. -DMEOS=on
make -j
sudo make install
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r pymeos_cffi/dev-requirements.txt
pip install -r pymeos/dev-requirements.txt
- name: Install pymeos_cffi
run: |
cd pymeos_cffi
python ./pymeos_cffi/builder/build_header.py
python ./pymeos_cffi/builder/build_pymeos_functions.py
pip install .
- name: Test PyMEOS with pytest
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_path }}
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_path }}
cd pymeos
python -c "from pymeos import *; pymeos_initialize(); print(TFloatSeqSet(\"Interp=Step;{[1.4142135623730951@2019-09-01, 1.4142135623730951@2019-09-02], [0@2019-09-03, 0@2019-09-05]}\") / 2)"
pytest