1- name : Basic SeDuMi tests
2-
3- # Controls when the action will run.
1+ name : CI
42on :
5- # Triggers the workflow on push or pull request events but only for the main branch
63 push :
7- branches : [ master ]
4+ branches :
5+ - master
6+ tags :
7+ - ' *'
88 pull_request :
9- branches : [ master ]
10-
11- workflow_dispatch :
12-
9+ branches :
10+ - master
1311jobs :
14-
15- matlab :
16- name : Matlab (latest) on Ubuntu (latest)
17- runs-on : ubuntu-latest
18-
12+ build-mex :
13+ runs-on : ${{ matrix.os }}
14+ strategy :
15+ matrix :
16+ os : [ubuntu-20.04,windows-2019,macos-12,macos-14]
17+ steps :
18+ - name : Retrieve the source code
19+ uses : actions/checkout@v4
20+ with :
21+ fetch-depth : 0
22+ - name : Install MATLAB
23+ uses : matlab-actions/setup-matlab@v2
24+ with :
25+ release : ${{ matrix.os == 'macos-14' && 'R2023b' || ( matrix.os == 'windows-2019' && 'R2021b' || 'R2021a' ) }}
26+ - name : Build and test
27+ uses : matlab-actions/run-command@v2
28+ with :
29+ command : " install_sedumi -rebuild; cd examples; test_sedumi(0, 1)"
30+ - name : Upload MATLAB MEX files
31+ uses : actions/upload-artifact@v4
32+ with :
33+ name : mex-${{ matrix.os }}
34+ path : " *.mex*"
35+ build-oct :
36+ runs-on : ${{ matrix.os }}
37+ strategy :
38+ fail-fast : false
39+ matrix :
40+ os : [ubuntu-20.04,windows-2019,macos-12,macos-14]
1941 steps :
20- - name : Check out repository
21- uses : actions/checkout@v3
22-
23- - name : Install MATLAB
24- uses : matlab-actions/setup-matlab@v1
25-
26- - name : Run basic SeDuMi tests
27- uses : matlab-actions/run-command@v1
28- with :
29- command : cd examples; test_sedumi(1, 1);
30-
31-
32- macos-octave :
33- name : Octave (latest) on macOS (latest)
34- runs-on : macos-latest
35-
42+ - name : Retrieve the source code
43+ uses : actions/checkout@v4
44+ with :
45+ fetch-depth : 0
46+ - name : Install Octave
47+ shell : bash
48+ run : |
49+ if [ "${{ matrix.os }}" = ubuntu-20.04 ]; then
50+ sudo apt update
51+ sudo snap install octave
52+ sudo apt install --no-install-recommends libopenblas-dev
53+ echo "OCTAVE=snap run octave" >>$GITHUB_ENV
54+ elif [ "${{ matrix.os }}" = windows-2019 ]; then
55+ choco install octave.portable
56+ else
57+ brew install octave
58+ echo "OCTAVE=octave" >>$GITHUB_ENV
59+ fi
60+ - name : Build and test (Unix)
61+ if : matrix.os != 'windows-2019'
62+ run : $OCTAVE --eval "install_sedumi -rebuild; test_sedumi(0, 1)"
63+ - name : Build and test (Windows)
64+ if : matrix.os == 'windows-2019'
65+ shell : cmd
66+ run : |
67+ set PATH=C:\ProgramData\chocolatey\bin;%PATH%
68+ octave-cli.exe --no-gui --eval "install_sedumi -rebuild; test_sedumi(0, 1)"
69+ if %errorlevel% neq 0 exit /b %errorlevel%
70+ - name : Upload Octave MEX files
71+ uses : actions/upload-artifact@v4
72+ with :
73+ name : oct-${{ matrix.os }}
74+ path : " *.mex"
75+ package :
76+ needs : [build-mex,build-oct]
77+ runs-on : ubuntu-latest
3678 steps :
37- - name : Check out repository
38- uses : actions/checkout@v3
39-
40- - name : Install Octave by homebrew
41- run : brew install octave
42-
43- - name : Run basic SeDuMi tests
44- run : octave --eval "cd examples; test_sedumi(1, 1);"
45-
46-
47- windows-octave :
48- name : Octave (latest) on MS Windows (latest)
49- runs-on : windows-latest
50-
79+ - name : Retrieve the source code
80+ uses : actions/checkout@v4
81+ with :
82+ fetch-depth : 0
83+ - name : Retrieve artifacts
84+ uses : actions/download-artifact@v4
85+ - name : Move artifacts into place
86+ run : |
87+ mkdir -p o_lin && mv oct-ubuntu-*/* o_lin/
88+ mkdir -p o_win && mv oct-windows-*/* o_win/
89+ mkdir -p o_maci && mv oct-macos-12/* o_maci/
90+ mkdir -p o_maca && mv oct-macos-14/* o_maca/
91+ mv mex-*/* .
92+ rmdir mex-* oct-*
93+ - name : Show files, build archives
94+ run : |
95+ cd ..
96+ zip -r sedumi.zip sedumi -x 'sedumi/.git/*' -x 'sedumi/.github/*'
97+ tar cfz sedumi.tgz --exclude "sedumi/.git" --exclude "sedumi/.github" sedumi
98+ echo "--------"
99+ tar tfz sedumi.tgz
100+ echo "--------"
101+ zipinfo sedumi.zip
102+ echo "--------"
103+ mv sedumi.tgz sedumi.zip sedumi
104+ - name : Upload bundles
105+ uses : actions/upload-artifact@v4
106+ with :
107+ name : bundles
108+ path : |
109+ sedumi.zip
110+ sedumi.tgz
111+ matlab-tests :
112+ needs : package
113+ runs-on : ${{ matrix.os }}
114+ strategy :
115+ fail-fast : false
116+ matrix :
117+ os : [ubuntu-latest,macos-latest,windows-latest,macos-14]
51118 steps :
52- - name : Check out repository
53- uses : actions/checkout@v3
54-
55- - name : Install Octave by Chocolatey
56- run : choco install octave.portable
57-
58- - name : Run basic SeDuMi tests
59- run : octave-cli.exe --eval "cd examples; test_sedumi(1, 1);"
60-
61-
62- ubuntu-20_04-octave :
63- name : Octave 5.2.0 on Ubuntu 20.04
64- runs-on : ubuntu-20.04
65-
119+ - name : Retrieve artifact
120+ uses : actions/download-artifact@v4
121+ with :
122+ name : bundles
123+ - name : Unpack artifact
124+ run : tar xfz sedumi.tgz --strip-components=1
125+ - name : Install latest MATLAB
126+ uses : matlab-actions/setup-matlab@v2
127+ - name : Run test
128+ uses : matlab-actions/run-command@v2
129+ with :
130+ command : " install_sedumi; cd examples; test_sedumi(0, 1)"
131+ octave-tests :
132+ needs : package
133+ runs-on : ${{ matrix.os }}
134+ strategy :
135+ fail-fast : false
136+ matrix :
137+ os : [ubuntu-latest,windows-latest,macos-latest,macos-14]
66138 steps :
67- - name : Check out repository
68- uses : actions/checkout@v3
69-
70- - name : Install Octave
71- run : |
72- sudo apt-get -y update
73- sudo apt-get -y install octave liboctave-dev libopenblas-dev
74-
75- - name : Run basic SeDuMi tests
76- run : octave --eval "cd examples; test_sedumi(1, 1);"
77-
78-
79- ubuntu-18_04-octave :
80- name : Octave 4.2.2 on Ubuntu 18.04
81- runs-on : ubuntu-18.04
82-
139+ - name : Retrieve artifact
140+ uses : actions/download-artifact@v4
141+ with :
142+ name : bundles
143+ - name : Unpack artifact
144+ run : tar xfz sedumi.tgz --strip-components=1
145+ - name : Install Octave, Snap, Flatpak
146+ shell : bash
147+ run : |
148+ if [ "${{ matrix.os }}" = ubuntu-latest ]; then
149+ sudo apt update
150+ sudo apt install --no-install-recommends octave
151+ elif [ "${{ matrix.os }}" = windows-latest ]; then
152+ choco install octave.portable
153+ else
154+ brew install octave
155+ fi
156+ - name : Run test (Unix)
157+ shell : bash
158+ run : octave --eval "install_sedumi; cd examples; test_sedumi(0, 1)"
159+ - name : Run test (Windows)
160+ if : matrix.os == 'windows-latest'
161+ shell : cmd
162+ run : |
163+ set PATH=C:\ProgramData\chocolatey\bin;%PATH%
164+ octave-cli.exe --no-gui --eval "install_sedumi; cd examples; test_sedumi(0, 1)"
165+ flatpak-test :
166+ needs : package
167+ runs-on : ubuntu-latest
83168 steps :
84- - name : Check out repository
85- uses : actions/checkout@v3
86-
87- - name : Install Octave
88- run : |
89- sudo apt-get -y update
90- sudo apt-get -y install octave liboctave-dev libopenblas-dev
91-
92- - name : Run basic SeDuMi tests
93- run : octave --eval "cd examples; test_sedumi(1, 1);"
94-
95-
96- flatpak-octave :
97- name : Octave (latest) on Flatpak (latest)
169+ - name : Retrieve artifact
170+ uses : actions/download-artifact@v4
171+ with :
172+ name : bundles
173+ - name : Unpack artifact
174+ run : tar xfz sedumi.tgz --strip-components=1
175+ - name : Install Flatpak octave
176+ run : |
177+ sudo apt update
178+ sudo apt install flatpak
179+ flatpak remote-add --user --if-not-exists \
180+ flathub https://flathub.org/repo/flathub.flatpakrepo
181+ flatpak install --user -y flathub org.octave.Octave
182+ - name : Run test
183+ shell : bash
184+ run : flatpak run org.octave.Octave --eval "install_sedumi; cd examples; test_sedumi(0, 1)"
185+ snap-test :
186+ needs : package
98187 runs-on : ubuntu-latest
99-
100188 steps :
101- - name : Check out repository
102- uses : actions/checkout@v3
103-
104- - name : Install Octave
105- run : |
106- sudo apt-get -y update
107- sudo apt-get -y install flatpak
108- flatpak remote-add --user --if-not-exists \
109- flathub https://flathub.org/repo/flathub.flatpakrepo
110- flatpak install --user -y flathub org.octave.Octave
111-
112- - name : Run basic SeDuMi tests
113- run : |
114- flatpak run org.octave.Octave --eval "cd examples; test_sedumi(1, 1);"
115-
116-
117- snap-octave :
118- name : Octave (latest) on Snap (latest)
189+ - name : Retrieve artifact
190+ uses : actions/download-artifact@v4
191+ with :
192+ name : bundles
193+ - name : Unpack artifact
194+ run : tar xfz sedumi.tgz --strip-components=1
195+ - name : Install Flatpak octave
196+ run : |
197+ sudo snap install octave
198+ - name : Run test
199+ shell : bash
200+ run : snap run octave --eval "install_sedumi; cd examples; test_sedumi(0, 1)"
201+ publish :
202+ needs : [matlab-tests,octave-tests,flatpak-test,snap-test]
203+ if : startsWith(github.ref, 'refs/tags/')
119204 runs-on : ubuntu-latest
120-
121205 steps :
122- - name : Check out repository
123- uses : actions/checkout@v3
124-
125- - name : Install Octave
126- run : |
127- sudo apt-get -y update
128- sudo apt-get -y install snapd
129- sudo snap install octave
130-
131- - name : Run basic SeDuMi tests
132- run : snap run octave --eval "cd examples; test_sedumi(1, 1);"
206+ - name : Retrieve artifacts
207+ uses : actions/download-artifact@v4
208+ with :
209+ name : bundles
210+ - uses : softprops/action-gh-release@v2
211+ with :
212+ files : |
213+ sedumi.tgz
214+ sedumi.zip
0 commit comments