Use MatCUTEst in GitHub Actions #123
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: Use MatCUTEst in GitHub Actions | |
on: | |
# Trigger the workflow on push or pull request | |
push: | |
#pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! | |
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. | |
schedule: | |
- cron: '0 18 * * *' | |
# Trigger the workflow manually | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Demo | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone MatCUTEst | |
uses: actions/checkout@v4.2.1 | |
with: | |
repository: matcutest/matcutest_compiled | |
path: matcutest | |
- name: Set up MATLAB | |
uses: matlab-actions/setup-matlab@v2.2.0 | |
with: | |
products: Parallel_Computing_Toolbox | |
- name: Run tests | |
uses: matlab-actions/run-command@v2.1.1 | |
with: | |
command: | | |
root_dir = pwd(); | |
% Install MatCUTEst | |
cd(fullfile(root_dir, 'matcutest')); install(); cd(root_dir); | |
% Check the installation | |
help matcutest, which('macup'), which('decup'), which('secup') | |
% Conduct your tests | |
fprintf('\nTry ZY2:\n'); | |
p = macup('ZY2') % Make the ZY2 problem | |
p.objective(p.x0) | |
p.nonlcon(p.x0) | |
decup(p); % Destroy the problem | |
% MatCUTEst is thread safe. It can be used within a parfor. | |
problist = {'AKIVA', 'BOX2', 'ZECEVIC2', 'ZY2'}; | |
parfor ip = 1 : length(problist) | |
pname = problist{ip}; | |
fprintf('\n%d. Try %s:\n', ip, pname); | |
p = macup(pname); | |
p.objective(p.x0) | |
decup(p); | |
end |