CI #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. | |
schedule: | |
- cron: '0 16 * * 5' | |
# Trigger the workflow when it is manually triggered | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Install and test MatCUTEst | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, ubuntu-latest, ubuntu-24.04] | |
matlab: [R2020b, R2021a, R2021b, R2022a, R2022b, R2023a, R2023b, R2024a, latest] | |
#list: [full, customized, test] | |
list: [full] | |
#list: [new] | |
#list: [test] | |
steps: | |
- name: Run `sudo apt update` | |
run: sudo apt update # Otherwise, free-disk-space or other actions relying on `apt` may fail | |
- name: Free disk space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# all of these default to true, but feel free to set to "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: false # Important, or the runner may be shut down due to memory starvation. | |
- name: Check out repository | |
uses: actions/checkout@v4.2.1 | |
with: | |
submodules: recursive | |
- name: Miscellaneous setup | |
run: bash .github/scripts/misc_setup | |
- name: Clone PRIMA | |
uses: actions/checkout@v4.2.1 | |
with: | |
repository: libprima/prima | |
path: prima | |
submodules: recursive | |
- name: Install 7z | |
run: sudo apt install p7zip-full | |
- name: Decide gfortran version for MATLAB on Linux | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
GFVER=${{ env.GFORTRAN_VERSION }} | |
if [[ "${{ matrix.os }}" = "ubuntu-20.04" ]] ; then | |
GFVER=11 | |
fi | |
if [[ "${{ matrix.matlab }}" = "R2020a" || "${{ matrix.matlab }}" = "R2020b" \ | |
|| "${{ matrix.matlab }}" = "R2021a" || "${{ matrix.matlab }}" = "R2021b" ]] ; then | |
GFVER=9 | |
fi | |
echo "GFVER=$GFVER" >> $GITHUB_ENV | |
- name: Set up gfortran on Linux | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: fortran-lang/setup-fortran@main | |
with: | |
compiler: gcc | |
version: ${{ env.GFVER }} | |
- name: Check gfortran version on Linux | |
if: startsWith(matrix.os, 'ubuntu') | |
run: which gfortran && gfortran --version | |
- name: Install epstopdf and ghostscript | |
if: startsWith(matrix.os, 'ubuntu') | |
run: bash .github/scripts/install_epstopdf && bash .github/scripts/install_ghostscript | |
- name: Check MATLAB | |
id: check_matlab | |
run: if type 'matlab' &> /dev/null ; then echo "::set-output name=has_matlab::true" ; fi | |
- name: Set up MATLAB | |
if: ${{ steps.check_matlab.outputs.has_matlab != 'true' }} | |
uses: matlab-actions/setup-matlab@v2.2.0 | |
with: | |
release: ${{ matrix.matlab }} | |
cache: true | |
products: Parallel_Computing_Toolbox | |
- name: Revise the installation script according to the list | |
run: | | |
PKG_DFT=full.matcutest.7z.001 | |
PKG=${{ matrix.list }}.matcutest.7z.001 | |
sed -i "s|$PKG_DFT|$PKG|g" ./install.m | |
- name: Install and test MatCUTEst | |
uses: matlab-actions/run-command@v2.1.1 | |
with: | |
command: | | |
ver; | |
root_dir = cd() | |
dt = datetime('now'); | |
r = mod(ceil(second(dt)), 2) | |
if r == 0 | |
install(); | |
else | |
directory = tempname(fullfile(getenv('HOME'), 'test')) | |
install(directory); | |
end | |
cd(getenv('HOME')); | |
help matcutest | |
which macup | |
req = []; req.blacklist = github_black_list(); req.maxdim=20000; req.maxcon=40000; | |
badlist = chcup(secup(req), 1) | |
if ~isempty(badlist) | |
error('Some problems did not pass the checking.'); | |
end | |
cd(fullfile(root_dir, 'prima', 'matlab', 'tests')); | |
opt.blacklist = {}; | |
profile('uobyqa', 'seq', opt); | |
profile('newuoa', 'seq', opt); | |
profile('bobyqa', 'seq', 'b', opt); | |
profile('lincoa', 'seq', 'l', opt); | |
profile('cobyla', 'seq', 'n', opt); | |
mkdir(fullfile(root_dir, 'matcutest.compiled')); | |
copyfile('./testdata/*summary*.pdf', fullfile(root_dir, 'matcutest.compiled')); | |
copyfile('./testdata/*problems.txt', fullfile(root_dir, 'matcutest.compiled')); | |
- name: Store artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: ${{ matrix.os }}.${{ matrix.matlab }}.${{ matrix.list }} | |
path: | | |
matcutest.compiled |