Skip to content

Commit

Permalink
Add integration test for PROTEUS (#149)
Browse files Browse the repository at this point in the history
* Fix missing font issue

* Add integration test

* Install MORS, JANUS, SOCRATES

* Add socrates dependencies

* Download frostflow

* Download SOCRATES

* Pre-download all files

* Fix mors: command not found

* Fix mors: command not found

* Add sanity check

* Switch JANUS/MORS install order

* Try entire workflow

* Fix env var

* Download SPIDER

* Build SPIDER

* Set PETSC_DIR

* Try other PETSC_DIR

* Fix make command

* Avoid installing petsc/spider

* Fix skip

* Trigger workflow

* Add comment to tests
  • Loading branch information
stefsmeets authored Aug 27, 2024
1 parent 851fc7c commit fa0363a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 6 deletions.
55 changes: 50 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ jobs:
matrix:
python-version: ['3.10']

env:
FWL_DATA: /home/runner/work/fwl_data
RAD_DIR: ./SOCRATES
SOCRATES: ./SOCRATES # https://github.com/FormingWorlds/JANUS/issues/51

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
submodules: 'false'

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand All @@ -44,17 +49,57 @@ jobs:
run: |
python -m pip install -e .[develop]
- name: Install JANUS+MORS
run: |
python -m pip install git+https://github.com/FormingWorlds/MORS
python -m pip install git+https://github.com/FormingWorlds/JANUS
- name: Setup system for SOCRATES
run: |
sudo apt-get update
sudo apt-get install libnetcdff-dev netcdf-bin
- name: Get SOCRATES
uses: actions/checkout@v4
with:
repository: 'FormingWorlds/SOCRATES'
path: 'SOCRATES'

- uses: actions/cache@v3
id: cache-socrates
with:
path: |
SOCRATES/bin
SOCRATES/sbin
SOCRATES/set_rad_env
key: socrates-${{ hashFiles('SOCRATES/version') }}

- name: Build SOCRATES
if: steps.cache-socrates.outputs.cache-hit != 'true'
run: |
export LD_LIBRARY_PATH=""
cd SOCRATES
./configure
./build_code
cd ..
- uses: actions/cache@v3
id: cache-fwl-data
with:
path: /home/runner/work/fwl_data
key: fwl-data-1
path: ${{ env.FWL_DATA }}
key: fwl-data-2

- name: Pre-download fwl data
if: steps.cache-fwl-data.cache-hit != 'true'
run: |
mors download all
janus download stellar
janus download spectral
janus download spectral -n Frostflow -b 48
- name: Test with pytest
run: |
source PROTEUS.env
export FWL_DATA="/home/runner/work/fwl_data"
export RAD_DIR="./SOCRATES"
coverage run -m pytest
- name: Report coverage
Expand Down
2 changes: 1 addition & 1 deletion src/proteus/utils/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def set_properties( self, nrows, ncols, width, height ):
# Set main font properties
font_d = {
'size': 10.0,
'family': ['Arial','sans-serif']
'family': ['sans-serif']
}

# fonts = fm.findSystemFonts(fontpaths=None, fontext='ttf')
Expand Down
29 changes: 29 additions & 0 deletions tests/integration/test_proteus_start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from __future__ import annotations

import os
from pathlib import Path

import pytest
from helpers import PROTEUS_ROOT

from proteus import Proteus

if os.getenv('CI'):
# https://github.com/FormingWorlds/PROTEUS/pull/149
pytest.skip(reason='No way of currently testing this on the CI.', allow_module_level=True)


def test_dummy_run():
config_path = PROTEUS_ROOT / 'input' / 'dummy.toml'

runner = Proteus(config_path=config_path)

runner.config['log_level'] = 'WARNING'
runner.config['plot_iterfreq'] = 0
runner.config['iter_max'] = 0

runner.start()

output = Path(runner.directories['output'])

assert 'Completed' in (output / 'status').read_text()

0 comments on commit fa0363a

Please sign in to comment.