Contribs/build-libvlc-for-mac.sh Mlt Luyikei Vlmc Gitlab
I have gitlab CI running testing some scripts and I've used the following lines of.gitlab-ci.yml to show the output of MATLAB builds: beforescript: test1: script: - matlab -nosplash -nodesktop -minimize -wait -logfile matlab-output.txt -r Model - type matlab-output.txt This works perfectly when the build is sucessful however not when it fails because the second command doesn't run. I've check gitlab-ci-runner and it doesn't have an 'afterscript' option. How'd you tackle this? Note: this is Windows.
- Contribs/build-libvlc-for-mac.sh Mlt Luyikei Vlmc Github
- Contribs/build-libvlc-for-mac.sh Mlt Luyikei Vlmc Github.com
I think that your issue is two-fold. It's partially because GITLAB doesn't call your type statement, but also that the MATLAB process never returns because the script never completes.
For example, type these at the command line: # This one will fail and notice that it never ends matlab -nodesktop -nosplash -minimize -wait -logfile log.txt -r 'disp(a); exit;' This is because MATLAB is never able to execute the exit command. On the other hand, in the case of a success, it is able to reach the exit and therefore returns. # This one will pass matlab -nodesktop -nosplash -minimize -wait -logfile log.txt -r 'disp(1); exit;' The way that I actually solve this is two-fold. First, I wrap the command I'm trying to call in a try/catch statement and then convert any errors/exceptions to a string format and display those. I have this sort of thing within a file called runtests.m% runtests.m exitcode = 0; try Model catch ME disp(getReport(ME)) exitcode = 1; end% Ensure that we ALWAYS call exit exit(exitcode); Then I have a bash script which actually makes the call to MATLAB and prints the log output and returns the same error code that was returned from MATLAB # runtests.sh LOGFILE=log.txt matlab -nodesktop -nosplash -minimize -wait -logfile '$LOGFILE' -r 'runtests'; CODE=$? Cat '$LOGFILE' exit $CODE The added benefit here is that my users can run the tests exactly as GITLAB CI runs them on their own machines. And then my.gitlab-ci.yml file is quite simple test1: script: - 'runtests.sh'.
For this answer I assume you mean that the matlab. Line fails and this the type matlab-output.txt line doesn't run. Since we dont know whats in your Model script/function, but you could try wrapping it in a try/catch. Matlab -nosplash -nodesktop -minimize -wait -logfile matlab-output.txt -r 'try; Model; end;' If you have a exit command in your Model file you may need to force Matlab to exit if it errors: matlab -nosplash -nodesktop -minimize -wait -logfile matlab-output.txt -r 'try; Model; catch; quit force; end;' You could also put the try/catch inside your Model.m file. As far as I understand your question, you want the line 'type matlab-output.txt' to run either when you have a failure or not. Considering that you have one job with several lines, and each of them can fail, all you can do is to create a second job, or a post-job that apparently you want to run even when failure occurs.
For example, according to the, you could have another job that you can run always: stages: - build - postbuild beforescript: test1: stage: build script: - matlab -nosplash -nodesktop -minimize -wait -logfile matlab-output.txt -r Model typematlab: stage: postbuild script: - type matlab-output.txt when: always If you have multiple jobs, I would advise you to separate the jobs in more stages. Sorry for the long delay and thank you everyone else for helping. I now have a running system using Suever's code. I've modified it to suit MATLAB's Unit framework.
Last commit Last update Loading commit data. Loading commit data. Loading commit data. Loading commit data. Loading commit data.
Contribs/build-libvlc-for-mac.sh Mlt Luyikei Vlmc Github
Loading commit data. Loading commit data. Loading commit data.
Loading commit data. Loading commit data.
Contribs/build-libvlc-for-mac.sh Mlt Luyikei Vlmc Github.com
Loading commit data. Loading commit data. Loading commit data. Loading commit data. Loading commit data. Loading commit data.
Loading commit data. Loading commit data. Loading commit data.
Loading commit data. Loading commit data. Loading commit data.
Loading commit data. Loading commit data. Loading commit data. Loading commit data. Loading commit data.
Loading commit data. Loading commit data. Loading commit data. Loading commit data. Loading commit data. Loading commit data. Loading commit data.
Loading commit data. Loading commit data.