radicle-dev / radicle-surf

A code browsing library for VCS file systems.
Other
32 stars 11 forks source link

Handle test assets without submodules and extra setup #180

Closed uint closed 3 years ago

uint commented 3 years ago

This is part of the work for #176, but not all of it. It's just my proposal! We can scrap it if it doesn't work for you.

How it works

git-platinum is now kept as a tarball in data/git-platinum.tgz. All the necessary refs are in there already. There's a build.rs script that extracts the archive into data/git-platinum, which is ignored by git (git doesn't like nested repos, so we don't want to try checking it in).

Updating git-platinum

There's a script for that - scripts/update-git-platinum.sh. It will fetch the newest version of git-platinum, add the necessary refs, then update and commit the archive.

The big win

It should now be possible to simply git clone the repo and run cargo test without extra setup necessary, keeping it simple for future contributors. Also no more submodules.

Drawbacks

FintanH commented 3 years ago

The build script doesn't distinguish between test builds and other builds. It will unpack the archive even if we're not running any tests. Any errors there will stop the build.

I thought we might have been able to use:

if cfg!(test) {
  unpack
  println!
}

But it seems like the build.rs file doesn't know about cargo test being run and so it never fires. Not a big deal anyway since it'll only run once unless the tar file is changed. If it fails the person won't be able to run the tests which would be bad anyway and they should report an issue.

uint commented 3 years ago

I'm in favour of this! What would the rest of the work look like? :)

Oh, I was referring to actually reorganizing the tests - as you wanted to in #176. No idea yet!

uint commented 3 years ago

Rebased and added sign-offs.

FintanH commented 3 years ago

Merged via https://github.com/radicle-dev/radicle-surf/commit/f238a450c7cbee4faad1f663871716fff3b29855