UniprJRC / FSDA

Flexible Statistics and Data Analysis (FSDA) extends MATLAB for a robust analysis of data sets affected by different sources of heterogeneity. It is open source software licensed under the European Union Public Licence (EUPL). FSDA is a joint project by the University of Parma and the Joint Research Centre of the European Commission.
https://uniprjrc.github.io/FSDA/
European Union Public License 1.1
83 stars 38 forks source link

Enable Docker container build from repo and via automatic Github action #40

Closed josmartin closed 2 years ago

josmartin commented 2 years ago

Proposed changes

This PR enables users to build a docker container on their own machines which contains MATLAB and the required toolboxes in addition to a properly configured installation of FSDA toolbox.

In addition this PR updates the repository actions so as to automatically rebuild and push a docker container with the latest version of MATLAB (and toolboxes) along with the latest release of FSDA and make this container available from the ghcr.io repository so that a user could simply pull this container instead of building it themselves. This container is based on `mathworks/matlab' and has all the same capabilities as that container.

Types of changes

What types of changes does your code introduce to FSDA? Put an x in the boxes that apply

Overview of changes

This PR has 2 sets of files that inter-relate

  1. The folder ./docker provides a Dockerfile along with some start-up code for the resulting MATLAB and a README.md to explain how to build a docker container on an arbitrary on-prem machine
  2. Additions and changes to the .github/workflows folder to enable automatic building and pushing of a docker container post-(create release) so that we can manually trigger a build of the container and automate it via release of a new tag.

Hopefully the ./docker/ files are relatively self-explanatory!

Changes to .github/workflow are a bit more complicated and can be broken down as follows:

FILE: reusable-build-docker-container.yml

As the name suggests this is a reusable workflow that is intended to be called from other triggered workflows (as you can see in both build-docker-container.yml and upload-artifact.yml). It has a required input fsda-release (the release of FSDA from the current repo that should be installed) and an optional input matlab-release (the tag for the mathworks/matlab container to be use - defaults to latest). The resulting build will push a container with full name

ghcr.io/lowercase(REPO)/fsda:${fsda-release}-${matlab-release}

FILE: build-docker-container.yml

This is a manually triggered workflow that should be used where you want to manually re-build a specific container. It calls the reusable workflow with specified input arguments.

FILE: upload-artifact.yml

I have modified this to consist of 2 jobs - the first is a modification of your original archive-build-artifacts workflow - the only additions here are that this job now has an output that is the release of FSDA that has just been build and uploaded, along with a conditional step that stops upload-release-asset running if ./bin/FSDA.mltbx does not exist. I believe that you build this MLTBX somewhere else with another CI system and for people who fork the repo it doesn't exist.

I have then added a second job that runs after archive-build-artifacts (needs: archive-build-artifacts achieves this) and again it triggers the reusable docker build workflow in the same way as build-docker-container.yml

josmartin commented 2 years ago

I strongly encourage at least a Squash and Merge action on this request as I needed to play around with how GitHub actions worked to get this all working successfully!

codecov[bot] commented 2 years ago

Codecov Report

Merging #40 (636b2c5) into master (a24b5aa) will increase coverage by 0.39%. The diff coverage is n/a.

@@            Coverage Diff             @@
##           master      #40      +/-   ##
==========================================
+ Coverage   68.58%   68.98%   +0.39%     
==========================================
  Files         302      317      +15     
  Lines       42555    44546    +1991     
==========================================
+ Hits        29187    30728    +1541     
- Misses      13368    13818     +450     
Impacted Files Coverage Δ
utilities_help/publishFS.m 89.62% <0.00%> (-0.11%) :arrow_down:
clustering/ctlcurves.m 81.15% <0.00%> (ø)
clustering/restreigenmemopt.m 54.11% <0.00%> (ø)
clustering/restrdeterGPCM.m 100.00% <0.00%> (ø)
clustering/overlapmap.m 54.49% <0.00%> (ø)
clustering/GowerIndex.m 91.42% <0.00%> (ø)
clustering/restreigeneasy.m 97.72% <0.00%> (ø)
clustering/restreigen.m 98.00% <0.00%> (ø)
clustering/restrSigmaGPCM.m 86.30% <0.00%> (ø)
clustering/restrdeter.m 90.00% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a24b5aa...636b2c5. Read the comment docs.

UniprJRC commented 2 years ago

Dear Jos, many thanks for this new great feature, you did a excellent job!