add test-backend-case-distinction to workflow #608
Workflow file for this run
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: Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- dev | |
- streamlined-backend | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.10", "3.11"] | |
backend: ["jax", "numpy", "tensorflow", "torch"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: bayesflow | |
environment-file: environment.yaml | |
python-version: ${{ matrix.python-version }} | |
auto-activate-base: false | |
use-mamba: true | |
- name: Install JAX | |
if: ${{ matrix.backend == 'jax' }} | |
run: | | |
pip install -U "jax[cpu]" | |
export KERAS_BACKEND=jax | |
- name: Install NumPy | |
if: ${{ matrix.backend == 'numpy' }} | |
run: | | |
conda install numpy | |
export KERAS_BACKEND=numpy | |
- name: Install Tensorflow | |
if: ${{ matrix.backend == 'tensorflow' }} | |
run: | | |
pip install -U tensorflow | |
export KERAS_BACKEND=tensorflow | |
- name: Install PyTorch | |
if: ${{ matrix.backend == 'torch' }} | |
run: | | |
conda install pytorch torchvision torchaudio cpuonly -c pytorch | |
export KERAS_BACKEND=torch | |
- name: Show Environment Info | |
run: | | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
printenv | sort | |
- name: Run JAX Tests | |
if: ${{ matrix.backend == 'jax' }} | |
run: | | |
python -m pytest tests/ -n auto -v -m "not (numpy or tensorflow or torch)" | |
- name: Run NumPy Tests | |
if: ${{ matrix.backend == 'numpy' }} | |
run: | | |
python -m pytest tests/ -n auto -v -m "not (jax or tensorflow or torch)" | |
- name: Run TensorFlow Tests | |
if: ${{ matrix.backend == 'tensorflow' }} | |
run: | | |
python -m pytest tests/ -n auto -v -m "not (jax or numpy or torch)" | |
- name: Run PyTorch Tests | |
if: ${{ matrix.backend == 'torch' }} | |
run: | | |
python -m pytest tests/ -n auto -v -m "not (jax or numpy or tensorflow)" |