Skip to content

Commit

Permalink
[CI] Explicitly test NumPy 1.x compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and bryanwweber committed Jun 19, 2024
1 parent 4d509b5 commit f4a88d2
Showing 1 changed file with 45 additions and 13 deletions.
58 changes: 45 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
- name: Install Apt dependencies
run: |
sudo apt update
sudo apt install libboost-dev gfortran libopenmpi-dev libpython3-dev \
libblas-dev liblapack-dev libhdf5-dev
sudo apt install libboost-dev gfortran libopenmpi-dev libblas-dev \
liblapack-dev libhdf5-dev
gcc --version
- name: Upgrade pip
run: python3 -m pip install -U pip setuptools wheel
Expand All @@ -59,13 +59,20 @@ jobs:
select-by-folder: /home/runner/work/cantera/cantera/test/matlab_experimental

ubuntu-multiple-pythons:
name: ${{ matrix.os }} with Python ${{ matrix.python-version }}
name: ${{ matrix.os }} with Python ${{ matrix.python-version }}, Numpy ${{ matrix.numpy || 'latest' }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
python-version: ['3.8', '3.10', '3.11', '3.12']
os: ['ubuntu-20.04', 'ubuntu-22.04']
numpy: ['']
include:
# Keep some test cases with NumPy 1.x until we drop support
- python-version: '3.12'
os: 'ubuntu-24.04'
numpy: "'<2.0'"

fail-fast: false
env:
HDF5_LIBDIR: /usr/lib/x86_64-linux-gnu/hdf5/serial
Expand All @@ -83,15 +90,16 @@ jobs:
- name: Install Apt dependencies
run: |
sudo apt update
sudo apt install libboost-dev gfortran libopenmpi-dev libpython3-dev \
libblas-dev liblapack-dev libhdf5-dev libfmt-dev
sudo apt install libboost-dev gfortran libopenmpi-dev libblas-dev \
liblapack-dev libhdf5-dev libfmt-dev
gcc --version
- name: Upgrade pip
run: python3 -m pip install -U pip setuptools wheel
- name: Install Python dependencies
run: |
python3 -m pip install ruamel.yaml scons==3.1.2 numpy cython pandas pytest \
pytest-github-actions-annotate-failures pytest-xdist pint graphviz
python3 -m pip install ruamel.yaml scons==3.1.2 numpy${{ matrix.numpy }} \
cython pandas pytest pytest-github-actions-annotate-failures pytest-xdist \
pint graphviz
- name: Build Cantera
run: |
python3 `which scons` build env_vars=all -j4 debug=n --debug=time \
Expand Down Expand Up @@ -393,14 +401,38 @@ jobs:
"${DOCS_OUTPUT_DIR}" ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_DEST}
run-examples:
name: Run Python ${{ matrix.python-version }} examples on ${{ matrix.os }}
name: Run Python ${{ matrix.python-version }} examples on ${{ matrix.os }}, NumPy ${{ matrix.numpy || 'latest' }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
needs: ["ubuntu-multiple-pythons"]
strategy:
matrix:
os: ["ubuntu-20.04", "ubuntu-22.04"]
python-version: ['3.8', '3.10', '3.11', '3.12']
# Keep some test cases with NumPy 1.x until we explicitly drop support
include:
- os: "ubuntu-20.04"
python-version: "3.8"
numpy: ""
- os: "ubuntu-22.04"
python-version: "3.8"
numpy: ""
- os: "ubuntu-20.04"
python-version: "3.10"
numpy: "==1.21.6"
- os: "ubuntu-22.04"
python-version: "3.10"
numpy: ""
- os: "ubuntu-22.04"
python-version: "3.11"
numpy: "==1.23.5"
- os: "ubuntu-20.04"
python-version: "3.11"
numpy: ""
- os: "ubuntu-22.04"
python-version: "3.12"
numpy: "==1.26.4"
- os: "ubuntu-20.04"
python-version: "3.12"
numpy: ""
fail-fast: false
env:
HDF5_LIBDIR: /usr/lib/x86_64-linux-gnu/hdf5/serial
Expand Down Expand Up @@ -433,8 +465,8 @@ jobs:
run: python3 -m pip install -U pip setuptools wheel
- name: Install Python dependencies
run: |
python3 -m pip install numpy ruamel.yaml pandas pyarrow matplotlib scipy \
pint graphviz CoolProp
python3 -m pip install numpy${{ matrix.numpy }} ruamel.yaml pandas pyarrow \
matplotlib scipy pint graphviz CoolProp
python3 -m pip install --pre --no-index --find-links dist cantera
- name: Run the examples
# See https://unix.stackexchange.com/a/392973 for an explanation of the -exec part.
Expand All @@ -460,7 +492,7 @@ jobs:
with:
path: results.txt
retention-days: 2
name: example-results-${{ matrix.python-version }}-${{ matrix.os }}
name: example-results-${{ matrix.python-version }}-${{ matrix.os }}-np${{ matrix.numpy || 'latest' }}
# Run this step if the job was successful or failed, but not if it was cancelled
# Using always() would run this step if the job was cancelled as well.
if: failure() || success()
Expand Down

0 comments on commit f4a88d2

Please sign in to comment.