From 938c3f2f13274d1861d36acf1240e5f40af0510a Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Tue, 15 Oct 2024 11:11:19 +0200 Subject: [PATCH 01/19] EXTERNAL can't refer to NEURON internals. --- docs/nmodl/mod/variabletypes.mod | 6 ------ share/examples/nrniv/nmodl/tstextrn.hoc | 4 ---- share/examples/nrniv/nmodl/tstextrn.mod | 7 +------ 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/docs/nmodl/mod/variabletypes.mod b/docs/nmodl/mod/variabletypes.mod index 9f95ff4d04..f25aa3c5df 100755 --- a/docs/nmodl/mod/variabletypes.mod +++ b/docs/nmodl/mod/variabletypes.mod @@ -8,7 +8,6 @@ NEURON { RANGE range_var, parameter_var POINTER p1 BBCOREPOINTER my_data : changed from POINTER - EXTERNAL clamp_resist : } PARAMETER { @@ -20,17 +19,12 @@ ASSIGNED { range_var p1 my_data - clamp_resist } INITIAL { range_var = 42 } -FUNCTION cr() (megohm) { - cr = clamp_resist -} - FUNCTION f1() { if (nrn_pointing(p1)) { f1 = p1 diff --git a/share/examples/nrniv/nmodl/tstextrn.hoc b/share/examples/nrniv/nmodl/tstextrn.hoc index 591c265a20..a95c8d0137 100755 --- a/share/examples/nrniv/nmodl/tstextrn.hoc +++ b/share/examples/nrniv/nmodl/tstextrn.hoc @@ -1,7 +1,3 @@ -cr_tstextrn() -clamp_resist=100 -cr_tstextrn() - eps_tstextrn() eps_IntFire4 = 1.2 eps_tstextrn() diff --git a/share/examples/nrniv/nmodl/tstextrn.mod b/share/examples/nrniv/nmodl/tstextrn.mod index 4e034f5b22..b5049132ee 100755 --- a/share/examples/nrniv/nmodl/tstextrn.mod +++ b/share/examples/nrniv/nmodl/tstextrn.mod @@ -8,18 +8,13 @@ : in intfire4.mod NEURON { - EXTERNAL clamp_resist, eps_IntFire4 + EXTERNAL eps_IntFire4 } ASSIGNED { - clamp_resist (megohm) eps_IntFire4 } -FUNCTION cr() (megohm) { - cr = clamp_resist -} - FUNCTION eps() { eps = eps_IntFire4 } From cafa37f40211957b1e9e3f60d3ce5b26f615b286 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 1 Nov 2024 15:02:29 +0100 Subject: [PATCH 02/19] Squash it all --- .circleci/config.yml | 106 ------- .github/workflows/coverage.yml | 193 ------------- .github/workflows/docs.yml | 80 ------ .github/workflows/external.yml | 71 ----- .github/workflows/neuron-ci.yml | 475 -------------------------------- .github/workflows/release.yml | 91 ------ .github/workflows/wheels.yml | 64 +++++ .github/workflows/windows.yml | 104 ------- .gitlab-ci.yml | 308 --------------------- azure-pipelines.yml | 179 ------------ 10 files changed, 64 insertions(+), 1607 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .github/workflows/coverage.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/external.yml delete mode 100644 .github/workflows/neuron-ci.yml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/wheels.yml delete mode 100644 .github/workflows/windows.yml delete mode 100644 .gitlab-ci.yml delete mode 100644 azure-pipelines.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 737c5cc777..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,106 +0,0 @@ -version: 2.1 - -orbs: - python: circleci/python@2.1.1 - -jobs: - manylinux2014-aarch64: - - parameters: - NRN_PYTHON_VERSION: - type: string - NRN_NIGHTLY_UPLOAD: - type: string - - machine: - image: default - - resource_class: arm.medium - - steps: - - checkout - - run: - name: Build manylinux AArch64 wheel - command: | - docker run --rm \ - -w /root/nrn \ - -v $PWD:/root/nrn \ - -v /opt/nrnwheel/mpt:/nrnwheel/mpt \ - -e NEURON_NIGHTLY_TAG \ - -e NRN_NIGHTLY_UPLOAD \ - -e NRN_RELEASE_UPLOAD \ - -e SETUPTOOLS_SCM_PRETEND_VERSION \ - -e NRN_BUILD_FOR_UPLOAD=1 \ - 'neuronsimulator/neuron_wheel:latest-gcc9-aarch64' \ - packaging/python/build_wheels.bash linux << parameters.NRN_PYTHON_VERSION >> coreneuron - - - store_artifacts: - path: ./wheelhouse - destination: artifacts - - - run: - name: Test manylinux AArch64 wheel - command: | - - # install mpi dependencies - sudo apt update - sudo apt install -y mpich openmpi-bin libopenmpi-dev libmpich-dev - - # choose available python versions from pyenv - pyenv_py_ver="" - case << parameters.NRN_PYTHON_VERSION >> in - 38) pyenv_py_ver="3.8" ;; - 39) pyenv_py_ver="3.9" ;; - 310) pyenv_py_ver="3.10" ;; - 311) pyenv_py_ver="3.11" ;; - 312) pyenv_py_ver="3.12" ;; - *) echo "Error: pyenv python version not specified or not supported." && exit 1;; - esac - - env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $pyenv_py_ver --force - pyenv global $pyenv_py_ver - export PYTHON_EXE=$(which python) - - # test wheel - packaging/python/test_wheels.sh $PYTHON_EXE $(ls -t wheelhouse/*.whl) - - - run: - name: Upload nightly wheel to pypi.org - command: | - if [ "<< parameters.NRN_NIGHTLY_UPLOAD >>" == "true" ]; then - python -m pip install --upgrade pip - python -m pip install twine - python -m twine upload --verbose --skip-existing -u $TWINE_USERNAME -p $TWINE_PASSWORD wheelhouse/*.whl - else - echo "Skipping pypi.org upload!" - fi - -workflows: - - build-workflow: - jobs: - - manylinux2014-aarch64: - filters: - branches: - only: - - /release\/.*/ - - /circleci\/.*/ - matrix: - parameters: - NRN_PYTHON_VERSION: ["312"] - NRN_NIGHTLY_UPLOAD: ["false"] - - nightly: - triggers: - - schedule: - cron: "0 0 * * *" - filters: - branches: - only: - - master - jobs: - - manylinux2014-aarch64: - matrix: - parameters: - NRN_PYTHON_VERSION: ["38", "39", "310", "311", "312"] - NRN_NIGHTLY_UPLOAD: ["true"] diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index ce0bb21bae..0000000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,193 +0,0 @@ -name: NEURON Code Coverage - -concurrency: - # Don't cancel on master, creating a PR when a push workflow is already going will cancel the push workflow in favour of the PR workflow - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }} - cancel-in-progress: true - -on: - merge_group: - push: - branches: - - master - - release/** - pull_request: - branches: - - master - - release/** -# TODO : https://github.com/neuronsimulator/nrn/issues/1063 -# paths-ignore: -# - '**.md' -# - '**.rst' -# - 'docs/**' - -env: - PY_MIN_VERSION: '3.8' - PY_MID_VERSION: '3.10' - PY_MAX_VERSION: '3.12' - -jobs: - coverage: - runs-on: ubuntu-22.04 - - name: Code Coverage - - timeout-minutes: 60 - - env: - DISPLAY: ${{ ':0' }} - MUSIC_INSTALL_DIR: /opt/MUSIC - MUSIC_VERSION: 1.2.0 - - steps: - - - name: Install apt packages - run: | - sudo apt-get install xfonts-100dpi build-essential doxygen lcov libboost-all-dev libopenmpi-dev libmpich-dev libx11-dev libxcomposite-dev mpich openmpi-bin gpg ninja-build flex bison libfl-dev - shell: bash - - - name: Setup Caliper profiler - run: | - git clone https://github.com/LLNL/Caliper.git - cd Caliper - mkdir build && cd build - cmake .. - make && sudo make install - - - name: Setup MUSIC@${{ env.MUSIC_VERSION }} - run: | - python3 -m venv music-venv - source music-venv/bin/activate - python3 -m pip install 'mpi4py<4' cython numpy setuptools - sudo mkdir -p $MUSIC_INSTALL_DIR - sudo chown -R $USER $MUSIC_INSTALL_DIR - curl -L -o MUSIC.zip https://github.com/INCF/MUSIC/archive/refs/tags/${MUSIC_VERSION}.zip - unzip MUSIC.zip && mv MUSIC-* MUSIC && cd MUSIC - ./autogen.sh - ./configure --with-python-sys-prefix --prefix=$MUSIC_INSTALL_DIR --disable-anysource - make -j install - deactivate - working-directory: ${{runner.temp}} - - - name: Setup Xvfb - run: | - sudo apt-get install xvfb - sudo /usr/bin/Xvfb $DISPLAY -screen 0 1600x1200x24 -noreset -nolock -shmem & # run in bg - - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Clone nmodl - working-directory: ${{runner.workspace}}/nrn - run: | - git submodule update --init --recursive --force --depth 1 -- external/nmodl - - - name: Set up Python@${{ env.PY_MIN_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PY_MIN_VERSION }} - - - name: Install Python@${{ env.PY_MIN_VERSION }} dependencies - working-directory: ${{runner.workspace}}/nrn - run: | - python -m pip install --upgrade -r external/nmodl/requirements.txt - python -m pip install --upgrade -r ci_requirements.txt - python -m pip install --upgrade pip -r nrn_requirements.txt - - - name: Set up Python@${{ env.PY_MID_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PY_MID_VERSION }} - - - name: Set up Python@${{ env.PY_MAX_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PY_MAX_VERSION }} - - - name: Install Python@${{ env.PY_MAX_VERSION }} dependencies - working-directory: ${{runner.workspace}}/nrn - run: | - python -m pip install --upgrade -r external/nmodl/requirements.txt - python -m pip install --upgrade -r ci_requirements.txt - python -m pip install --upgrade pip -r nrn_requirements.txt - - - - name: Build & Test - id: build-test - shell: bash - working-directory: ${{runner.workspace}}/nrn - run: | - export SHELL="/bin/bash" - - # Compiler setup - export CC=gcc - export CXX=g++ - - # Python setup - export PYTHON_MIN=$(which $PYTHON_MIN_NAME); - export PYTHON_MID=$(which $PYTHON_MID_NAME); - export PYTHON_MAX=$(which $PYTHON_MAX_NAME); - - mkdir build && cd build; - - # CMake options & flags - cmake_args=(-G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_C_COMPILER="$CC" \ - -DCMAKE_CXX_COMPILER="$CXX" \ - -DNRN_ENABLE_BACKTRACE=ON \ - -DNRN_ENABLE_CORENEURON=ON \ - -DNRN_ENABLE_COVERAGE=ON \ - -DNRN_ENABLE_INTERVIEWS=ON \ - -DNRN_ENABLE_MPI=ON \ - -DNRN_ENABLE_PERFORMANCE_TESTS=OFF \ - -DNRN_ENABLE_PROFILING=ON \ - -DNRN_ENABLE_PYTHON=ON \ - -DNRN_ENABLE_PYTHON_DYNAMIC=ON \ - -DNRN_PYTHON_DYNAMIC="${PYTHON_MIN};${PYTHON_MAX}" \ - -DNRN_PYTHON_EXTRA_FOR_TESTS=${PYTHON_MID} \ - -DNRN_ENABLE_TESTS=ON \ - -DNRN_ENABLE_MUSIC=ON \ - -DCMAKE_PREFIX_PATH="${MUSIC_INSTALL_DIR}" \ - -DMUSIC_ROOT="${MUSIC_INSTALL_DIR}") - cmake .. "${cmake_args[@]}" - # Coverage - # The Linux runners apparently have 2 cores, but jobs were being killed when we did not specify this explicitly. - # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources - # By default we get a modern version of CMake that understands --parallel. - cmake --build . --parallel 2 - cmake --build . --target cover_baseline - xvfb-run ctest --rerun-failed --output-on-failure; - for python in "${PYTHON_MIN}" "${PYTHON_MAX}" - do - echo "Using ${python}" - NEURONHOME="${PWD}/share/nrn" \ - PYTHONPATH="${PWD}/lib/python:${PYTHONPATH}" \ - PATH="${PWD}/bin:${PATH}" \ - LD_LIBRARY_PATH="${PWD}/lib:${LD_LIBRARY_PATH}" \ - DYLD_LIBRARY_PATH="${PWD}/lib:${DYLD_LIBRARY_PATH}" \ - "${python}" -c "from neuron import h; import neuron; neuron.test();neuron.test_rxd();" - done - cmake --build . --target cover_collect - cmake --build . --target cover_combine - env: - MATRIX_EVAL: "CC=gcc CXX=g++" - PYTHON_MIN_NAME: "python${{ env.PY_MIN_VERSION }}" - PYTHON_MID_NAME: "python${{ env.PY_MID_VERSION }}" - PYTHON_MAX_NAME: "python${{ env.PY_MAX_VERSION }}" - - # This step will set up an SSH connection on tmate.io for live debugging. - # To enable it, you have to: - # * add 'live-debug-coverage' to your PR title - # * push something to your PR branch (note that just re-running the pipeline disregards the title update) - - name: live debug session on failure (manual steps required, check `.github/coverage.yml`) - if: failure() && contains(github.event.pull_request.title, 'live-debug-coverage') - uses: mxschmitt/action-tmate@v3 - - - uses: codecov/codecov-action@v4 - with: - directory: ./build - fail_ci_if_error: true - verbose: true - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 2ef1052dd7..0000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: NEURON Documentation - -concurrency: - # Don't cancel on master, creating a PR when a push workflow is already going will cancel the push workflow in favour of the PR workflow - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }} - cancel-in-progress: true - -on: - merge_group: - push: - branches: - - master - - release/** - pull_request: - branches: - - master - - release/** - -env: - DEFAULT_PY_VERSION: '3.12' - -jobs: - documentation: - runs-on: ubuntu-20.04 - - name: Documentation - - timeout-minutes: 25 - - steps: - - - name: Install apt packages - run: | - sudo apt-get update --fix-missing - sudo apt-get install build-essential libopenmpi-dev libmpich-dev libx11-dev libxcomposite-dev mpich openmpi-bin - sudo apt-get install ffmpeg doxygen pandoc - shell: bash - - - name: Set up Python@${{ env.DEFAULT_PY_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.DEFAULT_PY_VERSION }} - - - uses: actions/checkout@v4 - - - name: Install Python dependencies - working-directory: ${{runner.workspace}}/nrn - run: | - python -m pip install --upgrade pip -r nrn_requirements.txt - - - name: Install Python documentation dependencies - working-directory: ${{runner.workspace}}/nrn - run: | - python -m pip install --upgrade -r docs/docs_requirements.txt - - - name: Documentation - id: documentation - shell: bash - working-directory: ${{runner.workspace}}/nrn - run: | - echo "-------- NEURON wheel --------"; - python setup.py build_ext bdist_wheel; - neuron_wheel=dist/NEURON*.whl; - echo "-------- install wheel --------" - python -m pip install $neuron_wheel; - echo "-------- now build docs--------"; - python setup.py docs; - echo "-------- disable jekyll--------"; - pushd docs/_build; - touch .nojekyll; - echo "-------- OK to deploy! --------"; - echo "OK_TO_DEPLOY_DOCS=true" >> $GITHUB_ENV - - # This step will set up an SSH connection on tmate.io for live debugging. - # To enable it, you have to: - # * add 'live-debug-docs' to your PR title - # * push something to your PR branch (note that just re-running the pipeline disregards the title update) - - name: live debug session on failure (manual steps required, check `.github/docs.yml`) - if: failure() && contains(github.event.pull_request.title, 'live-debug-docs') - uses: mxschmitt/action-tmate@v3 diff --git a/.github/workflows/external.yml b/.github/workflows/external.yml deleted file mode 100644 index ab06e55459..0000000000 --- a/.github/workflows/external.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: External CIs - -concurrency: - # Don't cancel on master, creating a PR when a push workflow is already going will cancel the push workflow in favour of the PR workflow - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }} - cancel-in-progress: true - -on: - pull_request: - types: [ labeled ] -env: - PR_URL: ${{ github.event.pull_request.html_url }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -jobs: - get-last-azure-url: - runs-on: ubuntu-latest - if: ${{ github.event.label.name == 'nrn-modeldb-ci-nightly' }} - outputs: - azure_drop_url: ${{ steps.drop.outputs.azure_drop_url }} - pr_azure_sha: ${{ steps.drop.outputs.pr_azure_sha }} - steps: - - id: drop - run: | - # use jq to get the last Azure drop URL from the PR and the SHA1 from the same body - export pr_json=$(gh pr view $PR_URL --json comments -q 'last(.comments[] .body | capture(".*(?[0-9a-f]{40}).*?(?https://dev.azure.com/neuronsimulator/.*=zip)"))') - if [ -z "$pr_json" ]; then - echo "Unable to retrieve AZURE drop url and SHA from comments!" - exit 1 - fi - # use jq to get pr_azure_sha and azure_drop_url from the json - export azure_drop_url=$(echo $pr_json | jq -r .azure_drop_url) - export pr_azure_sha=$(echo $pr_json | jq -r .pr_azure_sha) - echo azure_drop_url=$azure_drop_url >> $GITHUB_OUTPUT - echo pr_azure_sha=$pr_azure_sha >> $GITHUB_OUTPUT - - - id: remove-label - if: always() - run: | - # remove the label - gh pr edit $PR_URL --remove-label nrn-modeldb-ci-nightly - # if we encounter an error in last github action step, add a comment - if [ ${{ steps.drop.outcome }} == 'failure' ]; then - gh pr comment $PR_URL --body "Unable to retrieve AZURE drop url from comments!" - else - gh pr comment $PR_URL --body "NEURON ModelDB CI: launching for ${pr_azure_sha} via its [drop url]($azure_drop_url)" - fi - env: - pr_azure_sha: ${{ steps.drop.outputs.pr_azure_sha }} - azure_drop_url: ${{ steps.drop.outputs.azure_drop_url }} - - nrn-modeldb-ci: - needs: get-last-azure-url - uses: neuronsimulator/nrn-modeldb-ci/.github/workflows/nrn-modeldb-ci.yaml@master - with: - neuron_v1: ${{needs.get-last-azure-url.outputs.azure_drop_url}} - neuron_v2: neuron-nightly - - pr-update: - needs: - - nrn-modeldb-ci - - get-last-azure-url - runs-on: ubuntu-latest - steps: - - run: | - gh pr comment $PR_URL --body "NEURON ModelDB CI: ${pr_azure_sha} -> download reports [from here](${ARTIFACTS_URL})" - name: Post NEURON ModelDB CI Artifact URL - if: always() || cancelled() - env: - ARTIFACTS_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - pr_azure_sha: ${{ needs.get-last-azure-url.outputs.pr_azure_sha }} diff --git a/.github/workflows/neuron-ci.yml b/.github/workflows/neuron-ci.yml deleted file mode 100644 index 0c82d98836..0000000000 --- a/.github/workflows/neuron-ci.yml +++ /dev/null @@ -1,475 +0,0 @@ -name: NEURON CI - -concurrency: - # Don't cancel on master, creating a PR when a push workflow is already going will cancel the push workflow in favour of the PR workflow - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }} - cancel-in-progress: true - -on: - merge_group: - push: - branches: - # If nothing else, this is important for the ccache logic below... - - master - - release/** - pull_request: - branches: - - master - - release/** -# TODO : https://github.com/neuronsimulator/nrn/issues/1063 -# paths-ignore: -# - '**.md' -# - '**.rst' -# - 'docs/**' - - -jobs: - ci: - runs-on: ${{ matrix.os }} - - name: ${{ matrix.os }} - ${{ matrix.config.build_mode }} (${{ matrix.config.cmake_option }}${{ matrix.config.config_options }}${{ matrix.config.matrix_eval }}${{ matrix.config.sanitizer }}) - - timeout-minutes: 75 - - env: - INSTALL_DIR: install - SDK_ROOT: $(xcrun --sdk macosx --show-sdk-path) - SKIP_WHEELHOUSE_REPAIR: true - BUILD_TYPE: Release - DESIRED_CMAKE_VERSION: 3.17 - DYNAMIC_PYTHON_CMAKE_VERSION: 3.18 - PY_MIN_VERSION: ${{ matrix.config.python_min_version || '3.8' }} - PY_MAX_VERSION: ${{ matrix.config.python_max_version || '3.12' }} - MUSIC_INSTALL_DIR: /opt/MUSIC - MUSIC_VERSION: 1.2.1 - - strategy: - matrix: - os: [macOS-13, ubuntu-20.04] - config: - - { matrix_eval : "CC=gcc-9 CXX=g++-9", build_mode: "setuptools"} - - { matrix_eval : "CC=gcc-10 CXX=g++-10", build_mode: "cmake", music: ON} - - { matrix_eval : "CC=gcc-10 CXX=g++-10", build_mode: "cmake", python_dynamic: ON} - - { matrix_eval : "CC=gcc-9 CXX=g++-9" , build_mode: "cmake", cmake_option: "-DNRN_ENABLE_CORENEURON=ON"} - - { matrix_eval : "CC=gcc-9 CXX=g++-9", build_mode: "cmake", cmake_option: "-DNRN_ENABLE_MPI=OFF -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_CORENEURON=ON"} - - { matrix_eval : "CC=gcc-10 CXX=g++-10", build_mode: "cmake", cmake_option: "-DNRN_ENABLE_PYTHON=OFF -DNRN_ENABLE_RX3D=OFF -DNRN_ENABLE_CORENEURON=ON"} - include: - - os: ubuntu-22.04 - config: - build_mode: cmake - cmake_option: -DNRN_ENABLE_CORENEURON=ON - -DNRN_ENABLE_INTERVIEWS=OFF -DNMODL_SANITIZERS=undefined - flag_warnings: ON - sanitizer: undefined - - os: ubuntu-22.04 - config: - build_mode: cmake - # TODO: CoreNEURON is only LeakSanitizer-clean if we disable MPI - cmake_option: -DNRN_ENABLE_CORENEURON=ON - -DNRN_ENABLE_INTERVIEWS=OFF -DNMODL_SANITIZERS=address - # TODO: address-leak is the dream, but there are many problems, - # including external ones from the MPI implementations - sanitizer: address - - os: ubuntu-24.04 - config: - build_mode: cmake - # Cannot use a non-instrumented OpenMP with TSan, and we don't - # have a TSan-instrumented OpenMP runtime available. - # TODO: debug RX3D + TSan - cmake_option: -DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_MPI=OFF - -DCORENRN_ENABLE_OPENMP=OFF -DNRN_ENABLE_RX3D=OFF - sanitizer: thread - - os: macOS-13 - config: - build_mode: cmake - # TODO: investigate rxd test timeouts in this build and re-enable them - cmake_option: -DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_INTERVIEWS=OFF - -DNRN_ENABLE_RX3D=OFF -DNMODL_SANITIZERS=address - sanitizer: address - - os: macOS-14 - config: - build_mode: cmake - # TODO: investigate rxd test timeouts in this build and re-enable them - cmake_option: -DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_INTERVIEWS=OFF - -DNRN_ENABLE_RX3D=OFF -DNMODL_SANITIZERS=address - sanitizer: thread - fail-fast: false - - 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.os == 'ubuntu-22.04' - - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v2 - with: - cmake-version : ${{(matrix.config.python_dynamic || matrix.config.build_mode == 'setuptools') && env.DYNAMIC_PYTHON_CMAKE_VERSION || env.DESIRED_CMAKE_VERSION}} - - - name: Install homebrew packages - if: startsWith(matrix.os, 'macOS') - run: | - # Unlink and re-link to prevent errors when GitHub macOS runner images - # install Python outside of brew; See actions/setup-python#577 and BlueBrain/libsonata/pull/317 - brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done - brew install ccache coreutils doxygen flex bison mpich ninja xz autoconf automake libtool - # We use both for dynamic mpi in nrn - brew unlink mpich - brew install openmpi - brew install --cask xquartz - if [[ "${{matrix.os}}" == "macOS-14" ]]; then - brew install cmake - echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH - fi - echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH - # Core https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories - if [[ "${{matrix.os}}" == "macOS-13" ]]; then - echo CMAKE_BUILD_PARALLEL_LEVEL=4 >> $GITHUB_ENV - echo CTEST_PARALLEL_LEVEL=4 >> $GITHUB_ENV - else - echo CMAKE_BUILD_PARALLEL_LEVEL=3 >> $GITHUB_ENV - echo CTEST_PARALLEL_LEVEL=3 >> $GITHUB_ENV - fi - echo CI_OS_NAME=osx >> $GITHUB_ENV - shell: bash - - - name: Install apt packages - if: startsWith(matrix.os, 'ubuntu') - run: | - sudo apt-get install build-essential ccache libopenmpi-dev \ - libmpich-dev libx11-dev libxcomposite-dev mpich ninja-build \ - openmpi-bin flex libfl-dev bison libreadline-dev - # The sanitizer builds use ubuntu 22.04 - if [[ "${{matrix.os}}" == "ubuntu-20.04" ]]; then - sudo apt-get install g++-7 g++-8 - fi - # Core https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories - echo CMAKE_BUILD_PARALLEL_LEVEL=4 >> $GITHUB_ENV - echo CTEST_PARALLEL_LEVEL=4 >> $GITHUB_ENV - echo CI_OS_NAME=linux >> $GITHUB_ENV - shell: bash - - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Clone nmodl - working-directory: ${{runner.workspace}}/nrn - run: | - git submodule update --init --recursive --force --depth 1 -- external/nmodl - - - name: Set up Python@${{ env.PY_MIN_VERSION }} - if: ${{matrix.config.python_dynamic == 'ON'}} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PY_MIN_VERSION }} - - - name: Install Python@${{ env.PY_MIN_VERSION }} dependencies - if: ${{ matrix.config.python_dynamic == 'ON' }} - working-directory: ${{runner.workspace}}/nrn - run: | - python -m pip install --upgrade -r external/nmodl/requirements.txt - python -m pip install --upgrade -r ci_requirements.txt - python -m pip install --upgrade pip -r nrn_requirements.txt - - - name: Set up Python@${{ env.PY_MAX_VERSION }} - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PY_MAX_VERSION }} - - - name: Install Python@${{ env.PY_MAX_VERSION }} dependencies - working-directory: ${{runner.workspace}}/nrn - run: | - python -m pip install --upgrade -r external/nmodl/requirements.txt - python -m pip install --upgrade -r ci_requirements.txt - python -m pip install --upgrade pip -r nrn_requirements.txt - - - name: Install a new automake - # A automake >= 1.16.5 is needed for python 3.12 because it generates a python script - # called py-compile and the original one is not supporting this version of python - # Once ubuntu got a newer version of automake we can remove this part. - if: matrix.config.music == 'ON' && startsWith(matrix.os, 'ubuntu') - run: | - curl -L -o automake.tar.xz https://ftpmirror.gnu.org/gnu/automake/automake-1.16.5.tar.xz - tar -xf automake.tar.xz - cd automake-1.16.5/ - ./configure --prefix=/usr/ - make -j - sudo make -j install - automake --version - working-directory: ${{runner.temp}} - - - name: Setup MUSIC@${{ env.MUSIC_VERSION }} - if: matrix.config.music == 'ON' - run: | - python3 -m venv music-venv - source music-venv/bin/activate - python3 -m pip install 'mpi4py<4' cython numpy setuptools - sudo mkdir -p $MUSIC_INSTALL_DIR - sudo chown -R $USER $MUSIC_INSTALL_DIR - curl -L -o MUSIC.zip https://github.com/INCF/MUSIC/archive/refs/tags/${MUSIC_VERSION}.zip - unzip MUSIC.zip && mv MUSIC-* MUSIC && cd MUSIC - ./autogen.sh - # on some systems MPI library detection fails, provide exact flags/compilers - ./configure --with-python-sys-prefix --prefix=$MUSIC_INSTALL_DIR --disable-anysource MPI_CXXFLAGS="-g -O3" MPI_CFLAGS="-g -O3" MPI_LDFLAGS=" " CC=mpicc CXX=mpicxx - make -j install - deactivate - working-directory: ${{runner.temp}} - - - name: Register gcc 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: Hash config dictionary - run: | - cat << EOF > matrix.json - ${{toJSON(matrix.config)}} - EOF - echo matrix.config JSON: - cat matrix.json - echo ----- - - - name: Restore compiler cache - uses: actions/cache/restore@v4 - id: restore-compiler-cache - with: - path: ${{runner.workspace}}/ccache - key: ${{matrix.os}}-${{hashfiles('matrix.json')}}-${{github.ref}}-${{github.sha}} - restore-keys: | - ${{matrix.os}}-${{hashfiles('matrix.json')}}-${{github.ref}}- - ${{matrix.os}}-${{hashfiles('matrix.json')}}- - - - name: Build and Test - id: build-test - shell: bash - working-directory: ${{runner.workspace}}/nrn - run: | - # OS related - if [ "$RUNNER_OS" == "Linux" ]; then - export ${MATRIX_EVAL}; - export SHELL="/bin/bash" - else - export CXX=${CXX:-g++}; - export CC=${CC:-gcc}; - fi - if [ "$RUNNER_OS" == "macOS" ]; then - # TODO - this is a workaround that was implemented for Azure being reported as getting stuck. - # However it does not get stuck: neuron module not found and script goes to interpreter, seeming stuck. - # This needs to be addressed and SKIP_EMBEDED_PYTHON_TEST logic removed everywhere. - export SKIP_EMBEDED_PYTHON_TEST="true" - # long TMPDIR path on MacOS can results into runtime failures with OpenMPI - # Set shorter path as discussed in https://github.com/open-mpi/ompi/issues/8510 - export TMPDIR=/tmp/$GITHUB_JOB - mkdir -p $TMPDIR - fi - - # Python setup - export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python/ - # Python setup - export PYTHON_MIN=$(command -v $PYTHON_MIN_NAME); - export PYTHON_MAX=$(command -v $PYTHON_MAX_NAME); - export PYTHON=$PYTHON_MAX - if [ "$RUNNER_OS" == "macOS" ]; then - # Python is not installed as a framework, so we need to writ 'backend: TkAgg' to `matplotlibrc`. - # Since we are in a virtual environment, we cannot use `$HOME/matplotlibrc` - # The following solution is generic and relies on `matplotlib.__file__` to know where to append backend setup. - $PYTHON -c "import os,matplotlib; f =open(os.path.join(os.path.dirname(matplotlib.__file__), 'mpl-data/matplotlibrc'),'a'); f.write('backend: TkAgg');f.close();" - fi; - - # Some logging - echo $LANG - echo $LC_ALL - python3 -c 'import os,sys; os.set_blocking(sys.stdout.fileno(), True)' - cmake --version - - # different builds with CMake - if [[ "$BUILD_MODE" == "cmake" ]]; then - cmake_args=(-G Ninja) - # Sanitizer-specific setup - if [[ -n "${{matrix.config.sanitizer}}" ]]; then - if [ "$RUNNER_OS" == "Linux" ]; then - if [[ "${{matrix.config.sanitizer}}" == "thread" ]]; then - # GitHub/ubuntu-22.04 + clang-14 seems to have problems with TSan. - # Vanilla 22.04 + clang-16 from apt.llvm.org seemed to work. - # Use gcc-12 instead, as GitHub/ubuntu-22.04 already has it. - CC=$(command -v gcc-12) - CXX=$(command -v g++-12) - else - CC=$(command -v clang-14) - CXX=$(command -v clang++-14) - symbolizer_path="$(readlink -f "$(command -v llvm-symbolizer-14)")" - cmake_args+=(-DLLVM_SYMBOLIZER_PATH="${symbolizer_path}") - fi - fi - cmake_args+=(-DCMAKE_BUILD_TYPE=Custom \ - -DCMAKE_C_FLAGS="-O1 -g" \ - -DCMAKE_CXX_FLAGS="-O1 -g" \ - -DNRN_SANITIZERS=$(echo ${{matrix.config.sanitizer}} | sed -e 's/-/,/g')) - fi - cmake_args+=(-DCMAKE_C_COMPILER="${CC}" \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER="${CXX}" \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DNRN_ENABLE_TESTS=ON \ - -DNRN_ENABLE_PERFORMANCE_TESTS=OFF \ - ${{matrix.config.cmake_option}}) - if [[ "$NRN_ENABLE_PYTHON_DYNAMIC" == "ON" ]]; then - cmake_args+=(-DNRN_ENABLE_PYTHON=ON \ - -DNRN_ENABLE_PYTHON_DYNAMIC=ON \ - -DNRN_PYTHON_DYNAMIC="${PYTHON_MIN};${PYTHON_MAX}" \ - -DNRN_ENABLE_CORENEURON=ON) - else - cmake_args+=(-DPYTHON_EXECUTABLE="${PYTHON}") - fi - if [[ "$NRN_ENABLE_MUSIC" == "ON" ]]; then - cmake_args+=(-DNRN_ENABLE_MUSIC=ON \ - -DCMAKE_PREFIX_PATH=${MUSIC_INSTALL_DIR} \ - -DMUSIC_ROOT=${MUSIC_INSTALL_DIR}) - fi - # Enable more warnings in the builds whose compiler warnings we - # highlight in the GitHub UI - if [[ "${{matrix.config.flag_warnings}}" == "ON" ]]; then - cmake_args+=(-DNRN_EXTRA_CXX_FLAGS="-Wall \ - -Wno-char-subscripts \ - -Wno-unknown-pragmas \ - -Wno-unused-variable \ - -Wno-unused-function \ - -Wno-unused-but-set-variable \ - -Wno-reorder \ - -Wno-sign-compare" \ - -DNRN_EXTRA_MECH_CXX_FLAGS="-Wno-sometimes-uninitialized \ - -Wno-missing-braces") - fi - mkdir build && cd build - echo "Building with: ${cmake_args[@]}" - cmake .. "${cmake_args[@]}" - 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 - ccache -z - # Older versions don't support -v (verbose) - ccache -vs 2>/dev/null || ccache -s - cmake --build . --parallel - ccache -vs 2>/dev/null || ccache -s - if [ "$RUNNER_OS" == "macOS" ] - then - mkdir -p src/nrnpython - echo $'[install]\nprefix='>src/nrnpython/setup.cfg; - fi - if [[ "$NRN_ENABLE_PYTHON_DYNAMIC" == "ON" ]]; then - echo "--RUNNING BASIC TESTS FROM BUILD DIR--" - for python in "${PYTHON_MIN}" "${PYTHON_MAX}" - do - echo "Using ${python}" - NEURONHOME="${PWD}/share/nrn" \ - PYTHONPATH="${PWD}/lib/python" \ - PATH="${PWD}/bin" \ - LD_LIBRARY_PATH="${PWD}/lib:${LD_LIBRARY_PATH}" \ - DYLD_LIBRARY_PATH="${PWD}/lib:${DYLD_LIBRARY_PATH}" \ - "${python}" -c "from neuron import h; import neuron; neuron.test()" - done - fi - ctest --output-on-failure - cmake --build . --target install - export PATH="${INSTALL_DIR}/bin:${PATH}" - if [[ -f "${INSTALL_DIR}/bin/nrn-enable-sanitizer" ]]; then - echo --- bin/nrn-enable-sanitizer --- - cat bin/nrn-enable-sanitizer - echo --- - nrn_enable_sanitizer=${INSTALL_DIR}/bin/nrn-enable-sanitizer - nrn_enable_sanitizer_preload_python="${nrn_enable_sanitizer} --preload python" - else - echo nrn-enable-sanitizer not found, not using it - fi - elif [[ "$BUILD_MODE" == "setuptools" ]]; then - ./packaging/python/build_wheels.bash CI; - fi; - if [[ -z "${nrn_enable_sanitizer_preload_python}" ]]; then - nrn_enable_sanitizer_preload_python="${PYTHON}" - fi - - # basic test for cmake when python is not disabled - if [[ "$BUILD_MODE" == "cmake" && ! "${cmake_args[*]}" =~ "NRN_ENABLE_PYTHON=OFF" ]]; then - ${nrn_enable_sanitizer_preload_python} --version && ${nrn_enable_sanitizer_preload_python} -c 'import neuron; neuron.test()' - fi; - - # test neurondemo with cmake - if [[ "$BUILD_MODE" != "setuptools" ]]; then - ${nrn_enable_sanitizer} neurondemo -nogui -c 'demo(4)' -c 'run()' -c 'quit()' - fi; - - # with cmake dynamic check python_min and python_max together - if [[ "$BUILD_MODE" == "cmake" && "$NRN_ENABLE_PYTHON_DYNAMIC" == "ON" ]]; then - ${nrn_enable_sanitizer_preload_python} -c 'import neuron; neuron.test()' - $PYTHON_MIN -c 'import neuron; neuron.test()' - fi; - - # run rxd tests manually if rxd is enabled *and CoreNEURON is - # disabled -- otherwise hh-related tests fail - if [[ "$BUILD_MODE" == "cmake" \ - && ! "${cmake_args[*]}" =~ "NRN_ENABLE_RX3D=OFF" \ - && ! "${cmake_args[*]}" =~ "NRN_ENABLE_CORENEURON=ON" ]]; then - ${nrn_enable_sanitizer_preload_python} ../share/lib/python/neuron/rxdtests/run_all.py - fi; - - if [ "$BUILD_MODE" == "setuptools" ]; then - neuron_wheel=wheelhouse/NEURON*.whl; - # test with virtual environment - ./packaging/python/test_wheels.sh $PYTHON $neuron_wheel - # test with global installation - ./packaging/python/test_wheels.sh $PYTHON $neuron_wheel false - fi; - env: - BUILD_MODE: ${{ matrix.config.build_mode }} - CCACHE_BASEDIR: ${{runner.workspace}}/nrn - CCACHE_DIR: ${{runner.workspace}}/ccache - NRN_ENABLE_PYTHON_DYNAMIC : ${{ matrix.config.python_dynamic }} - NRN_ENABLE_MUSIC: ${{ matrix.config.music }} - PYTHON_MIN_NAME: "python${{ env.PY_MIN_VERSION }}" - PYTHON_MAX_NAME: "python${{ env.PY_MAX_VERSION }}" - INSTALL_DIR : ${{ runner.workspace }}/install - MATRIX_EVAL: ${{ matrix.config.matrix_eval }} - - - name: Save compiler cache - uses: actions/cache/save@v4 - if: always() && steps.restore-compiler-cache.outputs.cache-hit != 'true' - with: - path: ${{runner.workspace}}/ccache - key: | - ${{matrix.os}}-${{hashfiles('matrix.json')}}-${{github.ref}}- - ${{matrix.os}}-${{hashfiles('matrix.json')}}- - - # This step will set up an SSH connection on tmate.io for live debugging. - # To enable it, you have to: - # * add 'live-debug-ci' to your PR title - # * push something to your PR branch (note that just re-running the pipeline disregards the title update) - - name: live debug session on failure (manual steps required, check `.github/neuron-ci.yml`) - if: failure() && contains(github.event.pull_request.title, 'live-debug-ci') - uses: mxschmitt/action-tmate@v3 - - # see https://github.com/orgs/community/discussions/26822 - final: - name: Final CI - needs: [ci] - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - name: Check ci matrix all done - if: >- - ${{ - contains(needs.*.result, 'failure') - || contains(needs.*.result, 'cancelled') - || contains(needs.*.result, 'skipped') - }} - run: exit 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3ba15345b3..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: NEURON Release - -on: - workflow_dispatch: - inputs: - rel_branch: - description: 'Release branch/commit' - default: 'release/x.y' - required: true - rel_tag: - description: 'Release version (tag name)' - default: 'x.y.z' - required: true - -env: - GH_REPO: ${{ github.server_url }}/${{ github.repository }} - REL_TAG: ${{ github.event.inputs.rel_tag }} - REL_BRANCH: ${{ github.event.inputs.rel_branch }} - -jobs: - tag-n-release: - runs-on: ubuntu-latest - name: tag-n-release ${{ github.event.inputs.rel_tag }} (${{ github.event.inputs.rel_branch }}) - outputs: - release_url: ${{ steps.create_release.outputs.upload_url }} - rel_tag: ${{ env.REL_TAG }} - steps: - - uses: actions/checkout@v4 - name: Checkout branch ${{ env.REL_BRANCH }} - with: - ref: ${{ env.REL_BRANCH }} - - - name: Create and upload tag ${{ env.REL_TAG }} - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git tag -a $REL_TAG -m "${REL_TAG}" - git push origin $REL_TAG - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - working-directory: ${{runner.workspace}}/nrn - - - name: Create Release - id: create_release - uses: ncipollo/release-action@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag: ${{ env.REL_TAG }} - name: Release ${{ env.REL_TAG }} - prerelease: true - - nrn-full-src-package: - runs-on: ubuntu-latest - needs: tag-n-release - steps: - - name: Checkout feature-rich code - run: | - git clone --depth=1 --shallow-submodules --recurse-submodules $GH_REPO -b $REL_TAG --single-branch - cd nrn - LOCAL_TAG=`git tag` - if [ $REL_TAG != $LOCAL_TAG ]; then - echo "Wrong tag downloaded!" - exit 1 - else - git log --oneline - fi - - - name: Make nrnversion.h - run: | - mkdir build && cd build - cmake -DNRN_ENABLE_PYTHON=OFF -DNRN_ENABLE_RX3D=OFF -DNRN_ENABLE_MPI=OFF -DNRN_ENABLE_INTERVIEWS=OFF ../nrn - make nrnversion_h VERBOSE=1 - - - name: Create nrn-full-src-package - id: tar - run: | - tar -czvf nrn-full-src-package-${REL_TAG}.tar.gz nrn - echo "asset_file=nrn-full-src-package-${REL_TAG}.tar.gz" >> $GITHUB_OUTPUT - - - name: Upload nrn-full-src-package to release - run: | - gh release upload ${{ needs.tag-n-release.outputs.rel_tag }} ${{ steps.tar.outputs.asset_file }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - windows-installer: - needs: tag-n-release - uses: neuronsimulator/nrn/.github/workflows/windows.yml@master - with: - tag: ${{ needs.tag-n-release.outputs.rel_tag }} diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 0000000000..a8c8f3b93b --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,64 @@ +name: Build MacOS Wheels + +on: + push: + branches: + - master + pull_request: + branches: + - master + +# do not cancel so we can see results +concurrency: + cancel-in-progress: false + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + build-test-deploy: + name: Build MacOS Wheels + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + matrix: + os: [macos-14] + python-version: ['3.10', '3.11', '3.12'] # change later + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install OSX System Dependencies + run: | + brew install --cask xquartz + brew install flex bison mpich + brew unlink mpich && brew install openmpi + cmake --version + # Uninstall libomp for compatibility with issue #817 + brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist" + brew install cmake + echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH + echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH + + - name: Install readline + run: | + sudo mkdir -p /opt/nrnwheel/$(uname -m) + sudo bash packaging/python/build_static_readline_osx.bash + + - name: Build MacOS Wheel + run: | + packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron + + - name: Test wheel + run: | + minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl + + - name: Upload wheel files + uses: actions/upload-artifact@v3 + with: + name: macos-wheels-${{ matrix.python-version }} + path: wheelhouse/*.whl diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 985eae0ae0..0000000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Windows Installer - -concurrency: - # Don't cancel on master, creating a PR when a push workflow is already going will cancel the push workflow in favour of the PR workflow - group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.event.number && github.head_ref || github.ref_name }} - cancel-in-progress: true - -on: - merge_group: - workflow_call: - inputs: - tag: - description: 'Release version (tag name)' - default: '' - required: true - type: string - push: - branches: - - master - - release/** - pull_request: - branches: - - master - - release/** -# TODO : https://github.com/neuronsimulator/nrn/issues/1063 -# paths-ignore: -# - '**.md' -# - '**.rst' -# - 'docs/**' -env: - MSYS2_ROOT: C:\msys64 - -jobs: - WindowsInstaller: - runs-on: windows-latest - timeout-minutes: 45 - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.tag }} - - - name: Retrieve rxd test data - run: | - git submodule update --init test/rxd/testdata - shell: powershell - working-directory: ${{runner.workspace}}\nrn - - - name: Set up Python3 - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Download Dependencies - run: | - .\nrn\ci\win_download_deps.cmd - shell: powershell - working-directory: ${{runner.workspace}} - - - name: Install Dependencies - run: .\nrn\ci\win_install_deps.cmd - shell: powershell - working-directory: ${{runner.workspace}} - - - name: Build and Create Installer - run: | - rm.exe C:\WINDOWS\system32\bash.EXE - %MSYS2_ROOT%\usr\bin\bash -lc "$BUILD_SOURCESDIRECTORY/ci/win_build_cmake.sh" - shell: cmd - working-directory: ${{runner.workspace}}\nrn - env: - BUILD_SOURCESDIRECTORY: ${{runner.workspace}}\nrn - - # This step will set up an SSH connection on tmate.io for live debugging. - # To enable it, you have to: - # * add 'live-debug-win' to your PR title - # * push something to your PR branch (note that just re-running the pipeline disregards the title update) - - name: live debug session on failure (manual steps required, check `.github/windows.yml`) - if: failure() && contains(github.event.pull_request.title, 'live-debug-win') - uses: mxschmitt/action-tmate@v3 - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: nrn-nightly-AMD64.exe - path: ${{runner.workspace}}\nrn\nrn-nightly-AMD64.exe - - - name: Run installer and launch .hoc associaton test - run: .\ci\win_install_neuron.cmd - shell: cmd - working-directory: ${{runner.workspace}}\nrn - - - name: Test Installer - run: .\ci\win_test_installer.cmd - shell: cmd - working-directory: ${{runner.workspace}}\nrn - - - name: Publish Release Installer - working-directory: ${{runner.workspace}}\nrn - if: inputs.tag != '' - run: | - gh release upload ${{ inputs.tag }} nrn-nightly-AMD64.exe - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 6072f41ea1..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,308 +0,0 @@ -include: - - project: hpc/gitlab-pipelines - file: - - spack-build-components.gitlab-ci.yml - - github-project-pipelines.gitlab-ci.yml - ref: '$GITLAB_PIPELINES_BRANCH' - - project: hpc/gitlab-upload-logs - file: enable-upload.yml - -# see https://gitlab.com/gitlab-org/gitlab/-/issues/263401 for why we specify the flags like this now -# 130 characters seems to be the point at which jobs refuse to run -.matrix: - parallel: - matrix: - - build_mode: cmake - cmake_coreneuron: "ON" - cmake_interviews: "OFF" - cmake_rx3d: "OFF" - sanitizer: address - -mac_m1_cmake_build: - stage: .pre - extends: .matrix - cache: - # either CI_MERGE_REQUEST_SOURCE_BRANCH_NAME or CI_COMMIT_BRANCH will be available, - # depending on whether this pipeline runs for a merge request or on a branch - # either way, we get the active branch in the cache key - key: ${CI_JOB_NAME}-${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}${CI_COMMIT_BRANCH} - paths: - - ./ccache - variables: - CCACHE_BASEDIR: ${CI_PROJECT_DIR}/nrn - CCACHE_DIR: ${CI_PROJECT_DIR}/ccache - CMAKE_BUILD_PARALLEL_LEVEL: 3 - CTEST_PARALLEL_LEVEL: 3 - tags: - - macos-arm64 - script: - # Using macOS + ASan + virtual environments requires that you remove shims - # before creating the venv. CMake would tell us this if we got it wrong. - # See sanitizers.cmake for more information. If we find this gets copied to - # too many different places, put the .py script in the repository. - - | - cat > resolve_shim.py << END_SCRIPT - import ctypes - dyld = ctypes.cdll.LoadLibrary('/usr/lib/system/libdyld.dylib') - namelen = ctypes.c_ulong(1024) - name = ctypes.create_string_buffer(b'\\000', namelen.value) - dyld._NSGetExecutablePath(ctypes.byref(name), ctypes.byref(namelen)) - print(name.value.decode()) - END_SCRIPT - - real_python=$(python3 resolve_shim.py) - - echo "python3=$(command -v python3) is really ${real_python}" - - PYTHONEXECUTABLE=${real_python} ${real_python} -mvenv venv - - venv/bin/python3 -m ensurepip --upgrade --default-pip - - git submodule update --init --recursive --force --depth 1 -- external/nmodl - - venv/bin/pip install --upgrade -r external/nmodl/requirements.txt - - venv/bin/pip install --upgrade pip -r nrn_requirements.txt - - source ./venv/bin/activate - - export PYTHON=${PWD}/venv/bin/python - - ${PYTHON} --version - - '${PYTHON} -c "import os,matplotlib; f = open(os.path.join(os.path.dirname(matplotlib.__file__), \"mpl-data/matplotlibrc\"),\"a\"); f.write(\"backend: TkAgg\");f.close();"' - - 'export CXX=${CXX:-g++}' - - 'export CC=${CC:-gcc}' - - brew install flex bison - - export PATH="/opt/homebrew/opt/flex/bin:/opt/homebrew/opt/bison/bin:$PATH" - - export INSTALL_DIR=$(pwd)/install - - echo $LANG - - echo $LC_ALL - - 'export PYTHONPATH=$(${PYTHON} -c "import site; print(\":\".join(site.getsitepackages()))")' - - ${PYTHON} -c 'import os,sys; os.set_blocking(sys.stdout.fileno(), True)' - - cmake_args=(-G Ninja) - - if [[ -n "${sanitizer}" ]]; then - - cmake_args+=(-DCMAKE_BUILD_TYPE=Custom - -DCMAKE_C_FLAGS="-O1 -g" - -DCMAKE_CXX_FLAGS="-O1 -g" - -DNRN_SANITIZERS=$(echo ${sanitizer} | sed -e 's/-/,/g')) - - fi - - cmake_args+=(-DCMAKE_C_COMPILER="${CC}" - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER="${CXX}" - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" - -DNRN_ENABLE_TESTS=ON - -DNRN_ENABLE_PERFORMANCE_TESTS=OFF - -DNRN_ENABLE_CORENEURON=${cmake_coreneuron} - -DNRN_ENABLE_INTERVIEWS=${cmake_interviews} - -DNRN_ENABLE_RX3D=${cmake_rx3d}) - - cmake_args+=(-DPYTHON_EXECUTABLE="${PYTHON}") - - mkdir build && cd build - - echo "Building with ${cmake_args[@]}" - - cmake .. "${cmake_args[@]}" - - ccache -z - - ccache -vs 2>/dev/null - - cmake --build . --parallel - - ccache -vs 2>/dev/null - - echo $'[install]\nprefix='>src/nrnpython/setup.cfg - - cat src/nrnpython/setup.cfg - - ctest --output-on-failure - - cmake --build . --target install - - 'export PATH=${INSTALL_DIR}/bin:${PATH}' - - 'export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python/' - - if [[ -f "${INSTALL_DIR}/bin/nrn-enable-sanitizer" ]]; then - - echo --- bin/nrn-enable-sanitizer --- - - cat bin/nrn-enable-sanitizer - - echo --- - - nrn_enable_sanitizer=${INSTALL_DIR}/bin/nrn-enable-sanitizer - - nrn_enable_sanitizer_preload="${nrn_enable_sanitizer} --preload" - - else - - echo nrn-enable-sanitizer not found, not using it - - fi - - $PYTHON --version && ${nrn_enable_sanitizer_preload} python -c 'import neuron; neuron.test()' - - if [[ ! "${cmake_args[*]}" =~ "NRN_ENABLE_RX3D=OFF" - && ! "${cmake_args[*]}" =~ "NRN_ENABLE_CORENEURON=ON" ]]; then - - ${nrn_enable_sanitizer_preload} python ../share/lib/python/neuron/rxdtests/run_all.py - - fi; - -variables: - BLUECONFIGS_BRANCH: - description: Branch of blueconfigs to trigger the simulation stack pipeline from - value: main - LIBSONATA_REPORT_BRANCH: - description: Branch of libsonata-report to build BlueBrain models against in the simulation stack pipeline (LIBSONATA_REPORT_COMMIT and LIBSONATA_REPORT_TAG also possible) - value: master - NMODL_BRANCH: - description: Branch of NMODL to build CoreNEURON against (NMODL_COMMIT and NMODL_TAG also possible) - value: master - SPACK_BRANCH: - description: Branch of BlueBrain Spack to use for the CI pipeline - value: develop - SPACK_DEPLOYMENT_SUFFIX: - description: Extra path component used when finding deployed software. Set to something like `pulls/1497` use software built for https://github.com/BlueBrain/spack/pull/1497. You probably want to set SPACK_BRANCH to the branch used in the relevant PR if you set this. - value: '' - -# Set up Spack -spack_setup: - extends: .spack_setup_ccache - script: - - !reference [.spack_setup_ccache, script] - # try and make sure these are propagated to the simulation_stack bridge job and child pipeline - - echo "BLUECONFIGS_BRANCH=${BLUECONFIGS_BRANCH}" >> commit-mapping.env - - echo "BLUECONFIGS_BRANCH=${BLUECONFIGS_BRANCH}" >> spack_clone_variables.env - variables: - NEURON_COMMIT: ${CI_COMMIT_SHA} - # Enable fetching GitHub PR descriptions and parsing them to find out what - # branches to build of other projects. - PARSE_GITHUB_PR_DESCRIPTIONS: "true" - # BLUECONFIGS_BRANCH does not correspond to a Spack package called blueconfigs - SPACK_SETUP_IGNORE_PACKAGE_VARIABLES: BLUECONFIGS - -# Performance seems to be terrible when we get too many jobs on a single node. -.build: - extends: [.spack_build] - variables: - bb5_ntasks: 2 # so we block 16 cores - bb5_cpus_per_task: 8 # ninja -j {this} - bb5_memory: 160G # ~2*16*384/80 (~2x more as we have seen OOMs) - -.spack_intel: - variables: - SPACK_PACKAGE_COMPILER: oneapi -.spack_nvhpc: - variables: - SPACK_PACKAGE_COMPILER: nvhpc -.build_neuron: - extends: [.build] - timeout: two hours - variables: - bb5_duration: "2:00:00" - SPACK_PACKAGE: neuron - SPACK_PACKAGE_SPEC: +coreneuron+tests~legacy-unit~rx3d build_type=FastDebug model_tests=channel-benchmark,olfactory,tqperf-heavy -.gpu_node: - variables: - bb5_constraint: volta - bb5_cpus_per_task: 2 - bb5_partition: prod # assume this is a good source of GPU nodes - bb5_exclusive: user # allocate gpu node exclusively for the CI user (to avoid errors from oversubscription) -.test_neuron: - extends: [.ctest] - variables: - bb5_ntasks: 16 - bb5_memory: 160G # ~2*16*384/80 (~2x more as we have seen OOMs) - -# Build NMODL once with GCC -build:nmodl: - extends: [.build] - variables: - SPACK_PACKAGE: nmodl - SPACK_PACKAGE_SPEC: ~legacy-unit - SPACK_PACKAGE_COMPILER: gcc - -# Build NEURON -.build_neuron_nmodl: - extends: [.build_neuron] - needs: ["build:nmodl"] - -build:neuron:nmodl:intel:legacy: - extends: [.build_neuron_nmodl, .spack_intel] - variables: - SPACK_PACKAGE_SPEC: ~rx3d~caliper~gpu+coreneuron~legacy-unit~openmp~shared~sympy+tests build_type=FastDebug model_tests=channel-benchmark,olfactory,tqperf-heavy - -build:neuron:nmodl:intel:shared: - extends: [.build_neuron_nmodl, .spack_intel] - variables: - SPACK_PACKAGE_SPEC: ~rx3d~caliper~gpu+coreneuron~legacy-unit~openmp+shared+sympy+tests build_type=FastDebug model_tests=channel-benchmark,olfactory,tqperf-heavy - -build:neuron:nmodl:nvhpc:acc:legacy: - extends: [.build_neuron_nmodl, .spack_nvhpc] - variables: - SPACK_PACKAGE_SPEC: ~rx3d~caliper+gpu+coreneuron~legacy-unit~openmp~shared~sympy+tests~unified build_type=FastDebug model_tests=channel-benchmark,olfactory,tqperf-heavy - -build:neuron:nmodl:nvhpc:acc:shared: - extends: [.build_neuron_nmodl, .spack_nvhpc] - variables: - SPACK_PACKAGE_SPEC: ~rx3d~caliper+gpu+coreneuron~legacy-unit~openmp+shared+sympy+tests~unified build_type=FastDebug model_tests=channel-benchmark,olfactory,tqperf-heavy - -build:neuron:nmodl:nvhpc:omp:legacy: - extends: [.build_neuron_nmodl, .spack_nvhpc] - variables: - SPACK_PACKAGE_SPEC: ~rx3d+caliper+gpu+coreneuron~legacy-unit+openmp~shared~sympy+tests~unified build_type=FastDebug model_tests=channel-benchmark,olfactory,tqperf-heavy ^caliper+cuda cuda_arch=70 - -build:neuron:nmodl:nvhpc:omp: - extends: [.build_neuron_nmodl, .spack_nvhpc] - variables: - SPACK_PACKAGE_SPEC: ~rx3d+caliper+gpu+coreneuron~legacy-unit+openmp~shared+sympy+tests~unified build_type=FastDebug model_tests=channel-benchmark,olfactory,tqperf-heavy ^caliper+cuda cuda_arch=70 - -# Test NEURON - -test:neuron:nmodl:intel:legacy: - extends: [.test_neuron] - needs: ["build:neuron:nmodl:intel:legacy"] - -test:neuron:nmodl:intel:shared: - extends: [.test_neuron] - needs: ["build:neuron:nmodl:intel:shared"] - -test:neuron:nmodl:nvhpc:acc:legacy: - extends: [.test_neuron, .gpu_node] - needs: ["build:neuron:nmodl:nvhpc:acc:legacy"] - -test:neuron:nmodl:nvhpc:acc:shared: - extends: [.test_neuron, .gpu_node] - needs: ["build:neuron:nmodl:nvhpc:acc:shared"] - -test:neuron:nmodl:nvhpc:omp:legacy: - extends: [.test_neuron, .gpu_node] - needs: ["build:neuron:nmodl:nvhpc:omp:legacy"] - -test:neuron:nmodl:nvhpc:omp: - extends: [.test_neuron, .gpu_node] - needs: ["build:neuron:nmodl:nvhpc:omp"] - - -# Container building -mac_m1_container_build: - stage: .pre - tags: - - macos-arm64 - script: - - if [ -z "${ARM64_IMAGE_TAG}" ]; then - - echo "Please set the ARM64_IMAGE_TAG variable" - - exit 1 - - fi - - cd packaging/python - - echo "Replacing symlinks with their targets to keep podman happy" - - find . -type l -exec cp $(realpath {}) ./TEMP \; -exec rm {} \; -exec mv TEMP {} \; - - ls -l - - export BUILDAH_FORMAT=docker # enables ONBUILD instructions which are not OCI compatible - - machine_status=$(podman machine inspect | awk '/State/ {print $2}' | tr -d '",') - # If you start the machine yourself, make sure BUILDAH_FORMAT and the http proxy variables are set in the shell before doing so! - - if [[ "${machine_status}" != "running" ]]; then - - echo "Machine is in ${machine_status} status - starting" - - podman machine start - - fi - - podman build -t neuronsimulator/neuron_wheel:${ARM64_IMAGE_TAG} --build-arg MANYLINUX_IMAGE=manylinux2014_aarch64 -f Dockerfile . - - podman login -u ${DOCKER_HUB_USER} -p ${DOCKER_HUB_AUTH_TOKEN} docker.io - - podman push neuronsimulator/neuron_wheel:${ARM64_IMAGE_TAG} - - podman rmi localhost/neuronsimulator/neuron_wheel:${ARM64_IMAGE_TAG} - rules: - - if: $CI_PIPELINE_SOURCE == "web" - when: manual - -x86_64_container_build: - stage: .pre - image: - name: quay.io/buildah/stable - entrypoint: [""] - variables: - KUBERNETES_CPU_LIMIT: 4 - KUBERNETES_CPU_REQUEST: 2 - KUBERNETES_MEMORY_LIMIT: 8Gi - KUBERNETES_MEMORY_REQUEST: 4Gi - tags: - - kubernetes - rules: - - if: $CI_PIPELINE_SOURCE == "web" - when: manual - script: - - if [ -z "${X86_IMAGE_TAG}" ]; then - - echo "Please set the X86_IMAGE_TAG variable" - - exit 1 - - fi - - export STORAGE_DRIVER=vfs # allows to build inside containers without additional mounts - - export BUILDAH_FORMAT=docker # enables ONBUILD instructions which are not OCI compatible - - cd packaging/python - - buildah bud --iidfile image_id -t neuronsimulator/neuron_wheel:${X86_IMAGE_TAG} -f Dockerfile . - - buildah login -u ${DOCKER_HUB_USER} -p ${DOCKER_HUB_AUTH_TOKEN} docker.io - - buildah push $( [Azure artifacts URL]($(dropurl)) From df895eaacdee8ed62c6109ff436277ef09b101c9 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Wed, 6 Nov 2024 10:49:26 +0100 Subject: [PATCH 03/19] Skip RXD tests on ARM --- share/lib/python/neuron/tests/test_rxd.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/share/lib/python/neuron/tests/test_rxd.py b/share/lib/python/neuron/tests/test_rxd.py index dc6cd2aef8..a7ecabbb46 100644 --- a/share/lib/python/neuron/tests/test_rxd.py +++ b/share/lib/python/neuron/tests/test_rxd.py @@ -4,6 +4,7 @@ import sys import os import json +import platform from multiprocessing import Process, Lock try: @@ -156,6 +157,10 @@ def test_ecs_diffusion_fixed_step(self): assert p.exitcode == 0 return 0 + @unittest.skipIf( + platform.machine() in ["aarch64", "arm64"], + "see discussion in #3143", + ) def test_ecs_diffusion_variable_step_coarse(self): p = Process(target=trivial_ecs, args=(1e-2, self.lock, self.path)) p.start() @@ -163,6 +168,10 @@ def test_ecs_diffusion_variable_step_coarse(self): assert p.exitcode == 0 return 0 + @unittest.skipIf( + platform.machine() in ["aarch64", "arm64"], + "see discussion in #3143", + ) def test_ecs_diffusion_variable_step_fine(self): p = Process(target=trivial_ecs, args=(1e-5, self.lock, self.path)) p.start() From acd3632f590724fe1ea6d8ae9e4e1a680aa3ca8c Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 15:29:40 +0100 Subject: [PATCH 04/19] Slight refinements --- .github/workflows/wheels.yml | 77 +++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a8c8f3b93b..483ad3273a 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -1,6 +1,8 @@ name: Build MacOS Wheels on: + schedule: + - cron: "0 0 * * *" push: branches: - master @@ -8,13 +10,25 @@ on: branches: - master -# do not cancel so we can see results -concurrency: - cancel-in-progress: false - group: ${{ github.workflow }}-${{ github.ref }} + workflow_dispatch: + inputs: + rel_release: + description: Release branch/commit + default: 'release/x.y' + required: true + rel_version: + description: Release version (tag name) + default: 'x.y.z' + required: true + upload: + description: Whether to upload to PyPI or not + default: 'false' + required: false + type: 'boolean' + jobs: - build-test-deploy: + build-test: name: Build MacOS Wheels runs-on: ${{ matrix.os }} timeout-minutes: 60 @@ -23,6 +37,13 @@ jobs: os: [macos-14] python-version: ['3.10', '3.11', '3.12'] # change later + environment: + name: pypi + url: https://pypi.org/p/NEURON-nightly + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: - name: Check out code uses: actions/checkout@v4 @@ -48,6 +69,20 @@ jobs: sudo mkdir -p /opt/nrnwheel/$(uname -m) sudo bash packaging/python/build_static_readline_osx.bash + - name: Set env based in input + if: github.event_name == 'schedule' && startsWith(github.ref, 'refs/master') + run: + echo "NRN_NIGHTLY_UPLOAD='true'" >> $GITHUB_ENV + echo "NRN_RELEASE_UPLOAD='false'" >> $GITHUB_ENV + echo "NEURON_NIGHTLY_TAG='-nightly'" >> $GITHUB_ENV + + - name: Set env based in release input + if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/release') + run: + echo "NRN_NIGHTLY_UPLOAD='false'" >> $GITHUB_ENV + echo "NRN_RELEASE_UPLOAD='false'" >> $GITHUB_ENV + echo "NEURON_NIGHTLY_TAG=''" >> $GITHUB_ENV + - name: Build MacOS Wheel run: | packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron @@ -62,3 +97,35 @@ jobs: with: name: macos-wheels-${{ matrix.python-version }} path: wheelhouse/*.whl + + +# publish-to-pypi: +# name: Publish MacOS ARM Python wheels to PyPI +# needs: +# - build-test +# +# strategy: +# matrix: +# os: [ubuntu-latest] +# # why do we need a matrix? because github uploads separate artifacts for each job above +# # maybe when we start using cibuildwheel we can build all of them in one job... +# python-version: ['3.10', '3.11', '3.12'] # make sure to keep in sync with the one from job above +# +# environment: +# name: pypi +# url: https://pypi.org/p/NEURON-nightly +# +# permissions: +# id-token: write # IMPORTANT: mandatory for trusted publishing +# +# steps: +# - name: Download all the dists +# uses: actions/download-artifact@v4 +# with: +# name: macos-wheels-${{ matrix.python-version }} +# path: wheelhouse/ +# +# - name: Publish wheels to PyPI +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# packages-dir: wheelhouse/ From 00fa4533b23b26075b19d1d95ba5cd2a65f50282 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 15:52:53 +0100 Subject: [PATCH 05/19] Minor improvements --- .github/workflows/wheels.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 483ad3273a..5f0e3aefa9 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -37,16 +37,17 @@ jobs: os: [macos-14] python-version: ['3.10', '3.11', '3.12'] # change later - environment: - name: pypi - url: https://pypi.org/p/NEURON-nightly - - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - steps: - name: Check out code + if: github.event_name != 'workflow_dispatch' + uses: actions/checkout@v4 + + - name: Check out code for release + if: github.event_name == 'workflow_dispatch' uses: actions/checkout@v4 + with: + ref: ${{ github.inputs.rel_release }} + - uses: actions/setup-python@v5 with: @@ -76,12 +77,13 @@ jobs: echo "NRN_RELEASE_UPLOAD='false'" >> $GITHUB_ENV echo "NEURON_NIGHTLY_TAG='-nightly'" >> $GITHUB_ENV - - name: Set env based in release input + - name: Set env based in input for release if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/release') run: echo "NRN_NIGHTLY_UPLOAD='false'" >> $GITHUB_ENV - echo "NRN_RELEASE_UPLOAD='false'" >> $GITHUB_ENV + echo "NRN_RELEASE_UPLOAD='${{ github.inputs.upload }}'" >> $GITHUB_ENV echo "NEURON_NIGHTLY_TAG=''" >> $GITHUB_ENV + echo "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.inputs.rel_version }}" >> $GITHUB_ENV - name: Build MacOS Wheel run: | @@ -104,9 +106,10 @@ jobs: # needs: # - build-test # +# runs-on: ubuntu-latest +# # strategy: # matrix: -# os: [ubuntu-latest] # # why do we need a matrix? because github uploads separate artifacts for each job above # # maybe when we start using cibuildwheel we can build all of them in one job... # python-version: ['3.10', '3.11', '3.12'] # make sure to keep in sync with the one from job above From 6e365ef4d541dd7dbf364f81bd36ad7fad17a1ac Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 15:54:42 +0100 Subject: [PATCH 06/19] Whitespace? --- .github/workflows/wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5f0e3aefa9..82d09440bb 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -45,8 +45,8 @@ jobs: - name: Check out code for release if: github.event_name == 'workflow_dispatch' uses: actions/checkout@v4 - with: - ref: ${{ github.inputs.rel_release }} + with: + ref: ${{ github.inputs.rel_release }} - uses: actions/setup-python@v5 From a861e1b2490645681c7e53539729a54b09a5987c Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 16:39:15 +0100 Subject: [PATCH 07/19] Maybe now it runs? --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 82d09440bb..50bdd15dc9 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -78,7 +78,7 @@ jobs: echo "NEURON_NIGHTLY_TAG='-nightly'" >> $GITHUB_ENV - name: Set env based in input for release - if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/release') + if: github.event_name == 'workflow_dispatch' run: echo "NRN_NIGHTLY_UPLOAD='false'" >> $GITHUB_ENV echo "NRN_RELEASE_UPLOAD='${{ github.inputs.upload }}'" >> $GITHUB_ENV From 29a269a7213da475cca1c6ad6235bea90438ae46 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 18:21:08 +0100 Subject: [PATCH 08/19] Debug time --- .github/workflows/wheels.yml | 66 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 50bdd15dc9..a13febb6be 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -53,22 +53,22 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install OSX System Dependencies - run: | - brew install --cask xquartz - brew install flex bison mpich - brew unlink mpich && brew install openmpi - cmake --version - # Uninstall libomp for compatibility with issue #817 - brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist" - brew install cmake - echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH - echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH - - - name: Install readline - run: | - sudo mkdir -p /opt/nrnwheel/$(uname -m) - sudo bash packaging/python/build_static_readline_osx.bash + #- name: Install OSX System Dependencies + # run: | + # brew install --cask xquartz + # brew install flex bison mpich + # brew unlink mpich && brew install openmpi + # cmake --version + # # Uninstall libomp for compatibility with issue #817 + # brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist" + # brew install cmake + # echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH + # echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH + + #- name: Install readline + # run: | + # sudo mkdir -p /opt/nrnwheel/$(uname -m) + # sudo bash packaging/python/build_static_readline_osx.bash - name: Set env based in input if: github.event_name == 'schedule' && startsWith(github.ref, 'refs/master') @@ -81,24 +81,24 @@ jobs: if: github.event_name == 'workflow_dispatch' run: echo "NRN_NIGHTLY_UPLOAD='false'" >> $GITHUB_ENV - echo "NRN_RELEASE_UPLOAD='${{ github.inputs.upload }}'" >> $GITHUB_ENV + echo NRN_RELEASE_UPLOAD=${{ github.inputs.upload }} >> $GITHUB_ENV echo "NEURON_NIGHTLY_TAG=''" >> $GITHUB_ENV - echo "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.inputs.rel_version }}" >> $GITHUB_ENV - - - name: Build MacOS Wheel - run: | - packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron - - - name: Test wheel - run: | - minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" - packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl - - - name: Upload wheel files - uses: actions/upload-artifact@v3 - with: - name: macos-wheels-${{ matrix.python-version }} - path: wheelhouse/*.whl + echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.inputs.rel_version }} >> $GITHUB_ENV + + #- name: Build MacOS Wheel + # run: | + # packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron + + #- name: Test wheel + # run: | + # minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" + # packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl + + #- name: Upload wheel files + # uses: actions/upload-artifact@v3 + # with: + # name: macos-wheels-${{ matrix.python-version }} + # path: wheelhouse/*.whl # publish-to-pypi: From eaea5b7620f4ebca3e4ce3904296998187a1bd1c Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 18:23:38 +0100 Subject: [PATCH 09/19] Multiline fix --- .github/workflows/wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a13febb6be..ec48e6bf23 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -72,14 +72,14 @@ jobs: - name: Set env based in input if: github.event_name == 'schedule' && startsWith(github.ref, 'refs/master') - run: + run: | echo "NRN_NIGHTLY_UPLOAD='true'" >> $GITHUB_ENV echo "NRN_RELEASE_UPLOAD='false'" >> $GITHUB_ENV echo "NEURON_NIGHTLY_TAG='-nightly'" >> $GITHUB_ENV - name: Set env based in input for release if: github.event_name == 'workflow_dispatch' - run: + run: | echo "NRN_NIGHTLY_UPLOAD='false'" >> $GITHUB_ENV echo NRN_RELEASE_UPLOAD=${{ github.inputs.upload }} >> $GITHUB_ENV echo "NEURON_NIGHTLY_TAG=''" >> $GITHUB_ENV From f41f5fe3ebb0ef35a49a3f7b26b855f47dbd9bc7 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 18:27:31 +0100 Subject: [PATCH 10/19] Try this --- .github/workflows/wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index ec48e6bf23..ee53ac425a 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -81,9 +81,9 @@ jobs: if: github.event_name == 'workflow_dispatch' run: | echo "NRN_NIGHTLY_UPLOAD='false'" >> $GITHUB_ENV - echo NRN_RELEASE_UPLOAD=${{ github.inputs.upload }} >> $GITHUB_ENV + echo NRN_RELEASE_UPLOAD=${{ github.event.inputs.upload }} >> $GITHUB_ENV echo "NEURON_NIGHTLY_TAG=''" >> $GITHUB_ENV - echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.inputs.rel_version }} >> $GITHUB_ENV + echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.rel_version }} >> $GITHUB_ENV #- name: Build MacOS Wheel # run: | From 06dad780624a4e7ecc916bf5977e1436c6f85b59 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 18:29:08 +0100 Subject: [PATCH 11/19] See if it works now --- .github/workflows/wheels.yml | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index ee53ac425a..2ca3654bd0 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -35,7 +35,7 @@ jobs: strategy: matrix: os: [macos-14] - python-version: ['3.10', '3.11', '3.12'] # change later + python-version: ['3.10'] steps: - name: Check out code @@ -53,22 +53,22 @@ jobs: with: python-version: ${{ matrix.python-version }} - #- name: Install OSX System Dependencies - # run: | - # brew install --cask xquartz - # brew install flex bison mpich - # brew unlink mpich && brew install openmpi - # cmake --version - # # Uninstall libomp for compatibility with issue #817 - # brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist" - # brew install cmake - # echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH - # echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH - - #- name: Install readline - # run: | - # sudo mkdir -p /opt/nrnwheel/$(uname -m) - # sudo bash packaging/python/build_static_readline_osx.bash + - name: Install OSX System Dependencies + run: | + brew install --cask xquartz + brew install flex bison mpich + brew unlink mpich && brew install openmpi + cmake --version + # Uninstall libomp for compatibility with issue #817 + brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist" + brew install cmake + echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH + echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH + + - name: Install readline + run: | + sudo mkdir -p /opt/nrnwheel/$(uname -m) + sudo bash packaging/python/build_static_readline_osx.bash - name: Set env based in input if: github.event_name == 'schedule' && startsWith(github.ref, 'refs/master') @@ -85,20 +85,20 @@ jobs: echo "NEURON_NIGHTLY_TAG=''" >> $GITHUB_ENV echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.rel_version }} >> $GITHUB_ENV - #- name: Build MacOS Wheel - # run: | - # packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron + - name: Build MacOS Wheel + run: | + packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron - #- name: Test wheel - # run: | - # minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" - # packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl + - name: Test wheel + run: | + minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl - #- name: Upload wheel files - # uses: actions/upload-artifact@v3 - # with: - # name: macos-wheels-${{ matrix.python-version }} - # path: wheelhouse/*.whl + - name: Upload wheel files + uses: actions/upload-artifact@v3 + with: + name: macos-wheels-${{ matrix.python-version }} + path: wheelhouse/*.whl # publish-to-pypi: From c939aa0f877e6787e4b99ad400c8bd927049e045 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 18:39:01 +0100 Subject: [PATCH 12/19] Try this? --- .github/workflows/wheels.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 2ca3654bd0..7fa402ed30 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -73,16 +73,15 @@ jobs: - name: Set env based in input if: github.event_name == 'schedule' && startsWith(github.ref, 'refs/master') run: | - echo "NRN_NIGHTLY_UPLOAD='true'" >> $GITHUB_ENV - echo "NRN_RELEASE_UPLOAD='false'" >> $GITHUB_ENV - echo "NEURON_NIGHTLY_TAG='-nightly'" >> $GITHUB_ENV + echo "NRN_NIGHTLY_UPLOAD=true" >> $GITHUB_ENV + echo "NRN_RELEASE_UPLOAD=false" >> $GITHUB_ENV + echo "NEURON_NIGHTLY_TAG=-nightly" >> $GITHUB_ENV - name: Set env based in input for release if: github.event_name == 'workflow_dispatch' run: | - echo "NRN_NIGHTLY_UPLOAD='false'" >> $GITHUB_ENV + echo "NRN_NIGHTLY_UPLOAD=false" >> $GITHUB_ENV echo NRN_RELEASE_UPLOAD=${{ github.event.inputs.upload }} >> $GITHUB_ENV - echo "NEURON_NIGHTLY_TAG=''" >> $GITHUB_ENV echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.rel_version }} >> $GITHUB_ENV - name: Build MacOS Wheel From 3dd5aec9aec4a0232bf12ac889c7e73e5cd08a63 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Thu, 7 Nov 2024 18:50:16 +0100 Subject: [PATCH 13/19] No `_nightly` please --- .github/workflows/wheels.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 7fa402ed30..cafc7db377 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -82,6 +82,7 @@ jobs: run: | echo "NRN_NIGHTLY_UPLOAD=false" >> $GITHUB_ENV echo NRN_RELEASE_UPLOAD=${{ github.event.inputs.upload }} >> $GITHUB_ENV + echo "NEURON_NIGHTLY_TAG=" >> $GITHUB_ENV echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.rel_version }} >> $GITHUB_ENV - name: Build MacOS Wheel From a9d001de0240f53201773a5db1cd74106a3b7d1d Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 8 Nov 2024 10:13:42 +0100 Subject: [PATCH 14/19] Temp commit to see it actually works --- .github/workflows/wheels.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index cafc7db377..8ef2c03419 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -41,6 +41,8 @@ jobs: - name: Check out code if: github.event_name != 'workflow_dispatch' uses: actions/checkout@v4 + with: + ref: master - name: Check out code for release if: github.event_name == 'workflow_dispatch' @@ -71,7 +73,7 @@ jobs: sudo bash packaging/python/build_static_readline_osx.bash - name: Set env based in input - if: github.event_name == 'schedule' && startsWith(github.ref, 'refs/master') + if: github.event_name == 'push' && startsWith(github.ref, 'refs/master') run: | echo "NRN_NIGHTLY_UPLOAD=true" >> $GITHUB_ENV echo "NRN_RELEASE_UPLOAD=false" >> $GITHUB_ENV From 3df93cfff75b6c9386703bdb84c8ffac2190b9cb Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 8 Nov 2024 10:19:57 +0100 Subject: [PATCH 15/19] Fix branch name --- .github/workflows/wheels.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 8ef2c03419..1b53109269 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -41,8 +41,6 @@ jobs: - name: Check out code if: github.event_name != 'workflow_dispatch' uses: actions/checkout@v4 - with: - ref: master - name: Check out code for release if: github.event_name == 'workflow_dispatch' @@ -73,7 +71,7 @@ jobs: sudo bash packaging/python/build_static_readline_osx.bash - name: Set env based in input - if: github.event_name == 'push' && startsWith(github.ref, 'refs/master') + if: github.event_name == 'schedule' && startsWith(github.ref, 'refs/heads/master') run: | echo "NRN_NIGHTLY_UPLOAD=true" >> $GITHUB_ENV echo "NRN_RELEASE_UPLOAD=false" >> $GITHUB_ENV From 5d9290e5d5107a319f1dadd0e9ecafbe36c92cc8 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 8 Nov 2024 10:26:58 +0100 Subject: [PATCH 16/19] Cache readline --- .github/workflows/wheels.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 1b53109269..30e604b4f5 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -65,7 +65,17 @@ jobs: echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH + - name: Cache readline + id: cache-readline + uses: actions/cache@v3 + with: + path: /opt/nrnwheel/$(uname -m) + key: readline-${{ runner.os }}-${{ hashFiles('packaging/python/build_static_readline_osx.bash') }} + restore-keys: | + readline-${{ runner.os }}- + - name: Install readline + if: steps.cache-readline.outputs.cache-hit != 'true' run: | sudo mkdir -p /opt/nrnwheel/$(uname -m) sudo bash packaging/python/build_static_readline_osx.bash From abdd2fc596fe39107e1a8b1bebef05683a15abd1 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 8 Nov 2024 10:43:02 +0100 Subject: [PATCH 17/19] Make actions more agnostic to distros --- .github/workflows/wheels.yml | 77 +++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 30e604b4f5..0cc408a36c 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -29,7 +29,7 @@ on: jobs: build-test: - name: Build MacOS Wheels + name: Build Python wheels runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: @@ -48,12 +48,12 @@ jobs: with: ref: ${{ github.inputs.rel_release }} - - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install OSX System Dependencies + - name: Install MacOS System Dependencies + if: startsWith(runner.os, 'macOS') run: | brew install --cask xquartz brew install flex bison mpich @@ -66,6 +66,7 @@ jobs: echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH - name: Cache readline + if: startsWith(runner.os, 'macOS') id: cache-readline uses: actions/cache@v3 with: @@ -75,7 +76,7 @@ jobs: readline-${{ runner.os }}- - name: Install readline - if: steps.cache-readline.outputs.cache-hit != 'true' + if: startsWith(runner.os, 'macOS') && steps.cache-readline.outputs.cache-hit != 'true' run: | sudo mkdir -p /opt/nrnwheel/$(uname -m) sudo bash packaging/python/build_static_readline_osx.bash @@ -95,7 +96,8 @@ jobs: echo "NEURON_NIGHTLY_TAG=" >> $GITHUB_ENV echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.rel_version }} >> $GITHUB_ENV - - name: Build MacOS Wheel + - name: Build wheels on MacOS + if: startsWith(runner.os, 'macOS') run: | packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron @@ -107,38 +109,39 @@ jobs: - name: Upload wheel files uses: actions/upload-artifact@v3 with: - name: macos-wheels-${{ matrix.python-version }} + name: wheels-${{ matrix.python-version }} path: wheelhouse/*.whl -# publish-to-pypi: -# name: Publish MacOS ARM Python wheels to PyPI -# needs: -# - build-test -# -# runs-on: ubuntu-latest -# -# strategy: -# matrix: -# # why do we need a matrix? because github uploads separate artifacts for each job above -# # maybe when we start using cibuildwheel we can build all of them in one job... -# python-version: ['3.10', '3.11', '3.12'] # make sure to keep in sync with the one from job above -# -# environment: -# name: pypi -# url: https://pypi.org/p/NEURON-nightly -# -# permissions: -# id-token: write # IMPORTANT: mandatory for trusted publishing -# -# steps: -# - name: Download all the dists -# uses: actions/download-artifact@v4 -# with: -# name: macos-wheels-${{ matrix.python-version }} -# path: wheelhouse/ -# -# - name: Publish wheels to PyPI -# uses: pypa/gh-action-pypi-publish@release/v1 -# with: -# packages-dir: wheelhouse/ + publish-to-pypi: + name: Publish Python wheels to PyPI + if: (github.event_name == 'schedule' && startsWith(github.ref, 'refs/heads/master')) || github.event_name == 'workflow_dispatch' + needs: + - build-test + + runs-on: ubuntu-latest + + strategy: + matrix: + # why do we need a matrix? because github uploads separate artifacts for each job above + # maybe when we start using cibuildwheel we can build all of them in one job... + python-version: ['3.10'] # make sure to keep in sync with the one from job above + + environment: + name: pypi + url: https://pypi.org/p/NEURON-nightly + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: wheels-${{ matrix.python-version }} + path: wheelhouse/ + + #- name: Publish wheels to PyPI + # uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # packages-dir: wheelhouse/ From 835e3ad91235179d5496c2ba4f93fc5d73831db4 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 8 Nov 2024 11:24:13 +0100 Subject: [PATCH 18/19] Minor improvements --- .github/workflows/wheels.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 0cc408a36c..57f96f32f4 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -1,4 +1,4 @@ -name: Build MacOS Wheels +name: Build NEURON Python wheels on: schedule: @@ -35,7 +35,7 @@ jobs: strategy: matrix: os: [macos-14] - python-version: ['3.10'] + python-version: ['3.10'] # TODO update before making as ready steps: - name: Check out code @@ -81,14 +81,14 @@ jobs: sudo mkdir -p /opt/nrnwheel/$(uname -m) sudo bash packaging/python/build_static_readline_osx.bash - - name: Set env based in input + - name: Set env for nightly if: github.event_name == 'schedule' && startsWith(github.ref, 'refs/heads/master') run: | echo "NRN_NIGHTLY_UPLOAD=true" >> $GITHUB_ENV echo "NRN_RELEASE_UPLOAD=false" >> $GITHUB_ENV echo "NEURON_NIGHTLY_TAG=-nightly" >> $GITHUB_ENV - - name: Set env based in input for release + - name: Set env for release if: github.event_name == 'workflow_dispatch' run: | echo "NRN_NIGHTLY_UPLOAD=false" >> $GITHUB_ENV @@ -115,7 +115,8 @@ jobs: publish-to-pypi: name: Publish Python wheels to PyPI - if: (github.event_name == 'schedule' && startsWith(github.ref, 'refs/heads/master')) || github.event_name == 'workflow_dispatch' + # we only run this if it's a nightly upload, or if we are doing a release + if: (github.event_name == 'schedule' && startsWith(github.ref, 'refs/heads/master')) || (github.event_name == 'workflow_dispatch' && github.inputs.upload == 'true') needs: - build-test From 4648d9491ebe1d06ff5c8168695b86a93c0f3482 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 8 Nov 2024 16:13:31 +0100 Subject: [PATCH 19/19] Minor fixes --- .github/workflows/wheels.yml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 57f96f32f4..d31bb6a457 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -65,18 +65,8 @@ jobs: echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH - - name: Cache readline - if: startsWith(runner.os, 'macOS') - id: cache-readline - uses: actions/cache@v3 - with: - path: /opt/nrnwheel/$(uname -m) - key: readline-${{ runner.os }}-${{ hashFiles('packaging/python/build_static_readline_osx.bash') }} - restore-keys: | - readline-${{ runner.os }}- - - name: Install readline - if: startsWith(runner.os, 'macOS') && steps.cache-readline.outputs.cache-hit != 'true' + if: startsWith(runner.os, 'macOS') run: | sudo mkdir -p /opt/nrnwheel/$(uname -m) sudo bash packaging/python/build_static_readline_osx.bash @@ -107,7 +97,7 @@ jobs: packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl - name: Upload wheel files - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.python-version }} path: wheelhouse/*.whl @@ -116,7 +106,7 @@ jobs: publish-to-pypi: name: Publish Python wheels to PyPI # we only run this if it's a nightly upload, or if we are doing a release - if: (github.event_name == 'schedule' && startsWith(github.ref, 'refs/heads/master')) || (github.event_name == 'workflow_dispatch' && github.inputs.upload == 'true') + if: (github.event_name == 'schedule' && startsWith(github.ref, 'refs/heads/master')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.upload == 'true') needs: - build-test