From dee3990358ced52c8e404a1271d8b634929c5148 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 12 Oct 2022 13:14:26 -0300 Subject: [PATCH] test matlab code --- .github/dependabot.yml | 11 +++++++++++ .github/workflows/tests.yml | 15 +++++++++++++++ Toolbox/gsw_check_functions.m | 22 +++++++++++----------- run_checks.m | 2 ++ 4 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/tests.yml create mode 100644 run_checks.m diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..563dd9b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot + +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + labels: + - "Bot" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ce40ff2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,15 @@ +name: Tests + +on: [push, pull_request] + +jobs: + my-job: + name: Run MATLAB Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: matlab-actions/setup-matlab@v2 + - name: Run Tests + uses: matlab-actions/run-command@v2 + with: + command: run_checks \ No newline at end of file diff --git a/Toolbox/gsw_check_functions.m b/Toolbox/gsw_check_functions.m index 54eae48..c0bc495 100644 --- a/Toolbox/gsw_check_functions.m +++ b/Toolbox/gsw_check_functions.m @@ -1,23 +1,23 @@ -if isempty(which('gsw_gibbs.html')) - fprintf(2,'You need to add the GSW "html" subdirectory to your path. \n'); -end +% if isempty(which('gsw_gibbs.html')) +% fprintf(2,'You need to add the GSW "html" subdirectory to your path. \n'); +% end if isempty(which('gsw_gibbs.m')) fprintf(2,'You need to add the GSW "library" subdirectory to your path. \n'); end -if isempty(which('gibbs.pdf')) - fprintf(2,'You need to add the GSW "pdf" subdirectory to your path. \n'); -end +% if isempty(which('gibbs.pdf')) +% fprintf(2,'You need to add the GSW "pdf" subdirectory to your path. \n'); +% end if isempty(which('gsw_rho_t_exact.m')) fprintf(2,'You need to add the GSW "thermodynamics_from_t" subdirectory to your path. \n'); end -if isempty(which('gsw_gibbs.html')) | isempty(which('gsw_gibbs.m')) | ... - isempty(which('gibbs.pdf')) | isempty(which('gsw_rho_t_exact.m')) - error('You have not added the GSW subdirectories to you MATLAB Path') -end +% if isempty(which('gsw_gibbs.html')) | isempty(which('gsw_gibbs.m')) | ... +% isempty(which('gibbs.pdf')) | isempty(which('gsw_rho_t_exact.m')) +% error('You have not added the GSW subdirectories to you MATLAB Path') +% end try gsw_installation_dir = which ('gsw_gibbs.html'); @@ -2219,7 +2219,7 @@ end if gsw_cf.gsw_chks == 0 - fprintf(2,'Your installation of the Gibbs SeaWater (GSW) Oceanographic Toolbox has errors !\n'); + error(2,'Your installation of the Gibbs SeaWater (GSW) Oceanographic Toolbox has errors !\n'); demo = 0; else fprintf(1,'Well done! The gsw_check_functions confirms that the \n'); diff --git a/run_checks.m b/run_checks.m new file mode 100644 index 0000000..d5fe492 --- /dev/null +++ b/run_checks.m @@ -0,0 +1,2 @@ +addpath(genpath("Toolbox/")) +gsw_check_functions