-
Notifications
You must be signed in to change notification settings - Fork 118
147 lines (124 loc) · 4.63 KB
/
wheels.yml
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
name: Build MacOS Wheels
on:
schedule:
- cron: "0 0 * * *"
push:
branches:
- master
pull_request:
branches:
- master
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:
name: Build Python wheels
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
os: [macos-14]
python-version: ['3.10']
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:
python-version: ${{ matrix.python-version }}
- name: Install MacOS System Dependencies
if: startsWith(runner.os, 'macOS')
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: 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'
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/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
if: github.event_name == 'workflow_dispatch'
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 wheels on MacOS
if: startsWith(runner.os, 'macOS')
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: wheels-${{ matrix.python-version }}
path: wheelhouse/*.whl
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/