Skip to content

Commit

Permalink
start work on ci support
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg1969 committed Apr 13, 2024
1 parent a7b46e7 commit 87a9244
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 9 deletions.
154 changes: 154 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: CI
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
build-mex:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04,windows-2019,macos-12,macos-14]
steps:
- name: Retrieve the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.os == 'macos-14' && 'R2023b' || ( matrix.os == 'windows-2019' && 'R2021b' || 'R2021a' ) }}
- name: Build MEX files
uses: matlab-actions/run-command@v2
with:
command: "cd lib; mex cvx_eliminate_mex.c; mex cvx_bcompress_mex.c"
- name: Upload MATLAB MEX files
uses: actions/upload-artifact@v4
with:
name: mex-${{ matrix.os }}
path: "lib/*.mex*"
build-oct:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04,windows-2019,macos-12,macos-14]
steps:
- name: Retrieve the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Octave
shell: bash
run: |
if [ "${{ matrix.os }}" = ubuntu-20.04 ]; then
sudo apt update
sudo snap install octave
sudo apt install --no-install-recommends libopenblas-dev
echo "OCTAVE=snap run octave" >>$GITHUB_ENV
elif [ "${{ matrix.os }}" = windows-2019 ]; then
choco install octave.portable
else
brew install octave
echo "OCTAVE=octave" >>$GITHUB_ENV
fi
- name: Build MEX files (Unix)
if: matrix.os != 'windows-2019'
run: $OCTAVE --eval "cd lib; mex cvx_eliminate_mex.c; mex cvx_bcompress_mex.c"
- name: Build Mex files (Windows)
if: matrix.os == 'windows-2019'
shell: cmd
run: |
set PATH=C:\ProgramData\chocolatey\bin;%PATH%
octave-cli.exe --no-gui --eval "cd lib; mex cvx_eliminate_mex.c; mex cvx_bcompress_mex.c"
if %errorlevel% neq 0 exit /b %errorlevel%
- name: Upload Octave MEX files
uses: actions/upload-artifact@v4
with:
name: oct-${{ matrix.os }}
path: "*.mex"
package:
needs: [build-mex,build-oct]
runs-on: ubuntu-latest
steps:
- name: Retrieve the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Retrieve artifacts
uses: actions/download-artifact@v4
- name: Move artifacts into place
run: |
mkdir -p lib/o_lin && mv oct-ubuntu-*/* lib/o_lin/
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-*/* .
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##*/}
done
- name: Show files, build archives
run: |
cd ..
zip -r cvx.zip cvx -x 'cvx/.git/*' -x 'cvx/.github/*'
tar cfz cvx.tgz --exclude "cvx/.git" --exclude "cvx/.github" sedumi
echo "--------"
tar tfz cvx.tgz
echo "--------"
zipinfo cvx.zip
echo "--------"
mv cvx.tgz cvx.zip sedumi
- name: Upload bundles
uses: actions/upload-artifact@v4
with:
name: bundles
path: |
cvx.zip
cvx.tgz
matlab-tests:
needs: package
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,macos-latest,windows-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 latest MATLAB
uses: matlab-actions/setup-matlab@v2
- name: Run test
uses: matlab-actions/run-command@v2
with:
command: "cvx_setup"
publish:
needs: [matlab-tests]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Retrieve artifacts
uses: actions/download-artifact@v4
with:
name: bundles
- uses: softprops/action-gh-release@v2
with:
files: |
cvx.tgz
cvx.zip
7 changes: 0 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
[submodule "sedumi"]
path = sedumi
url = git@github.com:sqlp/sedumi.git
branch = pretransfo
[submodule "sdpt3"]
path = sdpt3
url = git@github.com:sqlp/sdpt3.git
1 change: 0 additions & 1 deletion sdpt3
Submodule sdpt3 deleted from 3b8801
1 change: 0 additions & 1 deletion sedumi
Submodule sedumi deleted from e42289
5 changes: 5 additions & 0 deletions solvers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# These are the URLs of the SDPT3 and SeDuMi bundles to include.
# We have stopped using submodules because the MEX files are no
# longer checked into Git; instead, they are built by CI processes
https://github.com/sqlp/sedumi/releases/download/v1.3.8/sedumi.tgz
https://github.com/sqlp/sdpt3/releases/download/4.0-20240410/sdpt3.tgz

0 comments on commit 87a9244

Please sign in to comment.