Update .gitattributes to excluded tests from built releases

Bug #897593 reported by Andrew Nicols
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Low
Andrew Nicols

Bug Description

When generating releases, we currently do not include our tests (e.g. selenium).

It's been proposed that we allow for unit tests to be located within each component (e.g. /blocks/XXX/tests/) to allow for easier maintenance of that module.

The files are excluded from release tarballs using a .gitattributes file.

The change I'm submitting is a little heavy-handed and will prohibit the use of a directory or file named tests anywhere within mahara. If accepted, we should add a warning on push (e.g. in the Makefile) to remind that this directory is always excluded.

An alternative would be to modify the release script to find all occurrences of tests/phpunit and place these into a new .gitattributes file, and then to use the --worktree-attributes option to git archive to ensure that specific candidates are removed. If this option is preferred, we should also attempt to remove empty tests directories.

Tags: release tests
Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

Posted the first option in https://reviews.mahara.org/898

Revision history for this message
François Marier (fmarier) wrote :

I would be a little bit cautious about this because that's exactly the kind of thing we will forget about and then we could end up generating tarballs that are missing files. The way we currently test releases (we don't test the tarball, we test the git tag for it) there is a very real danger of releasing things that don't work.

A warning in the push alias that gets printed every time we push is, usability-wise, equivalent to no warning at all. Our eyes will quickly get used to it and will happily filter it out for us. So I don't think that's going to help much.

I think that if we're going to have tests all over the place (as opposed to self-contained in a separate directory like the selenium tests), then we should add these full paths to the .gitattributes file. Sure, if we miss one, it ends up in the release, but that's not a big problem compared to not shipping a file that is really needed.

Changed in mahara:
status: New → Triaged
status: Triaged → In Progress
Revision history for this message
Andrew Nicols (dobedobedoh) wrote :

I've made a merge request on the scripts directory for this. See http://gitorious.org/mahara/mahara-scripts/merge_requests/2

This change modifies the build process slightly to generate a new .gitattributes directory and use the --worktree-attributes option to git archive when generating the archives.

When building the .gitattributes file it only includes tests directories (not files) containing a phpunit directory.

If a tests directory only contains a phpunit directory, the whole tests directory is excluded.
If a tests directory contains other contents, then only the phpunit tests is excluded.

Changed in mahara:
status: In Progress → Fix Released
milestone: 1.5.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.