rua
rua copied to clipboard
Fix CI by using a docker for testing
Currently, CI only checks that the code compiles in Travis CI: https://github.com/vn971/rua/blob/236bc43a0a8405aa1a84a9b8c7fe84f244a6db18/.travis.yml#L16
The current reason for that is that Travis doesn't have an ArchLinux OS choice, and instead ubuntu is used at the moment. Ubuntu, however, does not have a pacman
package on it, and cargo test
fails at run-time.
One solution would be to use an Arch docker image in CI, and then change our tests from cargo check
(compilation) to cargo test
for proper testing.
There is no known actual "bug" here, but I marked the issue as "bug" because it's important. Without proper CI, you could have bugs in the future that go undetected. The "bug" could therefore mean that we're not preventing this mistake from happening proactively.
I one would try and do it, theoretically, could one be please pointed to docker thingy creation documentation?
Here's an example: https://github.com/Morganamilo/alpm.rs/blob/master/.github/workflows/alpm.yml
This line: image: archlinux
. This is interesting. I would have thought it should be like this: image: url/to/docker/image
.
Also, why use Travis CI when we have Gitlab CI?
@refaelsh I guess GitLab CI could be used as well. I think I historically started with github - most of the PR's happen here as well ATM.
@Morganamilo-s repo seem to even use github's built-in CI, which is a third approach.
WRT image
in alpm.rs, I think it runs docker inside ubuntu-latest
, so you specify both the host (one of few OS-es supported), and then what guest docker image to run in the host OS. I could be wrong though, that was just my impression. "archlinux"
is probably just this: https://hub.docker.com/_/archlinux
Also, why use Travis CI when we have Gitlab CI?
I am terribly sorry, please disregard this question. This is GitHub and not GitLab. I always get them mixed up in my head.
WRT
image
in alpm.rs, I think it runs docker insideubuntu-latest
, so you specify both the host (one of few OS-es supported), and then what guest docker image to run in the host OS. I could be wrong though, that was just my impression."archlinux"
is probably just this: https://hub.docker.com/_/archlinux
Ok. I still have much to learn about this "Docker" thingy, but it does points me in the right direction. Thank you.
cargo test
fails at run-time.
I dont understand why? Unit tests use mocks and cargo test
runs unit test. This should not fail since mocks are fake, they dont need Arch or pacman.
P.S.
I am aware that cargo test
will also run integration tests from the test folder (if it detects one), but, integration test are always come after unit tests. I suggest we first focus on the unit tests --> this issue can be postponed, and a new issue needs to be opened that would add cargo test
to CI/CD. A penny for your thoughts? :-)
The issue is the tests need to link to libalpm.so to run.