Remove units when parsing CVODE statements #3315
Workflow file for this run
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: NMODL CI | |
concurrency: | |
group: ${{ github.workflow }}#${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- master | |
- release/** | |
pull_request: | |
branches: | |
- master | |
- release/** | |
env: | |
PYTHON_VERSION: 3.9 | |
DESIRED_CMAKE_VERSION: 3.15.0 | |
jobs: | |
ci: | |
runs-on: ${{matrix.config.os}} | |
name: ${{toJson(matrix.config)}} | |
strategy: | |
matrix: | |
include: | |
- config: | |
os: ubuntu-20.04 | |
- config: | |
flag_warnings: ON | |
glibc_asserts: ON | |
os: ubuntu-22.04 | |
- config: | |
os: macos-13 | |
- config: | |
os: macos-14 | |
- config: | |
os: windows-latest | |
# TODO: might be interesting to add the thread sanitizer too | |
- config: | |
os: ubuntu-22.04 | |
# Hyphens here will be replaced with commas before the value is | |
# passed to NMODL_SANITIZERS | |
sanitizer: address-leak | |
- config: | |
os: ubuntu-22.04 | |
enable_usecases: On | |
update_references: On | |
- config: | |
flag_warnings: ON | |
os: ubuntu-22.04 | |
sanitizer: undefined | |
fail-fast: true | |
steps: | |
- name: Fix kernel mmap rnd bits | |
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with | |
# high-entropy ASLR in much newer kernels that GitHub runners are | |
# using leading to random crashes: https://reviews.llvm.org/D148280 | |
run: sudo sysctl vm.mmap_rnd_bits=28 | |
if: matrix.config.os == 'ubuntu-22.04' | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: ${{ env.DESIRED_CMAKE_VERSION }} | |
- name: Install homebrew packages | |
if: startsWith(matrix.config.os, 'macOS') | |
run: | | |
brew install [email protected] || true | |
brew link --overwrite [email protected] | |
brew install ccache coreutils bison boost flex ninja | |
echo /usr/local/opt/flex/bin:/usr/local/opt/bison/bin:/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/bison/bin >> $GITHUB_PATH | |
# Taken from https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
echo CMAKE_BUILD_PARALLEL_LEVEL=3 >> $GITHUB_ENV | |
shell: bash | |
- name: Install apt packages | |
if: startsWith(matrix.config.os, 'ubuntu') | |
run: | | |
sudo apt-get install bison ccache flex libfl-dev ninja-build python3-dev python3-pip | |
# Taken from https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
echo CMAKE_BUILD_PARALLEL_LEVEL=2 >> $GITHUB_ENV | |
shell: bash | |
- name: Install choco packages | |
if: startsWith(matrix.config.os, 'windows') | |
run: | | |
choco install winflexbison3 | |
- name: Configure VS Toolchain (Windows) | |
if: startsWith(matrix.config.os, 'windows') | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Set up Python3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: actions/checkout@v4 | |
- name: Install Python3 dependencies | |
working-directory: ${{runner.workspace}}/nmodl | |
run: | | |
python3 -m pip install -U pip setuptools | |
python3 -m pip install --user -r requirements.txt | |
- name: Install neuron-nightly | |
if: ${{matrix.config.enable_usecases == 'On'}} | |
run: | | |
python3 -m pip install neuron-nightly | |
- name: Register compiler warning problem matcher | |
if: ${{matrix.config.flag_warnings == 'ON'}} | |
run: echo "::add-matcher::.github/problem-matchers/gcc.json" | |
- name: Register sanitizer problem matcher | |
if: ${{matrix.config.sanitizer}} | |
run: echo "::add-matcher::.github/problem-matchers/${{matrix.config.sanitizer}}.json" | |
- name: Configure Windows | |
if: startsWith(matrix.config.os, 'windows') | |
run: | | |
cmake -S . -B build -DFLEX_INCLUDE_PATH=C:/ProgramData/chocolatey/lib/winflexbison3/tools -DBUILD_SHARED_LIBS=OFF | |
- name: Configure Linux/MacOS | |
if: ${{ !startsWith(matrix.config.os, 'windows') }} | |
shell: bash | |
working-directory: ${{runner.workspace}}/nmodl | |
run: | | |
echo "------- Configure -------" | |
cmake_args=(-G Ninja | |
-DPYTHON_EXECUTABLE=$(which python3) \ | |
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR) | |
if [[ -n "${{matrix.config.flag_warnings}}" ]]; then | |
cmake_args+=(-DNMODL_EXTRA_CXX_FLAGS="-Wall \ | |
-Wno-reorder \ | |
-Wno-unknown-pragmas \ | |
-Wno-sign-compare \ | |
-Wno-overloaded-virtual") | |
fi | |
if [[ -n "${{matrix.config.enable_usecases}}" ]]; then | |
cmake_args+=(-DNMODL_ENABLE_USECASES=${{matrix.config.enable_usecases}}) | |
fi | |
if [[ -n "${{matrix.config.sanitizer}}" ]]; then | |
cmake_args+=(-DCMAKE_BUILD_TYPE=Custom \ | |
-DCMAKE_CXX_FLAGS="-O1 -g" \ | |
-DNMODL_SANITIZERS=$(echo ${{matrix.config.sanitizer}} | sed -e 's/-/,/g')) | |
CXX=$(command -v clang++-14) | |
else | |
CXX=${CXX:-g++} | |
if [[ -n "${{matrix.config.glibc_asserts}}" ]]; then | |
cmake_args+=(-DCMAKE_BUILD_TYPE=Debug \ | |
-DCMAKE_CXX_FLAGS=-D_GLIBCXX_DEBUG) | |
fi | |
fi | |
cmake_args+=(-DCMAKE_CXX_COMPILER=${CXX} \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache) | |
cmake_args+=(-DNMODL_ENABLE_BACKWARD=On) | |
cmake -B build -S . "${cmake_args[@]}" | |
env: | |
INSTALL_DIR: ${{ runner.workspace }}/install | |
- name: Dump config dictionary | |
if: ${{ !startsWith(matrix.config.os, 'windows') }} | |
run: | | |
cat << EOF > matrix.json | |
${{toJSON(matrix.config)}} | |
EOF | |
echo matrix.config JSON: | |
cat matrix.json | |
echo ----- | |
- name: Restore compiler cache | |
if: ${{ !startsWith(matrix.config.os, 'windows') }} | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{runner.workspace}}/ccache | |
key: ${{hashfiles('matrix.json')}}-${{github.ref}}-${{github.sha}} | |
restore-keys: | | |
${{hashfiles('matrix.json')}}-${{github.ref}}- | |
${{hashfiles('matrix.json')}}- | |
save-always: true | |
- name: Build Windows | |
if: startsWith(matrix.config.os, 'windows') | |
run: | | |
cmake --build build --verbose | |
- name: Build Linux/MacOS | |
if: ${{ !startsWith(matrix.config.os, 'windows') }} | |
shell: bash | |
working-directory: ${{runner.workspace}}/nmodl | |
env: | |
CCACHE_BASEDIR: ${{runner.workspace}}/nmodl | |
CCACHE_DIR: ${{runner.workspace}}/ccache | |
PYTHONMALLOC: malloc | |
run: | | |
if ccache --version | grep -E '^ccache version 4\.(4|4\.1)$' | |
then | |
echo "------- Disable ccache direct mode -------" | |
# https://github.com/ccache/ccache/issues/935 | |
export CCACHE_NODIRECT=1 | |
fi | |
echo "------- Building -------" | |
ccache -z | |
# Older versions don't support -v (verbose) | |
ccache -vs 2>/dev/null || ccache -s | |
cmake --build build --verbose | |
ccache -vs 2>/dev/null || ccache -s | |
- name: Test | |
shell: bash | |
working-directory: ${{runner.workspace}}/nmodl/build | |
env: | |
PYTHONMALLOC: malloc | |
run: | | |
ctest --output-on-failure --parallel 4 | |
- name: Install | |
shell: bash | |
working-directory: ${{runner.workspace}}/nmodl | |
run: | | |
cmake --install build | |
- name: Update references | |
if: matrix.config.update_references == 'On' | |
shell: bash | |
working-directory: ${{runner.workspace}}/nmodl/test/usecases | |
run : | | |
export PATH="${INSTALL_DIR}/bin:${PATH}" | |
export PYTHONPATH="${INSTALL_DIR}/lib:${PYTHONPATH}" | |
for d in */ | |
do | |
./generate_references.py nmodl "$d" "$OUTPUT_DIR/$d" | |
done | |
cd $OUTPUT_DIR | |
tar cf ../references.tar * | |
env: | |
INSTALL_DIR: ${{ runner.workspace }}/install | |
OUTPUT_DIR: ${{ runner.workspace }}/references | |
- uses: actions/upload-artifact@v4 | |
if: matrix.config.update_references == 'On' | |
with: | |
name: references | |
path: ${{runner.workspace}}/references.tar | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ctest-results-${{hashfiles('matrix.json')}} | |
path: ${{runner.workspace}}/nmodl/build/Testing/*/Test.xml | |
# This step will set up an SSH connection on tmate.io for live debugging. | |
# To enable it, you have to: | |
# * add 'live-debug-tests' to your PR title | |
# * push something to your PR branch (note that just re-running disregards the title update) | |
- name: live debug session on failure (manual steps required, check `nmodl-ci.yml`) | |
if: failure() && contains(github.event.pull_request.title, 'live-debug-tests') | |
uses: mxschmitt/action-tmate@v3 | |
timeout-minutes: 60 | |
commit-references: | |
runs-on: ubuntu-latest | |
needs: ci | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: references | |
path: ${{runner.workspace}}/ | |
- name: Check out nmodl-references | |
uses: actions/checkout@v4 | |
with: | |
repository: BlueBrain/nmodl-references | |
token: ${{ secrets.NMODL_REFERENCES_ACCESS_TOKEN }} | |
- name: Update references | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
# If not a PR, then `pr_number` is the branch name. | |
if [[ ${{ github.event_name }} == "pull_request" ]] | |
then | |
pr_number="$(echo ${GITHUB_REF_NAME} | sed "s/^\([0-9]*\)\/merge/\1/")" | |
nmodl_desc=https://github.com/BlueBrain/nmodl/pull/${pr_number} | |
branch="nmodl-${pr_number}" | |
else | |
nmodl_desc="nmodl@${GITHUB_SHA}" | |
branch="main" | |
fi | |
git fetch | |
git checkout ${branch} 2>/dev/null || git checkout -b ${branch} | |
for d in */ | |
do | |
rm -rf "$d" | |
done | |
tar xf ${{ runner.workspace }}/references.tar | |
git add . | |
git commit --allow-empty -m "References for '${nmodl_desc}'." | |
git push 2>/dev/null || git push --set-upstream origin ${branch} | |