MichaelSel / edoJS

A set of functions for manipulating musical pitches within a given EDO
GNU Affero General Public License v3.0
5 stars 0 forks source link

[Code] Add Continuous Integration pipeline (CI) #12

Closed albincorreya closed 2 years ago

albincorreya commented 2 years ago

According to JOSS guidelines, it is highly encouraged to use Continous Integration (CI) tools for automating tests, publishing to package manager, etc. This can be very useful for easily maintaining the repository. However, these are not strictly mandatory according to JOSS guidelines.

Since the repo is on Github, I encourage you to use Github Actions for adding CI/CD to the repo. I think it can be set up quite easily by specifying a YAML configuration in the repository.

Automated Tests (Related to #8)

I can see there are some unit tests defined here in the repository.

You could add an entry point to run your tests in the package.json file. Just replace this line with "test": "mocha".

Why? - You could run the test with the command npm run test. This can be useful for both local development and in your CI pipeline.

Pipeline to publish the library into NPM or similar (Optional) (related to #11 )

Add a step in your pipeline to publish edo.js library to NPM or any JS package managers. Here is a guide on how to do it with Github Actions.

Alternatively, you could also do the same thing from your local computer considering you're the only maintainer of the library.

Why?

Once this setup is done, you can easily release the new updates of the library once it is reviewed and merged into your master branch automatically. In addition, you can also run automated tests whenever a change is made in the repository.

A typical example workflow would be something like this,

Merge PR -> Run Github actions (ie, Install project dependencies -> Run unit tests -> Build the library files to various JS specifications (minified, UMD, ES* style etc) -> Update version and publish to NPM)

I hope it is helpful. Let me know if something is not clear!

MichaelSel commented 2 years ago

Added the automated tests line as you suggested. The library is already part of NPM and I did it locally when I created the library initially a few months ago. I am having a bit of a hard time using GitHub Actions for integration with NPM when the library already exists on NPM. I never used GitHub actions before. I'll give it another look later today.

MichaelSel commented 2 years ago

I think for now I'll keep publishing to NPM manually and grapple with the GitHub actions at a later time