From 96b8c0b224bcb281d1d8a3eb1a23118200271507 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Tue, 19 Mar 2024 14:27:50 +0100 Subject: [PATCH] Various CI fixes (#62) * Use the requirement files for installation of python packages * Use ci_requirements.txt only if it exists * Install also the required python packages for NMODL * Use MacOS 13 instead of 11 * Make sure that setuptools are installed for Python12 support * Recursively initialize submodules to include mod2c in macos-13 * Run CI on PRs on non-Mondays * Test latest release only on pushes to main and any PR * Add workaround for Brew packages --------- Co-authored-by: Goran Jelic-Cizmek --- .github/workflows/build-neuron.yml | 12 ++++++++---- scripts/buildNeuron.sh | 13 +++++++++++-- scripts/install_macOS.sh | 3 +++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-neuron.yml b/.github/workflows/build-neuron.yml index c272ad5..5d85844 100644 --- a/.github/workflows/build-neuron.yml +++ b/.github/workflows/build-neuron.yml @@ -2,6 +2,9 @@ name: Scheduled NEURON CI on: push: + branches: + - main + pull_request: schedule: # Run at 2am every day - cron: '0 2 * * *' @@ -44,9 +47,10 @@ jobs: then # If we're not told to test a specific branch, test the default branch with neuron-nightly wheels values="{\"branch_or_tag\": \"\", \"default_wheel\": \"neuron-nightly\"}" - if [[ $(date +%u) == 1 ]] + if [[ $(date +%u) == 1 ]] || [[ ${{ github.event_name }} == 'pull_request' ]] || [[ ${{ github.event_name }} == 'push' ]] then # If it's a Monday, test the latest release (and latest released wheels) in addition + # Also test it on any PR, and any push to a PR tag_name="${{steps.get_latest_release.outputs.tag_name}}" values="${values}, {\"branch_or_tag\": \"${tag_name}\", \"default_wheel\": \"neuron==${tag_name}\"}" fi @@ -74,10 +78,10 @@ jobs: strategy: matrix: os: + # GitHub Actions MacOS 13 runner + - { vm: macos-13, flavour: macOS } # GitHub Actions MacOS 12 runner - { vm: macos-12, flavour: macOS } - # GitHub Actions MacOS 11 runner - - { vm: macos-11, flavour: macOS } # CentOS7 Docker image - { vm: ubuntu-latest, container: "centos:7", flavour: redhat } # CentOS Stream 8 Docker image @@ -136,7 +140,7 @@ jobs: if [ -n "${branch_or_tag}" ]; then BRANCH_OPT="--branch=${branch_or_tag}"; fi git clone --depth=1 --single-branch ${BRANCH_OPT} ${{github.server_url}}/${{github.repository_owner}}/nrn # Init submodules for testing purposes - cd nrn && git submodule update --init + cd nrn && git submodule update --init --recursive # When we run in Ubuntu/Fedora/Debian containers from Docker Hub then we # are root. This is different from when we use the GitHub Actions images diff --git a/scripts/buildNeuron.sh b/scripts/buildNeuron.sh index 042eea0..77e96b5 100755 --- a/scripts/buildNeuron.sh +++ b/scripts/buildNeuron.sh @@ -25,8 +25,17 @@ export PYTHON=$(command -v python) export PYTHONPATH=$(${PYTHON} -c 'import site; print(":".join(site.getsitepackages()))') # Install extra dependencies for NEURON into the virtual environment. -pip install --upgrade bokeh "cython<3" ipython matplotlib mpi4py numpy pytest \ - pytest-cov scikit-build sympy +pip install --upgrade -r nrn_requirements.txt +if [[ -f ci_requirements.txt ]]; then + pip install --upgrade -r ci_requirements.txt +else + pip install --upgrade plotly "ipywidgets>=7.0.0" +fi +if [[ -f external/nmodl/requirements.txt ]]; then + pip install --upgrade -r external/nmodl/requirements.txt +fi +# Needed for installation of older NEURON versions with Python 12 +pip install --upgrade setuptools # Set default compilers, but don't override preset values export CC=${CC:-gcc} diff --git a/scripts/install_macOS.sh b/scripts/install_macOS.sh index 17d0330..adafa65 100755 --- a/scripts/install_macOS.sh +++ b/scripts/install_macOS.sh @@ -1,3 +1,6 @@ +set -eux +export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 +export HOMEBREW_NO_INSTALL_UPGRADE=1 brew install bison boost coreutils flex mpich ninja xz wget brew unlink mpich brew install openmpi