Skip to content

test GitHub discussion 889 #2031

test GitHub discussion 889

test GitHub discussion 889 #2031

Workflow file for this run

name: test
on:
pull_request:
push:
branches:
- master
- release/*
- test-*
defaults:
run:
shell: bash
env:
official_container_repository: ghcr.io/evalf/nutils
jobs:
build-python-package:
name: Build Python package
runs-on: ubuntu-latest
outputs:
wheel: ${{ steps.build.outputs.wheel }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build dependencies
run: python -um pip install flit
- name: Build package
id: build
run: |
# To make the wheels reproducible, set the timestamp of the (files in
# the) generated wheels to the date of the commit.
export SOURCE_DATE_EPOCH=`git show -s --format=%ct`
python -um flit build
echo wheel=`echo dist/*.whl` >> $GITHUB_OUTPUT
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: python-package
path: dist/
if-no-files-found: error
test:
needs: build-python-package
name: 'Test ${{ matrix.name }}'
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- {name: "baseline", os: ubuntu-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 1}
- {name: "windows", os: windows-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 1}
- {name: "macos", os: macos-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 1}
- {name: "python 3.8", os: ubuntu-latest, python-version: "3.8", matrix-backend: numpy, nprocs: 1}
- {name: "python 3.9", os: ubuntu-latest, python-version: "3.9", matrix-backend: numpy, nprocs: 1}
- {name: "python 3.10", os: ubuntu-latest, python-version: "3.10", matrix-backend: numpy, nprocs: 1}
- {name: "python 3.11", os: ubuntu-latest, python-version: "3.11", matrix-backend: numpy, nprocs: 1}
- {name: "scipy matrix", os: ubuntu-latest, python-version: "3.12", matrix-backend: scipy, nprocs: 1}
- {name: "mkl linux", os: ubuntu-latest, python-version: "3.12", matrix-backend: mkl, nprocs: 1}
- {name: "mkl linux parallel", os: ubuntu-latest, python-version: "3.12", matrix-backend: mkl, nprocs: 2}
- {name: "mkl windows", os: windows-latest, python-version: "3.12", matrix-backend: mkl, nprocs: 1}
- {name: "parallel", os: ubuntu-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 2}
- {name: "numpy 1.17", os: ubuntu-latest, python-version: "3.8", matrix-backend: numpy, nprocs: 1, numpy-version: ==1.17.3}
- {name: "tensorial", os: ubuntu-latest, python-version: "3.12", matrix-backend: numpy, nprocs: 1, tensorial: test}
fail-fast: false
env:
_wheel: ${{ needs.build-python-package.outputs.wheel }}
NUTILS_MATRIX: ${{ matrix.matrix-backend }}
NUTILS_NPROCS: ${{ matrix.nprocs }}
NUTILS_DEBUG: all
OMP_NUM_THREADS: 1
VECLIB_MAXIMUM_THREADS: 1
MKL_DYNAMIC: FALSE
MKL_NUM_THREADS: 1
PYTHONHASHSEED: 0
NUTILS_TENSORIAL: ${{ matrix.tensorial }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Move nutils directory
run: mv nutils _nutils
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download Python package artifact
uses: actions/download-artifact@v4
with:
name: python-package
path: dist/
- name: Install Graphviz
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install -y graphviz
- name: Install Nutils and dependencies
id: install
env:
_numpy_version: ${{ matrix.numpy-version }}
run: |
python -um pip install --upgrade --upgrade-strategy eager wheel
python -um pip install --upgrade --upgrade-strategy eager numpy$_numpy_version
# Install Nutils from `dist` dir created in job `build-python-package`.
python -um pip install "$_wheel[import_gmsh,export_mpl]"
- name: Install Scipy
if: ${{ matrix.matrix-backend == 'scipy' }}
run: python -um pip install --upgrade scipy
- name: Configure MKL
if: ${{ matrix.matrix-backend == 'mkl' }}
run: |
python -um pip install --upgrade --upgrade-strategy eager mkl
python -um devtools.gha.configure_mkl
- name: Test
env:
COVERAGE_ID: ${{ matrix.name }}
run: python -um unittest -v tests.test_gh_discussion_889