Skip to content

Merge pull request #81 from sqlp/rebuild-ci #56

Merge pull request #81 from sqlp/rebuild-ci

Merge pull request #81 from sqlp/rebuild-ci #56

Workflow file for this run

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 and test
uses: matlab-actions/run-command@v2
with:
command: "install_sedumi -rebuild; cd examples; test_sedumi(0, 1)"
- name: Upload MATLAB MEX files
uses: actions/upload-artifact@v4
with:
name: mex-${{ matrix.os }}
path: "*.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 and test (Unix)
if: matrix.os != 'windows-2019'
run: $OCTAVE --eval "install_sedumi -rebuild; test_sedumi(0, 1)"
- name: Build and test (Windows)
if: matrix.os == 'windows-2019'
shell: cmd
run: |
set PATH=C:\ProgramData\chocolatey\bin;%PATH%
octave-cli.exe --no-gui --eval "install_sedumi -rebuild; test_sedumi(0, 1)"
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 o_lin && mv oct-ubuntu-*/* o_lin/
mkdir -p o_win && mv oct-windows-*/* o_win/
mkdir -p o_maci && mv oct-macos-12/* o_maci/
mkdir -p o_maca && mv oct-macos-14/* o_maca/
mv mex-*/* .
rmdir mex-* oct-*
- name: Show files, build archives
run: |
cd ..
zip -r sedumi.zip sedumi -x 'sedumi/.git/*' -x 'sedumi/.github/*'
tar cfz sedumi.tgz --exclude "sedumi/.git" --exclude "sedumi/.github" sedumi
echo "--------"
tar tfz sedumi.tgz
echo "--------"
zipinfo sedumi.zip
echo "--------"
mv sedumi.tgz sedumi.zip sedumi
- name: Upload bundles
uses: actions/upload-artifact@v4
with:
name: bundles
path: |
sedumi.zip
sedumi.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 sedumi.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: "install_sedumi; cd examples; test_sedumi(0, 1)"
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 sedumi.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 "install_sedumi; cd examples; test_sedumi(0, 1)"
- 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 "install_sedumi; cd examples; test_sedumi(0, 1)"
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 sedumi.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 "install_sedumi; cd examples; test_sedumi(0, 1)"
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 sedumi.tgz --strip-components=1
- name: Install Flatpak octave
run: |
sudo snap install octave
- name: Run test
shell: bash
run: snap run octave --eval "install_sedumi; cd examples; test_sedumi(0, 1)"
publish:
needs: [matlab-tests,octave-tests,flatpak-test,snap-test]
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: |
sedumi.tgz
sedumi.zip