Update CI and fix Python builds (#59) #64
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: test-python | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
branches: | |
- 'master' | |
jobs: | |
unix: | |
name: 3.12 (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip wheel setuptools | |
python -m pip install numpy scikit-build ninja | |
- name: Set Compiler (Linux) | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
echo "FC=gfortran" >> $GITHUB_ENV | |
echo "CC=gcc" >> $GITHUB_ENV | |
- name: Install and Set Compiler (MacOS) | |
if: contains(matrix.os, 'macos') | |
run: | | |
brew reinstall gfortran | |
echo "FC=gfortran" >> $GITHUB_ENV | |
echo "CC=gcc" >> $GITHUB_ENV | |
- name: Build and install Python bindings | |
run: python -m pip install . -v --no-build-isolation --no-deps --ignore-installed --no-cache-dir | |
- name: Test import Python module | |
run: python -c "import sys; sys.path.pop(0); import fastscapelib_fortran" | |
windows: | |
name: 3.12 (windows-latest) | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: 3.12 | |
miniforge-version: latest | |
- name: Install dependencies | |
shell: cmd | |
run: | | |
conda create -n test python=3.12 cmake c-compiler flang=5.0 scikit-build pip wheel setuptools numpy | |
- name: Conda env info | |
shell: cmd | |
run: >- | |
conda activate test && | |
echo %CONDA% && | |
ls %CONDA%\envs\test\Library\bin | |
- name: Build and install project | |
shell: cmd | |
run: >- | |
conda activate test && | |
set FC=%CONDA%\envs\test\Library\bin\flang.exe && | |
python setup.py bdist_wheel --dist-dir="dist" -G "NMake Makefiles" -- -DCMAKE_Fortran_COMPILER:FILEPATH="%FC%" && | |
python -m pip install --no-index --find-links="dist" fastscapelib_fortran -vvv | |
- name: Test import Python module | |
run: python -c "import sys; sys.path.pop(0); import fastscapelib_fortran" |