Skip to content

Unit test and examples #2135

Unit test and examples

Unit test and examples #2135

name: Unit test and examples
on:
push:
pull_request:
# every day at 3 am UTC
schedule:
- cron: '0 3 * * *'
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
unit_test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude:
- os: macos-14
python-version: 3.9
- os: macos-13
python-version: 3.9
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: install-rtools
if: matrix.os == 'windows-latest'
run: |
choco install rtools --version=4.0.0.20220206 --no-progress --force
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
- name: Install system dependencies in Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt install -y gfortran ngspice python3-tk libboost-all-dev libopenblas-dev libfftw3-dev libsuitesparse-dev
- name: Install system dependencies in MacOS (ARM)
if: matrix.os == 'macos-latest'
run: |
brew reinstall gfortran openblas pkg-config
brew install ngspice boost suite-sparse
- name: Install system dependencies in MacOS (Intel)
if: matrix.os == 'macos-12'
run: |
brew reinstall gfortran
brew install ngspice
- name: Install system dependencies in Windows
if: matrix.os == 'windows-latest'
run: choco install ngspice
- name: Install Python dependencies
run: |
pip install --upgrade pip uv
uv pip install --system numpy --config-settings=setup-args="-Dallow-noblas=true"
uv pip install --system pytest meson-python ninja cython spin==0.9
python3 -m spin install-dependencies -test-dep
- name: Install S4 (macOS - arm)
if: matrix.os == 'macos-latest'
run: |
uv pip install --system wheel setuptools
git clone https://github.com/phoebe-p/S4
cd S4
git checkout rename_interpolator
make S4_pyext --file="Makefile.m1"
cd ..
rm -rf S4
- name: Install S4 (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
uv pip install --system wheel setuptools
git clone https://github.com/phoebe-p/S4
cd S4
make S4_pyext
cd ..
rm -rf S4
- name: Build solcore
run: |
python -m spin build -- -Dwith_pdd=true -Dinstall_test=true
- name: Unit and functional tests (MacOS and Linux)
if: matrix.os != 'windows-latest'
env:
SOLCORE_SPICE: ngspice
run: |
python -m spin test -- -r a -v --cov=solcore/ --ignore=solcore/tests/test_examples.py -n "auto"
- name: Unit and functional tests (Windows)
if: matrix.os == 'windows-latest'
run: |
cd D:\a\solcore5\solcore5\build-install\usr\Lib\site-packages
python -m pytest -r a -v --ignore=solcore/tests/test_examples.py -n "auto"
- name: Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
python -m uv pip install --system codecov
python -m spin codecov
test_examples:
needs: unit_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude:
- os: macos-latest
python-version: 3.9
- os: macos-latest
python-version: 3.9
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies in Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt install -y gfortran ngspice python3-tk libboost-all-dev libopenblas-dev libfftw3-dev libsuitesparse-dev
- name: Install system dependencies in MacOS (ARM)
if: matrix.os == 'macos-latest'
run: |
brew reinstall gfortran openblas pkg-config
brew install ngspice boost suite-sparse
- name: Install Python dependecies
run: |
pip install --upgrade pip uv
uv pip install --system numpy --config-settings=setup-args="-Dallow-noblas=true"
uv pip install --system pytest meson-python ninja cython spin
python3 -m spin install-dependencies -test-dep
- name: Install S4 (macOS - arm)
if: matrix.os == 'macos-latest'
run: |
uv pip install --system wheel setuptools
git clone https://github.com/phoebe-p/S4
cd S4
make S4_pyext --file="Makefile.m1"
cd ..
rm -rf S4
- name: Install S4 (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
uv pip install --system wheel setuptools
git clone https://github.com/phoebe-p/S4
cd S4
make S4_pyext
cd ..
rm -rf S4
- name: Build solcore
run: |
python -m spin build -- -Dwith_pdd=true -Dinstall_test=true
- name: Unit and functional tests (MacOS and Linux)
if: matrix.os != 'windows-latest'
env:
SOLCORE_SPICE: ngspice
run: |
python -m spin test -- -r a -v solcore/tests/test_examples.py -n "auto"