-
Notifications
You must be signed in to change notification settings - Fork 97
223 lines (197 loc) · 7.89 KB
/
build.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
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
216
217
218
219
220
221
222
223
# PyPI and conda package builds on release.
name: Build
on:
release:
types:
- published
jobs:
build:
name: Build package from release (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "windows-2022", "macos-14"]
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude
include:
# Use this condarc as default
- condarc: .conda/condarc.yaml
- pyver: "3.7"
# Use special condarc if macos
- os: "macos-14"
condarc: .conda_mac/condarc.yaml
pyver: "3.9"
steps:
# Setup
- name: Checkout
uses: actions/checkout@v4
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3.0.3
with:
miniforge-version: latest
condarc-file: ${{ matrix.condarc }}
python-version: ${{ matrix.pyver }}
environment-file: environment_build.yml
activate-environment: sleap_ci
conda-solver: "libmamba"
- name: Print environment info
shell: bash -l {0}
run: |
which python
conda info
conda list
# Build pip wheel (Ubuntu)
- name: Build pip wheel (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
shell: bash -l {0}
run: |
python setup.py bdist_wheel
# Upload pip wheel (Ubuntu)
- name: Upload pip wheel (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
shell: bash -l {0}
run: |
twine upload -u __token__ -p "$PYPI_TOKEN" dist/* --non-interactive --skip-existing --disable-progress-bar
# Build conda package (Ubuntu)
- name: Build conda package (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
shell: bash -l {0}
run: |
conda build .conda --output-folder build
echo "BUILD_PATH=$(pwd)/build" >> "$GITHUB_ENV"
# Build conda package (Windows)
- name: Build conda package (Windows)
if: matrix.os == 'windows-2022'
shell: powershell
run: |
conda build .conda --output-folder build
echo "BUILD_PATH=\$(pwd)\build" >> "$env:GITHUB_ENV"
# Build conda package (Mac)
- name: Build conda package (Mac)
if: matrix.os == 'macos-14'
shell: bash -l {0}
run: |
conda build .conda_mac --output-folder build
echo "BUILD_PATH=$(pwd)/build" >> "$GITHUB_ENV"
# Test built conda package (Ubuntu and Windows)
- name: Test built conda package (Ubuntu and Windows)
if: matrix.os != 'macos-14'
shell: bash -l {0}
run: |
echo "Current build path: $BUILD_PATH"
conda deactivate
echo "Python executable before activating environment:"
which python
echo "Python version before activating environment:"
python --version
echo "Conda info before activating environment:"
conda info
echo "Creating and testing conda environment with sleap package..."
conda create -y -n sleap_test -c file://$BUILD_PATH -c sleap/label/dev -c conda-forge -c nvidia -c anaconda sleap
conda activate sleap_test
echo "Python executable after activating sleap_test environment:"
which python
echo "Python version after activating sleap_test environment:"
python --version
echo "Conda info after activating sleap_test environment:"
conda info
echo "List of installed conda packages in the sleap_test environment:"
conda list
echo "List of installed pip packages in the sleap_test environment:"
pip list
echo "Testing sleap package installation..."
sleap_version=$(python -c "import sleap; print(sleap.__version__)")
echo "Test completed using sleap version: $sleap_version"
# Test built conda package (Mac)
- name: Test built conda package (Mac)
if: matrix.os == 'macos-14'
shell: bash -l {0}
run: |
echo "Current build path: $BUILD_PATH"
conda deactivate
echo "Python executable before activating environment:"
which python
echo "Python version before activating environment:"
python --version
echo "Conda info before activating environment:"
conda info
echo "Creating and testing conda environment with sleap package..."
conda create -y -n sleap_test -c file://$BUILD_PATH -c conda-forge -c anaconda sleap
conda activate sleap_test
echo "Python executable after activating sleap_test environment:"
which python
echo "Python version after activating sleap_test environment:"
python --version
echo "Conda info after activating sleap_test environment:"
conda info
echo "List of installed conda packages in the sleap_test environment:"
conda list
echo "List of installed pip packages in the sleap_test environment:"
pip list
echo "Testing sleap package installation..."
sleap_version=$(python -c "import sleap; print(sleap.__version__)")
echo "Test completed using sleap version: $sleap_version"
# Login to conda (Ubuntu)
- name: Login to Anaconda (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
env:
ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
shell: bash -l {0}
run: |
yes 2>/dev/null | anaconda login --username sleap --password "$ANACONDA_LOGIN" || true
# Login to conda (Windows)
- name: Login to Anaconda (Windows)
if: matrix.os == 'windows-2022'
env:
ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
shell: powershell
run: |
echo "yes" | anaconda login --username sleap --password "$env:ANACONDA_LOGIN"
# Login to conda (Mac)
- name: Login to Anaconda (Mac)
if: matrix.os == 'macos-14'
env:
ANACONDA_LOGIN: ${{ secrets.ANACONDA_LOGIN }}
shell: bash -l {0}
run: |
yes 2>/dev/null | anaconda login --username sleap --password "$ANACONDA_LOGIN" || true
# Upload conda package (Windows)
- name: Upload conda package (Windows/main)
if: matrix.os == 'windows-2022' && !github.event.release.prerelease
shell: powershell
run: |
anaconda -v upload "build\win-64\*.tar.bz2"
- name: Upload conda package (Windows/dev)
if: matrix.os == 'windows-2022' && github.event.release.prerelease
shell: powershell
run: |
anaconda -v upload "build\win-64\*.tar.bz2" --label dev
# Upload conda package (Ubuntu)
- name: Upload conda package (Ubuntu/main)
if: matrix.os == 'ubuntu-22.04' && !github.event.release.prerelease
shell: bash -l {0}
run: |
anaconda -v upload build/linux-64/*.tar.bz2
- name: Upload conda package (Ubuntu/dev)
if: matrix.os == 'ubuntu-22.04' && github.event.release.prerelease
shell: bash -l {0}
run: |
anaconda -v upload build/linux-64/*.tar.bz2 --label dev
# Upload conda package (Mac)
- name: Upload conda package (Mac/main)
if: matrix.os == 'macos-14' && !github.event.release.prerelease
shell: bash -l {0}
run: |
anaconda -v upload build/osx-arm64/*.tar.bz2 --label dev
- name: Upload conda package (Mac/dev)
if: matrix.os == 'macos-14' && github.event.release.prerelease
shell: bash -l {0}
run: |
anaconda -v upload build/osx-arm64/*.tar.bz2 --label dev
# Logout
- name: Logout from Anaconda
shell: bash -l {0}
run: |
anaconda logout