test both tensorflow and torch #258
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: CI | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { BACKEND: torch, BACKEND_VER: 2.1.0, PAPER_MODELS: true, ALLOW_FAILURE: false } | |
- { BACKEND: torch, BACKEND_VER: 2.1.0, PAPER_MODELS: false, ALLOW_FAILURE: false } | |
- { BACKEND: tensorflow, BACKEND_VER: 2.15.0, PAPER_MODELS: true, ALLOW_FAILURE: false } | |
- { BACKEND: tensorflow, BACKEND_VER: 2.15.0, PAPER_MODELS: false, ALLOW_FAILURE: false } | |
env: | |
SDSS_LOCAL_SAS_MIRROR: ./ci_data/ | |
GAIA_TOOLS_DATA: ./ci_data/ | |
LASMOT_DR5_DATA: ./ci_data/ | |
KERAS_BACKEND: ${{ matrix.BACKEND }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
pip install ${{ matrix.BACKEND }}~=${{ matrix.BACKEND_VER }} | |
pip install keras coveralls pydot graphviz pytest pytest-cov | |
pip install . | |
- name: Cache test data | |
uses: actions/cache@v3 | |
with: | |
path: ${{github.workspace}}/ci_data/ | |
key: astronn-${{ runner.os }}-${{ matrix.BACKEND_VER }}-${{ matrix.PAPER_MODELS }}-2023april30 | |
- name: Test astroNN | |
continue-on-error: ${{ matrix.ALLOW_FAILURE }} | |
if: ${{ matrix.PAPER_MODELS == false}} | |
# Run almost all tests for latest config | |
run: > | |
python -m pytest --cov astroNN --cov-report=xml tests/test_numpy_tools.py tests/test_loss_func.py | |
tests/test_layers.py tests/test_apogee_tools.py tests/test_datasets.py tests/test_gaia_tools.py | |
tests/test_lamost_tools.py tests/test_models.py tests/test_utilities.py tests/test_neuralODE.py | |
--disable-pytest-warnings | |
# Run papers models test | |
- name: Test paper models | |
continue-on-error: ${{ matrix.ALLOW_FAILURE }} | |
if: ${{ matrix.PAPER_MODELS == true}} | |
run: > | |
python -m pytest --cov astroNN --cov-report=xml tests/test_apogee_model.py tests/test_paper_models.py | |
--disable-pytest-warnings | |
- name: Upload coverage reports to Codecov | |
continue-on-error: ${{ matrix.ALLOW_FAILURE }} | |
uses: codecov/codecov-action@v3 | |
env: | |
BACKEND: ${{ matrix.BACKEND }} | |
BACKEND_VER: ${{ matrix.BACKEND_VER }} | |
PAPER_MODELS: ${{ matrix.PAPER_MODELS }} | |
with: | |
flags: unittests | |
env_vars: BACKEND, BACKEND_VER, PAPER_MODELS | |
name: codecov-astroNN | |
fail_ci_if_error: true | |
verbose: true |