Replies: 1 comment
-
Converted this idea into issue #25 where dev refactoring will be done. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem: Consistency between developer run tests v/s those run in CI.
Build-and-test tests run by developers are manual, and can sometimes go out-of-sync with tests run in CI jobs, implemented in
build.yml
. While adding new changes to this repo, one has to frequently go through multiple manualmake
executions and verify the outputs.Some of these commands are duplicted in the
run
methods in CI's build.ymlThis will eventually create friction when developers "think" their tests are complete, but CI jobs fail due to some other modes of test-execution.
Solution: Refactor test.sh into code that can be shared by build.yml rules.
I would like to start refactoring nascent test-code chunks in test.sh so that they can be directly re-used by the actions in
build.yml
run under CI.The idea is that each test-case in
test.sh
is refactored into a small function, which will be called underbuild.yml
by invokingtest.sh
with that named test-case-function.An example will be a function named
build-and-run-unit-tests()
intest.sh
and this will be invoked through CI as something like:test.sh
into a collection of small "test-do-this" methods.$ ./test.sh
which will run through all these test-methods on their dev-boxbuild.yml
will be a series ofrun
methods invoking each such test-method.$ ./test.sh build-and-run-c-samples
This way, developers can be sure that everything that needs to be built and tested in CI is also tested on their own dev boxes before submitting a PR for CI jobs.
Reference:
This exact same approach was implemented in the Certifier Framework oss project, after months of struggling with this dev-vs-CI inconsistency issue.
See test.sh and their build.yml for a reference implementation of how this turned out.
For example, a test-call in
build.yml
will look like:Where the matching test-code in
test.sh
is a function named exactly like thename:
above:This approach is basically stitching bunches of simple Bash scripting together into something that can be used reliably.
This technique has been used successfully in that other project.
Overview of features:
cleanup()
method has been implemented which robustly checks for non-zero$rc
from command failures--list
spits out the list-of-tests that can be run.--help
is also supported.I would like to replicate that approach in this project.
If there are better ways to do this kind of dev-test-CI integration, I'm happy to hear about it.
Beta Was this translation helpful? Give feedback.
All reactions