[P3] Set up CI workflows
At least to see if the code still compiles before pushing to master.
I need some help on this. I even don´t known it it is possible. For instance windows and linux at same time?
It should be possible, yes. I don't have much experience myself, either, but I've seen it being done.
Is it easy to do a linux build? or run cake unit tests? cake unit tests could return the number of tests that failed.. then this is the target :D to avoid regression
It's probably about an hour of work. I don't have time to do it this week but maybe I (or someone in our team) can make some time next week to look into it.
Not sure how much work tracking the number of failing tests across different runs would be, but I set up some simple CI that at least checks that things build and the tests run. :P It isn't much, but it's a start.
this is the code called on test..
#include "unit_test.c"
int main(int argc, char** argv)
{
enable_vt_mode();
test_main();
printf("%d tests failed, %d tests passed\n", g_unit_test_error_count, g_unit_test_success_count);
}
#endif
it can be modified to
return g_unit_test_error_count != 9 ? EXIT_FAILURE : EXIT_SUCCESS;
where 9 is the number of current failing tests.
I never used this. I don't know how it works! Does it blocks commits? Does it runs on each checkin? I will do some experiments like breaking a test.
You can set the repository to forbid pushing straight to main and require people to open pull requests, then you can set up rules there on what checks must be "green" and which ones are allowed to break. :P
That kind of workflow would require you to open PRs for your changes too if you want the check to run before you put the code in main, though. :P
Try pushing a branch and opening a PR with a broken test! :D
I created a syntax error.. it green then a test failing it return fail on tests and still green. maybe it is not checking the results?
this is the code I try to catch the gcc compilation error
int system_like(const char* command)
{
int test_result = system(command);
int stat = 0;
wait(&stat);
if (WIFEXITED(stat))
{
test_result = WEXITSTATUS(stat);
}
else if (WIFSIGNALED(stat))
{
test_result = WTERMSIG(stat);
}
return test_result;
}
i think it returns always 0
this is amazing!
Is it possible to make commits on this integration? For instance, change the version number at version.h then commit.
this is amazing!
It is very convenient compared to manual testing, yeah. :P
Is it possible to make commits on this integration? For instance, change the version number at version.h then commit.
The jobs get a GITHUB_TOKEN environment variable that you can use for e.g. creating issues or committing code or uploading releases and things.
See https://stackoverflow.com/questions/57921401/push-to-origin-from-github-action/58393457#58393457 for how you can use regular git commands in an action. :P