From f4a88d2b497a3f64b1e588ea93e7729f2d7b8603 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 17 Jun 2024 10:03:30 -0400 Subject: [PATCH] [CI] Explicitly test NumPy 1.x compatibility --- .github/workflows/main.yml | 58 +++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bbc0fac9e2..a7bb3ebbfb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 @@ -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 \ @@ -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 @@ -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. @@ -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()