Using dune to build and test, also added Github Action
- added
duneanddune-projectfiles, so that we can now build and test withdune test - added
testdirectory, added test files forquicksortandlinear_search
From now on, contributors can build and test their contributions on their local PC as follows.
First install ocaml, opam and dune.
Let's say we add a new algorithm insertion_sort.ml to the Sorts directory.
We can also add insertion_sort_test.ml to the test/Sorts directory. In this file we can first type: open Sorts.Insertion_sort at the top, then type the tests we want.
We need to edit the test/Sorts/dune file. Add insertion_sort_test to the names line:
(names quicksort_test insertion_sort_test)
Then we can run dune build and dune test.
- added Github Action that builds and tests on push and pull request. Using: https://github.com/marketplace/actions/set-up-ocaml
You can see it in action here: https://github.com/spamegg1/OCaml/actions/runs/313616415
I am new to OCaml, dune and Github Actions so any suggestions are appreciated. @dmbaturin Please make suggestions! You seem to be more experienced in OCaml and dune.
The testing can probably be improved by using some libraries such as OUnit or ppx_inline_test or alcotest. I'm new to all this so I could not figure it out yet.
The build runs very slow (6/7/12 mins on Ubuntu/Windows/Mac) but that might be because it was the first run ever. I'd appreciate any suggestions on how to enable caching to reduce this time.