mercredi 3 janvier 2018

How to design a git repository architecture for uniform testing on all branches?

My problem is a bit more complicated than that, but let's assume for simplicity the following case: (In case more detailed information is needed, please comment and I will clarify)

I have a project with several branches competing for an implementation of a certain feature.

I want to check how well every branch complies with the specification (which is also continuously improved), and to do this, I write a set of tests, adding a new one once every few days.

This way my 'superproject' has to subprojects: 'library' and 'library-tests'.

I (obviously) want to keep them both under version control.

I don't really understand how to design a repository architecture.

Say, now I have a git repo for the 'library'.

I could create an non-versioned directory 'tests' inside and put all the tests into it. Then I would also add a file 'testbranches.bat', which would checkout every branch in the repo one by one and run tests, placing the report in the 'tests' directory.

But in this case my tests wouldn't be under version control. In addition I would get nasty messages every time I run 'git status'.

I cannot really add these 'tests' and 'testbranches.bat' to .gitignore and commit to every branch, because someone may derive a branch from before this addition. (Well, I could do 'git filter-tree for every commit, but it is always error prone, and also a very heavy task.)

I could try a different approach and instead put tests in a separate repo, say 'library-tests', make a directory 'test-subject' inside the directory, and add put it into '.gitignore'. Then my 'testbranches.bat' would 'cd' to this directory, pull all the branches, checkout all of them one by one and run tests for every branch.

Seems to work, but involves a lot of copying and in general looks a bit bodged.

Is there some 'out of the box' or a least 'semi-cooked' solution for this task?

I did a bit of research on 'git submodule', 'git subtree', 'git subrepo', 'git worktree' and 'git-test', but having so many options confuses me, so if someone could suggest the best practice, it would help.

Aucun commentaire:

Enregistrer un commentaire