Skip to content

Commit

Permalink
Merge pull request #67 from datajoint/stage-external-storage
Browse files Browse the repository at this point in the history
Add Toolbox packaging
  • Loading branch information
eywalker authored Nov 13, 2020
2 parents 209f45d + 925cc7d commit 3a80559
Show file tree
Hide file tree
Showing 26 changed files with 427 additions and 256 deletions.
100 changes: 0 additions & 100 deletions +tests/+lib/compareVersions.m

This file was deleted.

6 changes: 0 additions & 6 deletions +tests/Main.m

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Integration Tests
on:
push:
branches:
- '**' # every branch
- '!stage*' # exclude branches beginning with stage
pull_request:
branches:
- '**' # every branch
- '!stage*' # exclude branches beginning with stage
jobs:
CI:
if: github.event_name == 'push' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
strategy:
matrix:
matlab_version: ["R2019a"]
mysql_version: ["8.0.18", "5.7", "5.6"]
include:
- matlab_version: "R2018b"
mysql_version: "5.7"
- matlab_version: "R2016b"
mysql_version: "5.7"
steps:
- uses: actions/checkout@v2
- name: Run primary tests
env:
MATLAB_UID: "1001"
MATLAB_GID: "116"
MATLAB_USER: ${{ secrets.matlab_user }}
MATLAB_HOSTID: ${{ secrets.matlab_hostid }}
MATLAB_VERSION: ${{ matrix.matlab_version }}
MYSQL_TAG: ${{ matrix.mysql_version }}
MATLAB_LICENSE: ${{ secrets[format('matlab_license_{0}', matrix.matlab_version)] }}
DOCKER_CLIENT_TIMEOUT: "120"
COMPOSE_HTTP_TIMEOUT: "120"
run: |
docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ notebook
.vscode
win.*
.DS_Store
macos.*
macos*
*.prj
matlab.prf
*.mltbx
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

74 changes: 63 additions & 11 deletions LNX-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- MYSQL_ROOT_PASSWORD=simple
fakeservices.datajoint.io:
<<: *net
image: raphaelguzman/nginx:v0.0.8
image: raphaelguzman/nginx:v0.0.10
environment:
- ADD_db_TYPE=DATABASE
- ADD_db_ENDPOINT=db:3306
Expand All @@ -21,7 +21,6 @@ services:
app:
<<: *net
environment:
- DISPLAY
- MATLAB_LICENSE
- MATLAB_USER
- DJ_HOST=fakeservices.datajoint.io
Expand All @@ -35,19 +34,72 @@ services:
fakeservices.datajoint.io:
condition: service_healthy
user: ${MATLAB_UID}:${MATLAB_GID}
working_dir: /src
command: >
/bin/bash -c "
matlab -nodisplay -r \"\
feature('DefaultCharacterSet','UTF-8');\
res=run(tests.Main);\
working_dir: /main
command:
- /bin/bash
- -c
- |
set -e
export ORIG_DIR=$$(pwd)
mkdir ~/Documents
cd /src
# Verify all mex have been updated
if [ "distribution/mexa64/mym.mexa64" -nt "distribution/mexmaci64/mym.mexmaci64" ]; then
echo "MACOS64 Mex binary appears outdated. Failing check..."
exit 1
fi
if [ "distribution/mexa64/mym.mexa64" -nt "distribution/mexw64/mym.mexw64" ]; then
echo "WIN64 Mex binary appears outdated. Failing check..."
exit 1
fi
# Compile mym, package into toolbox, and install
matlab -nodisplay -r "
try\
websave([tempdir 'GHToolbox.mltbx'],\
['https://github.com/datajoint/GHToolbox' \
'/releases/download/' subsref(webread(['https://api.github.com/repos' \
'/datajoint/GHToolbox' \
'/releases/latest']),\
substruct('.', 'tag_name')) \
'/GHToolbox.mltbx']);\
matlab.addons.toolbox.installToolbox([tempdir 'GHToolbox.mltbx']);\
origDir = pwd;\
cd('distribution/mexa64');\
docs = help('mym');\
cd(origDir);\
ghtb.package('mym',\
'Raphael Guzman',\
'[email protected]',\
['MySQL API for MATLAB with support for BLOB objects'],\
docs,\
{'.vscode', '.git', '.gitignore', 'build', 'lib', 'maria-plugin',\
'mex_compilation', 'mysql-connector', 'notebook', 'src', 'zlib',\
'*.txt', '*.env', '*.prf', '*.md', '*.yml', 'tests', '.github',\
'distribution/mexa64/libmysqlclient.so.18.4.'},\
@() strjoin(arrayfun(@(x) num2str(x),\
cell2mat(struct2cell(mym('version'))),\
'uni', false),\
'.'),\
{'distribution/mexa64', 'distribution/mexmaci64',\
'distribution/mexw64', 'mym.m'},\
'toolboxVersionDir', 'distribution/mexa64',\
'toolboxRootDir', '.');\
matlab.addons.toolbox.installToolbox('mym.mltbx');\
cd(getenv('ORIG_DIR'));\
addpath('tests');\
res=run(Main);\
disp(res);\
if all([res.Passed]) exit, else exit(1), end;\
\";
"
,\
catch ME,\
disp(getReport(ME, 'extended'));\
exit(1);\
,\
end;\
"
mac_address: $MATLAB_HOSTID
volumes:
- ./tests:/main/tests
- .:/src
- /tmp/.X11-unix:/tmp/.X11-unix:rw
networks:
main:
56 changes: 40 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mym
===
[![View mym on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/81208-mym)

## mym

MySQL API for MATLAB with support for BLOB objects

Expand All @@ -11,10 +12,7 @@ work of Robert Almgren from University of Toronto [sourceforge project](http://s

See mym.m for further documentation.


Running Tests Locally
=====================

## Running Tests Locally

* Create an `.env` with desired development environment values e.g.
``` sh
Expand All @@ -33,28 +31,54 @@ MYSQL_TAG=5.7

| Use Case | MATLAB Code |
| ---------------------------- | ------------------------------------------------------------------------------ |
| Run all tests | `run(tests.Main)` |
| Run one class of tests | `run(tests.TestTls)` |
| Run one specific test | `runtests('tests.TestTls/TestTls_testInsecureConn')` |
| Run tests based on test name | `import matlab.unittest.TestSuite;`<br>`import matlab.unittest.selectors.HasName;`<br>`import matlab.unittest.constraints.ContainsSubstring;`<br>`suite = TestSuite.fromClass(?tests.Main, ... `<br><code>&nbsp;&nbsp;&nbsp;&nbsp;</code>`HasName(ContainsSubstring('Conn')));`<br>`run(suite)`|
| Run all tests | `run(Main)` |
| Run one class of tests | `run(TestTls)` |
| Run one specific test | `runtests('TestTls/TestTls_testInsecureConn')` |
| Run tests based on test name | `import matlab.unittest.TestSuite;`<br>`import matlab.unittest.selectors.HasName;`<br>`import matlab.unittest.constraints.ContainsSubstring;`<br>`suite = TestSuite.fromClass(?Main, ... `<br><code>&nbsp;&nbsp;&nbsp;&nbsp;</code>`HasName(ContainsSubstring('Conn')));`<br>`run(suite)`|


Launch Jupyter Notebook
-----------------------
### Launch Jupyter Notebook
* Navigate to `localhost:8888`
* Input Jupyter password
* Launch a notebook i.e. `New > MATLAB`


Launch MATLAB GUI (supports remote interactive debugger)
--------------------------------------------------------
### Launch MATLAB GUI (supports remote interactive debugger)
* Shell into `mym_app_1` i.e. `docker exec -it mym_app_1 bash`
* Launch Matlab by runnning command `matlab`


Launch MATLAB Terminal
----------------------
### Launch MATLAB Terminal
* Shell into `mym_app_1` i.e. `docker exec -it mym_app_1 bash`
* Launch Matlab with no GUI by runnning command `matlab -nodisplay`


## Installation

### (Recommended) Using GHToolbox (FileExchange Community Toolbox)

1. Install *GHToolbox* using using an appropriate method in https://github.com/datajoint/GHToolbox
2. run: `ghtb.install('datajoint/mym')`

### Greater than R2016b

1. Utilize MATLAB built-in GUI i.e. *Top Ribbon -> Add-Ons -> Get Add-Ons*
2. Search and Select `mym`
3. Select *Add from GitHub*

### Less than R2016b

1. Utilize MATLAB built-in GUI i.e. *Top Ribbon -> Add-Ons -> Get Add-Ons*
2. Search and Select `mym`
3. Select *Download from GitHub*
4. Save `mym.mltbx` locally
5. Navigate in MATLAB tree browser to saved toolbox file
6. Right-Click and Select *Install*
7. Select *Install*

### From Source

1. Download `mym.mltbx` locally
2. Navigate in MATLAB tree browser to saved toolbox file
3. Right-Click and Select *Install*
4. Select *Install*
Loading

0 comments on commit 3a80559

Please sign in to comment.