Skip to content

Commit

Permalink
remove old mex files; add octave test code
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg1969 committed Apr 13, 2024
1 parent 2d5a8c1 commit 7dbef9e
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 9 deletions.
91 changes: 82 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Build MEX files
uses: matlab-actions/run-command@v2
with:
command: "cd lib; mex cvx_eliminate_mex.c; mex cvx_bcompress_mex.c"
command: "cd lib; mex cvx_eliminate_mex.c; mex cvx_bcompress_mex.c; cd ..; cvx_setup -exit-if"
- name: Upload MATLAB MEX files
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -88,29 +88,32 @@ jobs:
mkdir -p lib/o_win && mv oct-windows-*/* lib/o_win/
mkdir -p lib/o_maci && mv oct-macos-12/* lib/o_maci/
mkdir -p lib/o_maca && mv oct-macos-14/* lib/o_maca/
mv mex-*/* .
mv mex-*/* lib/
rmdir mex-* oct-*
- name: Download solvers
run: |
rm -rf sdpt3 sedumi || :
for url in $(grep -v ^# solvers.txt); do
echo "Downloading: $url"
curl -OL $url
echo "Unpacking: ${url##*/}
tar xfz ${url##*/}
rm ${url##*/}
fname=${url##*/}
echo "Unpacking: $fname"
tar xfz $fname
rm $fname
done
- name: Show files, build archives
run: |
cd ..
mv CVX cvx
zip -r cvx.zip cvx -x 'cvx/.git/*' -x 'cvx/.github/*'
tar cfz cvx.tgz --exclude "cvx/.git" --exclude "cvx/.github" sedumi
tar cfz cvx.tgz --exclude "cvx/.git" --exclude "cvx/.github" cvx
echo "--------"
tar tfz cvx.tgz
echo "--------"
zipinfo cvx.zip
echo "--------"
mv cvx.tgz cvx.zip sedumi
mv cvx CVX
mv cvx.tgz cvx.zip CVX
- name: Upload bundles
uses: actions/upload-artifact@v4
with:
Expand All @@ -137,9 +140,79 @@ jobs:
- name: Run test
uses: matlab-actions/run-command@v2
with:
command: "cvx_setup"
command: "cvx_setup -exit-if"
octave-tests:
needs: package
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest,macos-latest,macos-14]
steps:
- name: Retrieve artifact
uses: actions/download-artifact@v4
with:
name: bundles
- name: Unpack artifact
run: tar xfz cvx.tgz --strip-components=1
- name: Install Octave, Snap, Flatpak
shell: bash
run: |
if [ "${{ matrix.os }}" = ubuntu-latest ]; then
sudo apt update
sudo apt install --no-install-recommends octave
elif [ "${{ matrix.os }}" = windows-latest ]; then
choco install octave.portable
else
brew install octave
fi
- name: Run test (Unix)
shell: bash
run: octave --eval "cvx_setup -exit-if"
- name: Run test (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
set PATH=C:\ProgramData\chocolatey\bin;%PATH%
octave-cli.exe --no-gui --eval "cvx_setup -exit-if"
flatpak-test:
needs: package
runs-on: ubuntu-latest
steps:
- name: Retrieve artifact
uses: actions/download-artifact@v4
with:
name: bundles
- name: Unpack artifact
run: tar xfz cvx.tgz --strip-components=1
- name: Install Flatpak octave
run: |
sudo apt update
sudo apt install flatpak
flatpak remote-add --user --if-not-exists \
flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user -y flathub org.octave.Octave
- name: Run test
shell: bash
run: flatpak run org.octave.Octave --eval "cvx_setup -exit-if"
snap-test:
needs: package
runs-on: ubuntu-latest
steps:
- name: Retrieve artifact
uses: actions/download-artifact@v4
with:
name: bundles
- name: Unpack artifact
run: tar xfz cvx.tgz --strip-components=1
- name: Install Flatpak octave
run: |
sudo snap install octave
- name: Run test
shell: bash
run: snap run octave --eval "cvx_setup -exit-if"
publish:
needs: [matlab-tests]
needs: [matlab-tests,octave-tests,flatpak-test,snap-test]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
## CVX: A system for disciplined convex programming

### IMPORTANT UPDATE

We are working towards making this repository the *official* source
for CVX, and updating the [download page](http://cvxr.com/cvx/download)
with links back to this site. This will take a bit more time; but when
finished, there will be significant benefits:

- Fresh builds of the supporting MEX files for Linux, Windows, macOS
Apple Silicon, and macOS Intel will be included.
- The solver shims for Mosek and Gurobi will be included, without
obfuscation, so that anyone with a valid license for these solvers
can use CVX, for commercial and non-commercial use.
- We will be able to slowly enable community contributions to supply
bug fixes and improvements. Note that the first of these improvements
will need to include improvements to an automatable test suite to
help insure that changes do not introduce regressions.

Please stay tuned, here and on the [web site](http://cvxr.com/cvx),
for further developments.

### Introduction

CVX is a Matlab package for convex optimizaton.
Expand Down
3 changes: 3 additions & 0 deletions cvx_setup.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function cvx_setup( varargin )

cvx_version( '-install', varargin{:} );
if ~isfield( cvx___, 'loaded' ) || ~cvx___.loaded, %#ok
if cvx___.exit_if, exit(-1); end
error( 'CVX:Expected', 'Error detected by cvx_version' );
end
isoctave = cvx___.isoctave;
Expand Down Expand Up @@ -151,6 +152,7 @@ function cvx_setup( varargin )
'No valid solvers were found. This suggests a corrupt installation. Please\n', ...
'try re-installing the files and re-running cvx_setup. If the same error\n', ...
'occurs, please contact CVX support.\n' ] );
if cvx___.exit_if, exit(-1); end
error('CVX:Unexpected','No valid solvers were found.');
end
solvers = solvers(cellfun(@isempty,{solvers.error}));
Expand Down Expand Up @@ -179,6 +181,7 @@ function cvx_setup( varargin )

cvx_global;
if isempty( cvx___.solvers.list ),
if cvx___.exit_if, exit(-1); end
error('CVX:Unexpected','No valid solvers were found.');
end

Expand Down
7 changes: 7 additions & 0 deletions cvx_version.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

args = varargin;
compile = false;
exit_if = false;
quick = nargout > 0;
if nargin
if ~ischar( args{1} ),
Expand All @@ -23,9 +24,13 @@
tt = strcmp( args, '-compile' );
compile = any( tt );
if compile, quick = false; args(tt) = []; end
tt = strcmp( args, '-exit-if' );
exit_if = any( tt );
if exit_if, quick = false; args(tt) = []; end
end
end

cvx___.exit_if = exit_if;
if isfield( cvx___, 'loaded' ),

if quick, return; end
Expand Down Expand Up @@ -310,6 +315,8 @@

if ~issue,
cvx___.loaded = true;
elseif exit_if,
exit(1)
end
clear fs;
fprintf( '%s\n', line );
Expand Down
Binary file removed lib/cvx_bcompress_mex.mexa64
Binary file not shown.
Binary file removed lib/cvx_bcompress_mex.mexglx
Binary file not shown.
Binary file removed lib/cvx_bcompress_mex.mexmaci64
Binary file not shown.
Binary file removed lib/cvx_bcompress_mex.mexw64
Binary file not shown.
Binary file removed lib/cvx_eliminate_mex.mexa64
Binary file not shown.
Binary file removed lib/cvx_eliminate_mex.mexglx
Binary file not shown.
Binary file removed lib/cvx_eliminate_mex.mexmaci64
Binary file not shown.
Binary file removed lib/cvx_eliminate_mex.mexw64
Binary file not shown.
Binary file removed lib/o_lin64/cvx_bcompress_mex.mex
Binary file not shown.
Binary file removed lib/o_lin64/cvx_eliminate_mex.mex
Binary file not shown.
Binary file removed lib/o_mac64/cvx_bcompress_mex.mex
Binary file not shown.
Binary file removed lib/o_mac64/cvx_eliminate_mex.mex
Binary file not shown.

0 comments on commit 7dbef9e

Please sign in to comment.