-
Notifications
You must be signed in to change notification settings - Fork 5
225 lines (219 loc) · 8.64 KB
/
run_test.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
224
225
name: ZMat CI
on: [push, pull_request]
jobs:
octave_test:
name: Octave tests
strategy:
# tested octave versions: ubuntu-20.04 = 5.2, ubuntu-22.04 = 6.4, macos-11 = 8.1, windows-2019 = 7.3
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-11, windows-2019]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install dependencies
run: |
[[ "$RUNNER_OS" == "Linux" ]] && sudo apt-get update && sudo apt-get install -y liboctave-dev
[[ "$RUNNER_OS" == "macOS" ]] && brew install octave
if [[ "$RUNNER_OS" == "Windows" ]]; then
curl --retry 3 -kL http://cdimage.debian.org/mirror/gnu.org/gnu/octave/windows/octave-7.3.0-w64-64.7z --output octave_7.3.0.7z
7z x octave_7.3.0.7z -ooctave -y
echo 'C:\msys64\mingw64\bin' >> $GITHUB_PATH
echo "$PWD/octave/octave-7.3.0-w64-64/mingw64/bin" >> $GITHUB_PATH
fi
- name: Install msys2 libraries (Windows only)
if: ${{ runner.os == 'Windows' }}
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-zlib
mingw-w64-x86_64-winpthreads-git
base-devel
- name: Build static library
run: |
which gcc
which g++
make -C src lib CC=gcc CXX=g++
make -C example/c all CC=gcc CXX=g++ LIBTYPE=
if [ "$RUNNER_OS" == "macOS" ]; then
DYLD_LIBRARY_PATH=lib example/c/testzmat;
else
LD_LIBRARY_PATH=lib example/c/testzmat;
fi
octave-cli --eval "fprintf(1,['OCTAVE_ARCH=' regexprep(computer('arch'), 'darwin[0-9.]+-', 'darwin-')])"
octave-cli --eval "fprintf(1,['OCTAVE_ARCH=' regexprep(computer('arch'), 'darwin[0-9.]+-', 'darwin-')])" >> $GITHUB_ENV
- name: Build dynamic library
run: |
make -C src dll CC=gcc CXX=g++
make -C example/c all CC=gcc CXX=g++ LIBTYPE=
if [ "$RUNNER_OS" == "macOS" ]; then
DYLD_LIBRARY_PATH=lib example/c/testzmat;
else
LD_LIBRARY_PATH=lib example/c/testzmat;
fi
- name: Build octave mex (Windows only)
if: ${{ runner.os == 'Windows' }}
shell: msys2 {0}
run: |
export PATH="/mingw64/bin":"$PWD/octave/octave-7.3.0-w64-64/mingw64/bin":$PATH
which gcc
make -C src oct CC=gcc CXX=g++ USERLINKOPT="-static-libgcc -static-libstdc++ -fstack-protector -L/mingw64/lib -Wl,-Bstatic -lz -lwinpthread -Wl,-Bdynamic -v '$PWD/octave/octave-7.3.0-w64-64/mingw64/lib/octave/7.3.0/liboctinterp.dll.a'"
cp /mingw64/bin/zlib1.dll .
objdump -p zipmat.mex | grep "DLL Name:"
strip zipmat.mex
echo "$PWD/octave/octave-7.3.0-w64-64/mingw64/bin" >> $GITHUB_PATH
- name: Build octave mex (Linux and Mac)
if: ${{ runner.os != 'Windows' }}
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
make -C src oct CC=gcc CXX=g++ MEXLINKOPT="-static"
otool -L zipmat.mex
else
make -C src oct CC=gcc CXX=g++ MEXLINKOPT="-static-libgcc -static-libstdc++ -Wl,-Bstatic -lm -lpthread -Wl,-Bdynamic"
ldd zipmat.mex
fi
strip -S zipmat.mex
- name: Run octave test
if: ${{ runner.os != 'Windows' }}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export PATH="$PWD/octave/octave-7.3.0-w64-64/mingw64/bin":$PATH
fi
octave-cli --version
octave-cli --eval "addpath(pwd);cd test;run_zmat_test";
- name: Create package folder
run: |
mkdir packages
mkdir zmat
mkdir -p zmat/octave/${{ env.OCTAVE_ARCH }}
cp *.{m,txt,rst} zmat/
cp PKG_ADD* zmat/
cp -a example zmat/
cp -a test zmat/
- name: Create release tag
run: perl -e "print 'RELEASE_TAG='. lc('${{ runner.os }}-${{ runner.arch }}-github-latest')" >> $GITHUB_ENV
- name: Zip zmat
run: |
mv zipmat.mex zmat/octave/${{ env.OCTAVE_ARCH }}
if [[ "$RUNNER_OS" == "Windows" ]]; then
cp /mingw64/bin/zlib1.dll zmat/octave/${{ env.OCTAVE_ARCH }}
7z a -tzip packages/zmat-octave-${{ env.RELEASE_TAG }}.zip zmat
else
zip -FSr --symlink packages/zmat-octave-${{ env.RELEASE_TAG }}.zip zmat
fi
- name: Upload zmat package
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-11' || matrix.os == 'windows-2019' }}
uses: actions/upload-artifact@v3
with:
name: all-zmat-packages
path: packages/zmat-octave-${{ env.RELEASE_TAG }}.zip
matlab_test:
name: MATLAB test
strategy:
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
- name: Install msys2 libraries (Windows only)
if: ${{ runner.os == 'Windows' }}
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-zlib
mingw-w64-x86_64-winpthreads-git
base-devel
- name: Set up mex gcc (Windows only)
if: ${{ runner.os == 'Windows' }}
run: |
echo 'MW_MINGW64_LOC=/c/msys64/mingw64' >> $GITHUB_ENV
echo 'COMPFLAGS=""' >> $GITHUB_ENV
- name: Build MATLAB mex
run: |
rm -rf private
if [[ "$RUNNER_OS" == "Windows" ]]; then
make -C src mex CC=gcc CXX=g++ MEX="cmd //s //c mex -f mexopts_msys2_gcc.xml " USERLINKOPT="-v " CXXLIBS="-Lblosc2/lib -L/blosc2/internal-complibs/zstd-1.5.2"
objdump -p zipmat.mexw* | grep "DLL Name:"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
make -C src mex CC=gcc-10 CXX=g++10 MEXLINKOPT="-static-libstdc++"
otool -L zipmat.mex*
else
make -C src mex CC=gcc CXX=g++ MEXLINKOPT="-static-libgcc -static-libstdc++ -Wl,-Bstatic -lz -Wl,-Bdynamic" MEX="mex -v"
ldd zipmat.mex*
fi
strip -S zipmat.mex*
- name: Run MATLAB examples
uses: matlab-actions/run-command@v1
with:
command: addpath(pwd);cd test;run_zmat_test
- name: Create package folder
run: |
mkdir packages
mkdir zmat
mkdir -p zmat/private
mkdir -p zmat/example
cp *.{m,txt,rst} zmat/
cp -a example/*.m zmat/example
cp -a test zmat/
- name: Create release tag
run: perl -e "print 'RELEASE_TAG='. lc('${{ runner.os }}-${{ runner.arch }}-github-latest')" >> $GITHUB_ENV
- name: Zip zmat
run: |
mv zipmat.mex* zmat/private
if [[ "$RUNNER_OS" == "Windows" ]]; then
7z a -tzip packages/zmat-matlab-${{ env.RELEASE_TAG }}.zip zmat
else
zip -FSr --symlink packages/zmat-matlab-${{ env.RELEASE_TAG }}.zip zmat
fi
- name: Upload zmat package
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-11' || matrix.os == 'windows-2019' }}
uses: actions/upload-artifact@v3
with:
name: all-zmat-packages
path: packages/zmat-matlab-${{ env.RELEASE_TAG }}.zip
upload_package:
name: Upload Packages
needs: [octave_test, matlab_test]
runs-on: ubuntu-20.04
if: ${{ github.repository_owner == 'NeuroJSON' && github.event_name != 'pull_request'}}
steps:
- name: Download zmat
uses: actions/download-artifact@v3
with:
name: all-zmat-packages
path: packages
- name: Create all-in-one zmat package
run: |
cd packages
unzip -n 'zmat*.zip'
tree .
zip -FSr --symlink zmat-allinone-github-latest.zip zmat
rm -rf zmat
- name: Display structure of downloaded files
run: ls -R packages
- name: Copy package to server
if: ${{ github.repository_owner == 'NeuroJSON' && github.event_name != 'pull_request'}}
uses: wlixcc/SFTP-Deploy-Action@v1.2.4
with:
server: ${{ secrets.MCX_SERVER }}
username: ${{ secrets.MCX_SERVER_USER }}
ssh_private_key: ${{ secrets.MCX_SERVER_SSH_KEY }}
local_path: "packages/*"
remote_path: ${{ secrets.MCX_CI_PATH }}