-
-
Notifications
You must be signed in to change notification settings - Fork 51
59 lines (49 loc) · 1.61 KB
/
examples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Examples
on:
workflow_dispatch:
schedule: # Run once a week to detect any regressions
- cron: '0 0 * * 1'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: [
"Basic/example.py",
"Basic/example_decorators.py",
"Basic/example_parallelization.py",
"Basic/sensitivity_analysis.py",
"Basic/dps_example.py",
"Eijgenraam/eijgenraam.py",
"Languages/Python/lakeModelInPython.py",
"Languages/R/lakeModelInR.py",
#"Languages/Excel/lakeModelInExcel.py" # requires Windows
"Languages/C/lakeModelInC.py"]
steps:
- uses: actions/checkout@v4
- name: Get minimum Python version
run: |
PYTHON_VERSION=$(cat pyproject.toml | grep "requires-python" | grep -Eo "[0-9]+\.[0-9]+")
echo "PYTHON_VERSION=${PYTHON_VERSION}" >> $GITHUB_ENV
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
- name: Install dependencies
run: |
sudo apt update
suto apt install -y graphviz r-base
pip install .[test]
- name: Run example
run: |
EXAMPLE="examples/${{ matrix.example }}"
EXAMPLE_DIR=$(dirname "${EXAMPLE}")
EXAMPLE_FILE=$(basename "${EXAMPLE}")
pushd "${EXAMPLE_DIR}"
if [ -f "Makefile" ]; then
make
fi
LD_LIBRARY_PATH="$(pwd):${LD_LIBRARY_PATH}"
python "${EXAMPLE_FILE}"