Working on installer.to with SCoRe Lab for GSoC 2020: Week 3

Heshan Geasman
SCoRe Lab
Published in
2 min readJun 2, 2020

My previous Medium article got published under SCoRe as https://medium.com/scorelab/working-on-installer-to-with-score-lab-for-gsoc-2020-a6c919a80ab9!

Last week was an interesting week! I created my first PR to installer.to GitHub repository. It’s a pay off of 3 weeks reading, searching, trying out and work. I’m happyy!

As I mentioned last week, I created a GitHub Workflow to get only the added or updated files on of a PR as a list of space separated string from this Git Diff GitHub Action. Now there is a little catch, if I pass this string directly to the shellspec it is running tests on the files. For example,

shellspec installers/git/installer.sh installers/git/util.sh

But what we want is to run the tests on the folder like

shellspec installers/git/

This way only shellspec can find the tests in the spec folder inside installers/git folder. Then I worked on getting the folders of the files in the the space separated string of changed file names. I figured out I can use the command called dirname for this. I looped through the space seperated list and collected the folder names to an array.

Then the problem was, two different files in the same directory had the same directory name and now I’m getting duplicates in the array. This makes the shellspec run the tests twice. Then I uses uniq command with several other commands to get the unique values only in the array.

But here was one more problem, let’s same following two files were modified.

installers/git/installer.sh installers/git/spec/test.sh

Now what I get in the array is something like this,

installers/git/ installers/git/spec/

But I still don’t wont to run test again for both of the above because when I run installers/git/ it runs tests in installers/git/spec/ also. Other thing is, shellspec always looks for a spec folder in the given folder for tests. If I give installers/git/spec/ it is looking for a folder like installers/git/spec/spec which does not exists. To fix this issue, I am now taking only the two two folders from the directory names. I an now splitting the directory names by / and again combining only the first two parts. This way I get only following.

installers/git/ installers/git/

Then when I do duplicate elimination, it all boils down to one directory path.

Finally I changed the output format to show the tests ran in the output.

Before
After
After

Now we can see the list of tests ran in a nicely formatted format rather just dots as the progress.

--

--