-
Notifications
You must be signed in to change notification settings - Fork 148
161 lines (143 loc) · 6.1 KB
/
Copy pathwheels-template.yml
File metadata and controls
161 lines (143 loc) · 6.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Template for building NEURON Python wheels
on:
workflow_call:
inputs:
platform:
description: The platform (OS) for which to build the wheel
required: true
type: string
python_version:
description: The Python version for which to build the wheel
required: true
type: string
commit:
description: The commit of NEURON for which to build the wheel
required: true
type: string
version:
description: Override version (tag name), in format major.minor.patch
default: ''
type: string
build_type:
description: The type of build (release or nightly)
default: 'nightly'
type: string
clone_depth:
description: The depth to clone the repo
default: '1'
type: string
optimize_rxd:
description: Whether to optimize the RX3D Python module
default: false
type: boolean
jobs:
build-test:
name: Build and test Python ${{ inputs.python_version }} wheel on ${{ inputs.platform }}
runs-on: ${{ inputs.platform }}
timeout-minutes: 60
steps:
- name: Check out code at branch/commit ${{ inputs.commit }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.commit }}
submodules: recursive
fetch-depth: ${{ inputs.clone_depth }}
fetch-tags: true # Ensures tags are available for git describe
- name: Install Python from python.org
if: runner.os == 'macOS'
run: |
# I would've preferred the versions to be in their own YAML file for
# readability, but alas, GitHub Actions does not support expanding
# nested expressions, so we do this the brute-force way with Bash
case "${{ inputs.python_version }}" in
3.10) version="3.10.11" ;;
3.11) version="3.11.7" ;;
3.12) version="3.12.0" ;;
3.13) version="3.13.0" ;;
3.14) version="3.14.0" ;;
*) echo "Unknown Python version"; exit 1 ;;
esac
installer_name="macos11.pkg"
installer_filename="python-${version}-${installer_name}"
url="https://www.python.org/ftp/python/${version}/${installer_filename}"
curl $url -o $installer_filename
sudo installer -pkg $installer_filename -target /
- name: Install system dependencies
if: runner.os == 'macOS'
run: |
brew install --cask xquartz
brew uninstall cmake || echo "CMake was not pre-installed"
brew install flex bison cmake mpich
brew unlink mpich && brew install openmpi
# Install newer version of Bash on MacOS
brew install bash
# For debugging
bash --version
cmake --version
# Handle libomp: ensure it's installed (no longer pre-installed on recent macos-15 runners)
if ! brew list --versions libomp >/dev/null 2>&1; then
echo "libomp not found --> installing"
brew install libomp
else
echo "libomp already installed"
fi
brew link --force libomp || true
# Export paths so later build steps (cibuildwheel, compilers) can find libomp
LIBOMP_PREFIX=$(brew --prefix libomp)
echo "LDFLAGS=-L${LIBOMP_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV
echo "CPPFLAGS=-I${LIBOMP_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=${LIBOMP_PREFIX}/lib:${DYLD_LIBRARY_PATH:-}" >> $GITHUB_ENV
# Force Homebrew bison/flex/cmake to the FRONT of PATH (keg-only, so required)
BREW_PREFIX=$(brew --prefix)
export PATH="${BREW_PREFIX}/opt/bison/bin:${BREW_PREFIX}/opt/flex/bin:${BREW_PREFIX}/opt/cmake/bin:$PATH"
echo "${BREW_PREFIX}/opt/bison/bin:${BREW_PREFIX}/opt/flex/bin:${BREW_PREFIX}/opt/cmake/bin" >> $GITHUB_PATH
# DEBUG: confirm the correct versions are used for the rest of the job
echo "=== DEBUG: bison/flex after PATH force"
which bison
bison --version | head -n 1
which flex
flex --version | head -n 1
- name: Install readline
if: runner.os == 'macOS'
run: |
sudo mkdir -p /opt/nrnwheel/$(uname -m)
sudo bash packaging/python/build_static_readline_osx.bash
- name: Change name of package for release
if: inputs.build_type == 'nightly'
run: |
python3 -m venv venv
source venv/bin/activate
python3 -m pip install tomli tomli-w
python3 packaging/python/change_name.py ./pyproject.toml neuron-nightly
- name: Optimize RX3D Python module
if: inputs.optimize_rxd == true
run: |
echo "NRN_RX3D_OPT_LEVEL=1" >> $GITHUB_ENV
- name: Set custom version
if: inputs.version != ''
run: |
echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Build wheel
run: |
bash packaging/python/build_wheels.bash $(uname -s) ${{ inputs.python_version }}
- name: Upload wheel files
uses: actions/upload-artifact@v4
with:
name: wheels-${{ inputs.python_version }}-${{ inputs.platform }}
path: wheelhouse/*.whl
- name: Setup Python ${{ inputs.python_version }} for testing
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
- name: Install test dependencies
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y mpich openmpi-bin libopenmpi-dev libmpich-dev ninja-build
# Ubuntu 24.04: pin working mpich from ci/deps (no Launchpad download).
# See ci/deps/README.md and LP#2072338.
bash ci/deps/install_mpich_noble.sh
- name: Test wheel with ${{ inputs.python_version }}
run: |
minor_version="$(python${{ inputs.python_version }} -c 'import sys;print(sys.version_info.minor)')"
bash packaging/python/test_wheels.sh $(command -v python${{ inputs.python_version }}) wheelhouse/*cp3${minor_version}*.whl