Skip to content
Philippe Pinard edited this page Aug 30, 2015 · 3 revisions

Here are the details how the synchronization is performed between the code provided by Probe Software and the GitHub repository of the openMicroanalysis project. The synchronization was found to be the best compromise to allow Probe Software to continue distributing its code as it prefers and to make the code available online on GitHub as the other openMicroanalysis projects.

##Input The Probe Software code for CalcZAF is distributed in a ZIP file, containing the source code and required files for this program. It also contains a VERSION.TXT file which contains the latest changes to the project.

##Script A Python script (sync.py) was written to:

  1. Pull repository from GitHub
  2. Download ZIP containing CalcZAF source code from Probe Software website
  3. Parse VERSION.TXT text file and compare for new changes
  4. Extract files from ZIP
  5. Add modified files, commit and push to GitHub

The script is written in pure Python and has no dependency. Parsing the VERSION.TXT is done using regular expression as the structure is well-defined. Changes since the last synchronization are combined into a new commit message. Tags are added for new versions. All modifications are then push to GitHub.

##Continuous integration To allow the synchronization to be performed on a daily basis, two free third-party applications for GitHub are used: Travis CI and Nightli.es. Travis CI is a continuous integration where scripts written in different languages can be run on a project. This is usually used to run unit tests and/or deploy new version of a program. Unfortunately Travis CI usually only run when new modifications are committed to a project. For the purpose of synchronization we need to run the script every day to check for new modifications. To force Travis CI to run daily, nightli.es is used. It simply check that the synchronization script is run at least once per day.

The setup of Travis CI is also slightly more involved than usual as the script needs "write" access to the repository. For this we created a deploy key (using ssh-keygen) and added the public key to the deploy keys associated to the calczaf project. Using the encryption function of Travis CI, the private key is encrypted and added to the repository. Before running the synchronization script, the key is decrypted in the .travis.yml instruction file.

Clone this wiki locally