Skip to content

Include statment in NESTML #2322

Include statment in NESTML

Include statment in NESTML #2322

Workflow file for this run

name: NESTML build
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
link_checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Link Checker
uses: lycheeverse/lychee-action@v2.1.0
with:
args: --verbose --no-progress **/*.md **/*.html **/*.rst
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
static_checks:
runs-on: ubuntu-latest
steps:
# Checkout the repository contents
- name: Checkout NESTML code
uses: actions/checkout@v4
# Setup Python version
- name: Setup Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
# Install dependencies
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install python3-all-dev
# Install Python dependencies
- name: Python dependencies
run: |
python -m pip install --upgrade pycodestyle
python -m pip install -r requirements.txt
# Static code analysis
- name: Static code style analysis
run: |
python3 extras/codeanalysis/check_copyright_headers.py && python3 -m pycodestyle $GITHUB_WORKSPACE -v --ignore=E241,E501,E714,E713,E714,E252,W503 --exclude=$GITHUB_WORKSPACE/doc,$GITHUB_WORKSPACE/.git,$GITHUB_WORKSPACE/NESTML.egg-info,$GITHUB_WORKSPACE/pynestml/generated,$GITHUB_WORKSPACE/extras,$GITHUB_WORKSPACE/build,$GITHUB_WORKSPACE/.github
build_and_test_py_standalone:
needs: [static_checks]
runs-on: ubuntu-latest
steps:
# Checkout the repository contents
- name: Checkout NESTML code
uses: actions/checkout@v4
# Setup Python version
- name: Setup Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
# Install dependencies
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libgsl0-dev libncurses5-dev pkg-config
sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3
# Install Python dependencies
- name: Python dependencies
run: |
python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy
python -m pip install -r requirements.txt
# Install Java
- name: Install Java 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11.0.x'
java-package: jre
# Install Antlr4
- name: Install Antlr4
run: |
wget http://www.antlr.org/download/antlr-4.13.1-complete.jar
echo \#\!/bin/bash > antlr4
echo java -cp \"`pwd`/antlr-4.13.1-complete.jar:$CLASSPATH\" org.antlr.v4.Tool \"\$@\" >> antlr4
echo >> antlr4
chmod +x antlr4
echo PATH=$PATH:`pwd` >> $GITHUB_ENV
# Install NESTML
- name: Install NESTML
run: |
export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.9/site-packages
#echo PYTHONPATH=`pwd` >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
python setup.py install
- name: Generate Lexer and Parser using Antlr4
run: |
cd pynestml/grammars
./generate_lexer_parser
# Run integration tests
- name: Run integration tests
run: |
rc=0
for fn in $GITHUB_WORKSPACE/tests/python_standalone_tests/*.py; do
pytest -s -o log_cli=true -o log_cli_level="DEBUG" ${fn} || rc=1
done;
exit $rc
build_and_test_nest_desktop:
needs: [static_checks]
runs-on: ubuntu-latest
strategy:
matrix:
nest_branch: [ "master" ]
fail-fast: false
steps:
# Checkout the repository contents
- name: Checkout NESTML code
uses: actions/checkout@v4
# Setup Python version
- name: Setup Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
# Install dependencies
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libgsl0-dev libncurses5-dev pkg-config libltdl-dev
sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3
# Install Python dependencies
- name: Python dependencies
run: |
python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy
python -m pip install -r requirements.txt
- name: NEST simulator
run: |
python -m pip install cython
echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE"
NEST_SIMULATOR=$(pwd)/nest-simulator
NEST_INSTALL=$(pwd)/nest_install
echo "NEST_SIMULATOR = $NEST_SIMULATOR"
echo "NEST_INSTALL = $NEST_INSTALL"
git clone --depth=1 https://github.com/nest/nest-simulator --branch ${{ matrix.nest_branch }}
mkdir nest_install
echo "NEST_INSTALL=$NEST_INSTALL" >> $GITHUB_ENV
cd nest_install
cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL $NEST_SIMULATOR
make && make install
cd ..
# Install NESTML
- name: Install NESTML
run: |
export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.9/site-packages
#echo PYTHONPATH=`pwd` >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
python setup.py install
# Run integration tests
- name: Run integration tests
run: |
rc=0
for fn in $GITHUB_WORKSPACE/tests/nest_desktop_tests/*.py; do
pytest -s -o log_cli=true -o log_cli_level="DEBUG" ${fn} || rc=1
done;
exit $rc
build_and_test_nest:
needs: [static_checks]
runs-on: ubuntu-latest
strategy:
matrix:
nest_branch: ["v2.20.2", "v3.0", "v3.8", "master"]
fail-fast: false
steps:
# Checkout the repository contents
- name: Checkout NESTML code
uses: actions/checkout@v4
# Setup Python version
- name: Setup Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
# Install dependencies
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libltdl-dev libgsl0-dev libncurses5-dev libreadline6-dev pkg-config
sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3
# Install Python dependencies
- name: Python dependencies
run: |
python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy pandas
python -m pip install -r requirements.txt
# Install Java
- name: Install Java 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11.0.x'
java-package: jre
# Install Antlr4
- name: Install Antlr4
run: |
wget http://www.antlr.org/download/antlr-4.13.1-complete.jar
echo \#\!/bin/bash > antlr4
echo java -cp \"`pwd`/antlr-4.13.1-complete.jar:$CLASSPATH\" org.antlr.v4.Tool \"\$@\" >> antlr4
echo >> antlr4
chmod +x antlr4
echo PATH=$PATH:`pwd` >> $GITHUB_ENV
# Install NEST simulator
- name: NEST simulator
run: |
python -m pip install cython
echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE"
NEST_SIMULATOR=$(pwd)/nest-simulator
NEST_INSTALL=$(pwd)/nest_install
echo "NEST_SIMULATOR = $NEST_SIMULATOR"
echo "NEST_INSTALL = $NEST_INSTALL"
git clone --depth=1 https://github.com/nest/nest-simulator --branch ${{ matrix.nest_branch }}
mkdir nest_install
echo "NEST_INSTALL=$NEST_INSTALL" >> $GITHUB_ENV
cd nest_install
cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL $NEST_SIMULATOR
make && make install
cd ..
# Install NESTML (repeated)
- name: Install NESTML
run: |
export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.9/site-packages
#echo PYTHONPATH=`pwd` >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
python setup.py install
- name: Generate Lexer and Parser using Antlr4
run: |
cd pynestml/grammars
./generate_lexer_parser
# Unit tests
- name: Run unit tests
run: |
pytest -s -o norecursedirs='*' -o log_cli=true -o log_cli_level="DEBUG" tests
# Integration tests: prepare (make module containing all NESTML models)
- name: Setup integration tests
run: |
# exclude third factor plasticity models; these will only compile successfully if code generation is as a neuron+synapse pair
export ALL_MODEL_FILENAMES=`find models/neurons -name "*.nestml" | paste -sd " "`
echo $ALL_MODEL_FILENAMES
echo "NEST_INSTALL = ${{ env.NEST_INSTALL }}"
echo "NEST_VERSION = ${{ matrix.nest_branch }}"
sed -i 's|%NEST_PATH%|${{ env.NEST_INSTALL }}|' tests/nest_tests/resources/nest_codegen_opts.json
sed -i 's|%NEST_VERSION%|${{ matrix.nest_branch }}|' tests/nest_tests/resources/nest_codegen_opts.json
nestml --input_path $ALL_MODEL_FILENAMES --target_path target --suffix _nestml --logging_level INFO --module_name nestml_allmodels_module --codegen_opts tests/nest_tests/resources/nest_codegen_opts.json
# Integration tests
- name: Run integration tests
if: ${{ matrix.nest_branch == 'master' || matrix.nest_branch == 'v2.20.2' }}
env:
LD_LIBRARY_PATH: ${{ env.NEST_INSTALL }}/lib/nest
run: |
rc=0
for fn in $GITHUB_WORKSPACE/tests/nest_tests/*.py; do
pytest -s -o log_cli=true -o log_cli_level="DEBUG" ${fn} || rc=1
done;
exit $rc
# Run only the nest integration tests for NEST versions other than master and 2.20.2
- name: Run integration tests
if: ${{ !(matrix.nest_branch == 'master' || matrix.nest_branch == 'v2.20.2') }}
env:
LD_LIBRARY_PATH: ${{ env.NEST_INSTALL }}/lib/nest
run: |
pytest -s -o log_cli=true -o log_cli_level="DEBUG" tests/nest_tests/nest_integration_test.py
# Run IPython/Jupyter notebooks
- name: Run Jupyter notebooks
if: ${{ matrix.nest_branch == 'master' }}
run: |
ipynb_fns=$(find $GITHUB_WORKSPACE/doc/tutorials -name '*.ipynb')
rc=0
for fn in $ipynb_fns; do
echo "Now running Jupyter notebook: ${fn}"
cd `dirname ${fn}`
ipython3 ${fn}
if [ $? -ne 0 ]; then
echo "Error running Jupyter notebook: ${fn}"
rc=1
fi
done;
cd $GITHUB_WORKSPACE
exit $rc
build_and_test_nest_compartmental:
needs: [static_checks]
runs-on: ubuntu-latest
strategy:
matrix:
nest_branch: ["master"]
fail-fast: false
steps:
# Checkout the repository contents
- name: Checkout NESTML code
uses: actions/checkout@v4
# Setup Python version
- name: Setup Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
# Install dependencies
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libltdl-dev libgsl0-dev libncurses5-dev libreadline6-dev pkg-config
sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3
# Install Python dependencies
- name: Python dependencies
run: |
python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy pandas
python -m pip install -r requirements.txt
# Install NEST simulator
- name: NEST simulator
run: |
python -m pip install cython
echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE"
NEST_SIMULATOR=$(pwd)/nest-simulator
NEST_INSTALL=$(pwd)/nest_install
echo "NEST_SIMULATOR = $NEST_SIMULATOR"
echo "NEST_INSTALL = $NEST_INSTALL"
git clone --depth=1 https://github.com/nest/nest-simulator --branch ${{ matrix.nest_branch }}
mkdir nest_install
echo "NEST_INSTALL=$NEST_INSTALL" >> $GITHUB_ENV
cd nest_install
cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL $NEST_SIMULATOR
make && make install
cd ..
# Install NESTML (repeated)
- name: Install NESTML
run: |
export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.9/site-packages
#echo PYTHONPATH=`pwd` >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
python setup.py install
# Integration tests
- name: Run integration tests
env:
LD_LIBRARY_PATH: ${{ env.NEST_INSTALL }}/lib/nest
run: |
rc=0
for fn in $GITHUB_WORKSPACE/tests/nest_compartmental_tests/*.py; do
pytest -s -o log_cli=true -o log_cli_level="DEBUG" ${fn} || rc=1
done;
exit $rc