Bump cython, fixes for tests, and fixes for deprecation warnings #312
Workflow file for this run
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: Tests | ||
on: | ||
pull_request: | ||
schedule: | ||
# Run test at 0400 UTC on Saturday. | ||
- cron: '0 4 * * 6' | ||
# Run test at 0400 UTC on day 1 of the month to create auto-generated | ||
# code afresh and cache it. | ||
- cron: '0 4 1 * *' # Ref https://crontab.guru/#0_4_1_*_* | ||
jobs: | ||
tests: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: [3.11] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
auto-update-conda: true | ||
python-version: ${{ matrix.python-version }} | ||
channels: conda-forge | ||
- name: Install dependencies on Linux/MacOS | ||
run: | | ||
conda info | ||
conda install -c conda-forge pocl pyopencl | ||
python -c 'import pyopencl as cl' | ||
if: ${{ runner.os != 'Windows' }} | ||
- name: Setup compyle config on MacOS to use openmp enabled clang from homebrew | ||
run: | ||
mkdir -p ~/.compyle | ||
touch ~/.compyle/config.py | ||
echo "import os" >> ~/.compyle/config.py | ||
echo "os.environ['CC'] = '$(brew --prefix llvm@15)/bin/clang'" >> ~/.compyle/config.py | ||
echo "os.environ['CXX'] = '$(brew --prefix llvm@15)/bin/clang++'" >> ~/.compyle/config.py | ||
export CPPFLAGS="-I$(brew --prefix libomp)/include" | ||
export LDFLAGS="-L$(brew --prefix libomp)/lib" | ||
python -c "import os; OMP_CFLAGS=os.environ.get('CPPFLAGS').split(', '); if OMP_CFLAGS is not None: print(f'{OMP_CFLAGS=}')" >> ~/.compyle/config.py | ||
python -c "import os; OMP_LINK=os.environ.get('LDFLAGS').split(', '); if OMP_LINK is not None: print(f'{OMP_LINK=}')" >> ~/.compyle/config.py | ||
if: ${{ runner.os == 'macOS' }} | ||
- name: Install dependencies | ||
run: | | ||
conda info | ||
conda install -c conda-forge numpy cython h5py | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install https://github.com/pypr/cyarray/zipball/master | ||
python -m pip install https://github.com/pypr/compyle/zipball/master | ||
python -m pip install -r requirements.txt -r requirements-test.txt | ||
python setup.py develop | ||
python -m pip list | ||
# Cache auto-generated code. Cache key changes every month. | ||
# Thanks https://stackoverflow.com/a/60942437 | ||
- name: Get month to use as cache key. | ||
id: month | ||
run: echo "month==$(date +'%m')" >> $GITHUB_OUTPUT | ||
- name: Deal with auto-generated code cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.pysph | ||
~/.compyle | ||
key: ${{ runner.os }}-${{ steps.month.outputs.month }} | ||
- name: Run tests | ||
run: | | ||
python -m pytest -v -m 'not slow or slow' |