no need to check dimension each time a data generator generate a batch #457
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.4.0, PAPER_MODELS: true, ALLOW_FAILURE: true } | |
- { BACKEND: torch, PAPER_MODELS: false, ALLOW_FAILURE: false } | |
# - { BACKEND: tensorflow, BACKEND_VER: 2.17.0, PAPER_MODELS: true, ALLOW_FAILURE: true } | |
- { BACKEND: tensorflow, PAPER_MODELS: false, ALLOW_FAILURE: false } | |
# - { BACKEND: jax, BACKEND_VER: 0.4.30, PAPER_MODELS: true, ALLOW_FAILURE: true } | |
# - { BACKEND: jax, BACKEND_VER: 0.4.30, PAPER_MODELS: false, ALLOW_FAILURE: true } | |
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" | |
cache: 'pip' # caching pip dependencies | |
- name: Install dependencies | |
run: | | |
sudo apt-get install graphviz | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
# if [ "$(which nvidia-smi)" == "" ] && [ "${BACKEND}" == "torch" ]; then pip install torch~=${{ matrix.BACKEND_VER }} --index-url https://download.pytorch.org/whl/cpu; else pip install ${{ matrix.BACKEND }}~=${{ matrix.BACKEND_VER }}; fi | |
pip install -r requirements-${{ matrix.BACKEND }}.txt | |
pip install . | |
- name: Get Backend version | |
run: | | |
echo "BACKEND_VER=$(python -c 'import os; import importlib; print(importlib.import_module(os.environ["KERAS_BACKEND"]).__version__.split("+")[0])')" >> $GITHUB_ENV | |
echo "KERAS_VER=$(python -c 'import keras; print(keras.__version__)')" >> $GITHUB_ENV | |
- name: Cache test data | |
uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/ci_data/ | |
key: astronn-${{ runner.os }}-${{ env.BACKEND_VER }}-${{ matrix.PAPER_MODELS }} | |
- 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 -v --cov astroNN --junitxml=junit.xml --doctest-glob="*.rst" --doctest-continue-on-failure ./docs/source/ 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_apogee_model.py tests/test_models.py tests/test_utilities.py tests/test_neuralODE.py | |
# Run papers models test | |
- name: Test paper models | |
continue-on-error: ${{ matrix.ALLOW_FAILURE }} | |
if: ${{ matrix.PAPER_MODELS == true}} | |
run: > | |
python -m pytest -v --cov astroNN --doctest-glob="*.rst" --junitxml=junit.xml tests/test_paper_models.py | |
- name: Upload coverage reports to Codecov | |
continue-on-error: ${{ matrix.ALLOW_FAILURE }} | |
uses: codecov/codecov-action@v4 | |
env: | |
BACKEND: ${{ matrix.BACKEND }} | |
KERAS_VER: ${{ env.KERAS_VER }} | |
BACKEND_VER: ${{ env.BACKEND_VER }} | |
PAPER_MODELS: ${{ matrix.PAPER_MODELS }} | |
with: | |
flags: unittests | |
env_vars: BACKEND, KERAS_VER, BACKEND_VER, PAPER_MODELS | |
name: codecov-astroNN | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |