start-os icon indicating copy to clipboard operation
start-os copied to clipboard

add x86 build and run unittests to backend pipeline

Open moerketh opened this issue 2 years ago • 2 comments

Here is some more pipeline work for your consideration. This adds a x86_64 build for the backend, in addition to the existing aarch64 build. Also added running the backend unittests on both platforms.

Relates to #1032 and #981

Added backend x86_64 build

The changes made are:

  • Build the backend for x86_64
  • Use the target names x86_64 and aarch64 (instead of amd64 and arm64) consistently in the pipeline
  • Use the same rust version everywhere
  • Remove some unnecessary build steps, or add an if when platform specific

The current Makefile only targets aarch64, so for the build and test commands I've had to ignore the Makefile.

Added executing unittests in pipeline

To run the unittests I found that some tests expect eOS environment features, such as existing files or directories. Perhaps they should be classified as integration tests and run in the eOS environment. I skipped those tests for now.

Running the tests on aarch64 was a little tricky. I found a couple of ways that didn't work. The obvious one was running cargo test in a aarch64 container. However cargo detects a change in filetime or signature and rebuilds everything, taking multiple hours on QEMU. I don't know how to fix that. The solution I found was to use nextest's archive option. Unfortunatly nextest doesn't release aarch64 binaries, so I added a stage to create them.

moerketh avatar Jul 24 '22 15:07 moerketh

There may be some considerations with the upcoming x86 builds, @dr-bonez will know more. Thank you again for your contributions :)

kn0wmad avatar Jul 24 '22 23:07 kn0wmad

FYI nextest now publishes aarch64 Linux binaries.

sunshowers avatar Jul 25 '22 02:07 sunshowers

@dr-bonez , just a note after merge., I notice a few more "util::http_reader::*" unittests are now failing because the container image the unittests are running in does not have the ca-certificates apt package installed. This is intentional, because a unittest that goes onto the internet is a too large unit in my view. We could add them to the skip list for now, or fix them if possible.

moerketh avatar Aug 19 '22 09:08 moerketh

I'd accept a pr that switches to using a local fileserver to test the code, but for now I'd rather fix the container to have ca certs, and keep the tests.

dr-bonez avatar Aug 19 '22 21:08 dr-bonez