jyn514 / GradeForge

Courses available from my.sc.edu
GNU General Public License v3.0
1 stars 0 forks source link

Run `make test` locally on commit #55

Closed jyn514 closed 6 years ago

jyn514 commented 6 years ago

This ensures that commits are atomic. Although it is possible to skip verification (git commit --no-verify), this should only be used in edge cases such as updating the readme.

This cannot be turned on by default because git refuses to populate .git/hooks from any pull. To enable it, run ln -s ../../scripts/pre-commit .git/hooks.

jyn514 commented 6 years ago

This should not be merged yet; if you update a file, make will not remake the dependencies, which defeats the point of testing. I need to update the makefile to depend on the sources as well as intermediary data files.

jyn514 commented 6 years ago

This is ready to go. Some notes: although this runs in a different worktree from gradeforge, it uses the same intermediaries, so it shouldn't remake the same database twice.

TODO: only run tests on files that have changed (i.e. pytest git diff --cached --name-only), but without the git dependency in case you want to test things before commiting

jyn514 commented 6 years ago

Ignoring the failed build - this idea won't work. Every time you check out a different branch, git will touch your files, making all the dependencies out of date, including the downloads. Going to switch to make clean && make test instead

jyn514 commented 6 years ago

Now it just remakes the whole thing every time. Going to add this to a TODO, but it'd be hard to implement: you'd need to checkout the data as well as the source in order not to break the build.