-
Notifications
You must be signed in to change notification settings - Fork 142
216 lines (185 loc) · 6.19 KB
/
Copy pathcd.yml
File metadata and controls
216 lines (185 loc) · 6.19 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: wheels and conda
on:
workflow_dispatch:
release:
types:
- published
pull_request:
paths:
- .github/workflows/cd.yml
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# Many color libraries just need this to be set to any value, but at least
# one distinguishes color depth, where "3" -> "256-bit color".
FORCE_COLOR: 3
jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
build_wheels:
name: Wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
fail-fast: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Use intel mpi on windows
- uses: mpi4py/setup-mpi@v1
if: ${{ contains(matrix.os, 'windows') }}
with:
mpi: msmpi
# Else, use the default for the OS and setup-mpi action
- uses: mpi4py/setup-mpi@v1
if: ${{ !contains(matrix.os, 'windows') }}
- name: Checkout LLVM on macOS
if: runner.os == 'macOS'
uses: actions/checkout@v4
with:
repository: llvm/llvm-project
ref: release/18.x
path: llvm-project
- name: Build OpenMP on macOS
if: runner.os == 'macOS'
env:
MACOSX_DEPLOYMENT_TARGET: "10.9"
working-directory: llvm-project
run: |
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$(brew --prefix) \
-DCMAKE_INSTALL_NAME_DIR=$(brew --prefix)/lib \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLIBOMP_INSTALL_ALIASES=OFF \
-S openmp \
-B build
cmake --build build --parallel
cmake --install build
- uses: actions/setup-python@v5
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_conda:
name: Conda on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -leo pipefail {0}
strategy:
matrix:
os: [ ubuntu-latest, macos-13, macos-latest ]
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Can't figure out a way to get the package version from setuptools_scm inside the conda build
# We need to install setuptools_scm, call it as a module, and store the version in an environment variable
- name: Run setuptools_scm to get package version and store in environment variable BRAINIAK_VERSION (Linux\Mac)
if: ${{ !contains(matrix.os, 'windows') }}
run: |
python -m pip install setuptools_scm
export BRAINIAK_VERSION=$(python -m setuptools_scm)
echo "BRAINIAK_VERSION=${BRAINIAK_VERSION}" >> "$GITHUB_ENV"
- name: Run setuptools_scm to get package version and store in environment variable BRAINIAK_VERSION (Windows)
if: ${{ contains(matrix.os, 'windows') }}
run: |
python -m pip install setuptools_scm
set BRAINIAK_VERSION=$(python -m setuptools_scm)
echo "BRAINIAK_VERSION=${BRAINIAK_VERSION}" >> "$GITHUB_ENV"
- name: Setup micromamba and boa
uses: mamba-org/setup-micromamba@v1
with:
environment-name: test-env
create-args: >-
python=${{ matrix.python-version }}
conda-forge::conda-build
boa
init-shell: >-
bash
powershell
- name: Build and test package
id: build-package
run: |
conda config --add channels conda-forge
conda config --set channel_priority strict
conda mambabuild --output-folder=conda-package .conda/
- uses: actions/upload-artifact@v4
with:
name: conda-package-${{ matrix.os }}-${{ matrix.python-version }}
path: conda-package
publish_pypi:
name: Publish to PyPI
needs: [ build_wheels, build_conda, make_sdist ]
environment:
name: pypi
url: https://pypi.org/p/brainiak
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: List files in artifact(s)
run: ls -l dist
- uses: pypa/gh-action-pypi-publish@release/v1
publish_conda:
name: Publish to Anaconda
needs: [ build_conda, build_wheels, make_sdist ]
environment: anaconda
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
defaults:
run:
shell: bash -leo pipefail {0}
steps:
- uses: actions/download-artifact@v4
with:
pattern: conda-package-*
path: conda-packages
merge-multiple: false
- name: List files in artifact
run: find conda-packages -type f -name "*.tar.bz2"
- name: Setup micromamba and anaconda-client
uses: mamba-org/setup-micromamba@v1
with:
environment-name: test-env
create-args: >-
anaconda-client
init-shell: >-
bash
- name: Upload to Anaconda
run: |
export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
for file in $(find conda-packages -type f -name "*.tar.bz2"); do
echo "Uploading $file"
anaconda upload "$file"
done