Mythic
Mythic copied to clipboard
Add test gh action
As more test may be added in the future, related to https://github.com/its-a-feature/Mythic/issues/286, I believe adding a small CI runner (free for small public repo like these) would be beneficial and help new developers onboard more confidently.
Adding other checks such as linter can be done as well later on :)
For this go test -v ./... call, if one of the tests results in a FAIL case, would that be enough to cause the rest of the tests to still run but error out the whole runner?
Hey @its-a-feature, sorry for the delay, but yep, it'll run all test and if one fail, go test will return a status code 1, and the github action will then error out.
I'm putting the -v so it's a bit more verbose, but that's something you can tweak to your need later.
Example (created a dummy fake test, that only fails, locally):
21:02:48 edznux@Trinity[~/dev/Mythic/mythic-docker/src] (add-test-gh-action)$ go test -v ./...
? github.com/its-a-feature/Mythic [no test files]
? github.com/its-a-feature/Mythic/crypto [no test files]
? github.com/its-a-feature/Mythic/database [no test files]
? github.com/its-a-feature/Mythic/database/structs [no test files]
? github.com/its-a-feature/Mythic/grpc [no test files]
? github.com/its-a-feature/Mythic/grpc/services [no test files]
? github.com/its-a-feature/Mythic/rabbitmq [no test files]
? github.com/its-a-feature/Mythic/logging [no test files]
? github.com/its-a-feature/Mythic/webserver [no test files]
? github.com/its-a-feature/Mythic/utils/errors [no test files]
? github.com/its-a-feature/Mythic/utils/structs [no test files]
? github.com/its-a-feature/Mythic/utils [no test files]
? github.com/its-a-feature/Mythic/webserver/controllers [no test files]
=== RUN TestValidateLogin
ValidateLogin_test.go:6: failed blabal
--- FAIL: TestValidateLogin (0.00s)
FAIL
FAIL github.com/its-a-feature/Mythic/authentication 0.010s
FAIL
21:03:16 edznux@Trinity[~/dev/Mythic/mythic-docker/src] (add-test-gh-action)$ echo $?
1
Running the Github action locally via act returns:
[Go package/build] ✅ Success - Main Build
[Go package/build] ⭐ Run Main Test
[Go package/build] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir=mythic-docker/src
| ? github.com/its-a-feature/Mythic [no test files]
| ? github.com/its-a-feature/Mythic/crypto [no test files]
| ? github.com/its-a-feature/Mythic/database [no test files]
| ? github.com/its-a-feature/Mythic/database/structs [no test files]
| ? github.com/its-a-feature/Mythic/grpc [no test files]
| ? github.com/its-a-feature/Mythic/grpc/services [no test files]
| ? github.com/its-a-feature/Mythic/logging [no test files]
| ? github.com/its-a-feature/Mythic/rabbitmq [no test files]
| ? github.com/its-a-feature/Mythic/utils [no test files]
| ? github.com/its-a-feature/Mythic/utils/errors [no test files]
| ? github.com/its-a-feature/Mythic/utils/structs [no test files]
| ? github.com/its-a-feature/Mythic/webserver [no test files]
| ? github.com/its-a-feature/Mythic/webserver/controllers [no test files]
| === RUN TestValidateLogin
| ValidateLogin_test.go:6: failed blabal
| --- FAIL: TestValidateLogin (0.00s)
| FAIL
| FAIL github.com/its-a-feature/Mythic/authentication 0.009s
| FAIL
[Go package/build] ❌ Failure - Main Test
[Go package/build] exitcode '1': failure
[Go package/build] 🏁 Job failed
Error: Job 'build' failed