Skip to content
This repository has been archived by the owner on May 31, 2018. It is now read-only.

[WIP] Add tests and Travis CI config #784

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ismaelgv
Copy link
Contributor

@ismaelgv ismaelgv commented Dec 7, 2017

In this PR, there are several additions related to the test discussion in #708:

  • Create Docker image to run tests in a clean environment.
  • Add manual installation and package operation separated tests.
  • Add .travis.yml configuration.

I've tested this workflow in my fork and it seems to work quite fine. Obviously, you need to activate Travis CI for this project.

Basically, we generate a local Docker image from base/devel called arch-pacaur using tests/image/Dockerfile. This image contains all pacaur dependencies, including cower. We use arch-pacaur image to run two types of tests:

  • Manual installation (tests/test_install.sh - must be run with sudo): follow steps to install pacaur shown in its PKGBUILD except man generation/install.
  • Package operations (tests/test_packages.sh): test system updating, package installation and removal.

I've tried to develop this test workflow as flexible and extensible as possible. The idea is adding more test eventually.


Note 1: Docker image is generated before each test since it is using a Travis test matrix. Test matrix is used to run every test in parallel. It does not takes long to build Docker image anyways (~1 minute and 30 secs).

Note 2: These tests have been developed to be run in the Docker image, may cause unexpected results if they are ran in an actual system.

@rmarquis
Copy link
Owner

rmarquis commented Dec 8, 2017

Thanks for digging into this.

follow steps to install pacaur shown in its PKGBUILD except man generation/install.

What is the rational here, if I may ask? Some issue with Perl?

@ismaelgv
Copy link
Contributor Author

ismaelgv commented Dec 8, 2017 via email

@rmarquis
Copy link
Owner

rmarquis commented Dec 8, 2017

In that case, wouldn't be easier and more logical to use the pacaur PKGBUILD + makpekg -sri directly instead of duplicating its content? This way, we could ensure the official way of installing is also done on docker. The (pacaur-git) PKGBUILD would obviously need to be stored in the git repo.

I guess even hosting the PKGBUILD of the stable version would make sense.

@ismaelgv
Copy link
Contributor Author

ismaelgv commented Dec 8, 2017 via email

@rmarquis
Copy link
Owner

rmarquis commented Dec 8, 2017

The problem here would be testing changes in non-master branches, PRs, etc.
We would need to generate/change PKGBUILDs during the test to point to the
commit. Definitely, it is feasible but not sure if offers any advantage.

Good point. In that case, here is another proposal:

Move the PKGBUILDs content to a buildsystem (make install or similar). This way, the installation process would be entirely handled in the repo for all branches without duplication in the PKGBUILDs.

@ismaelgv ismaelgv force-pushed the ci-tests branch 2 times, most recently from d63e9d1 to 7cfa941 Compare December 10, 2017 23:18
@ismaelgv
Copy link
Contributor Author

I have created a simple Makefile that works pretty well in combination with CI. I suppose you could use make and make install in the PKGBUILD.

@rmarquis
Copy link
Owner

I suppose you could use make and make install in the PKGBUILD.

Yes, that is the idea.

@ismaelgv
Copy link
Contributor Author

I've added DESTDIR and PREFIX to the Makefile. PREFIX is set to /usr/local as GNU Make documentation suggest, and DESTDIR is empty by default. In the PKGBUILD, you need to change these variables to install files:

make install DESTDIR=$pkgdir PREFIX=/usr

I've installed pacaur with this PKGBUILD pointing to my ci-tests branch, and everything seems fine.

@rmarquis
Copy link
Owner

rmarquis commented Dec 12, 2017

Reworked the Makefile, based on your work. Thanks!
As discussed in #708, starting from scratch might be a better solution than doing incremental changes, as the current code is so closely tied togother (ie, monolithic spaghetti monster). At the same time, I'm still wondering if a new repo would be a better solution on the long run.

* Travis CI configuration
* Add arch-pacaur Docker image.
* Add basic package tests.
@ismaelgv
Copy link
Contributor Author

Even if you start from scratch you can use .travis.yml and Dockerfile of this PR. It will not do any harm to the final user to got some tests right now, independendently of future massive overhaul.

I have removed Makefile conflict from this PR, and now there is only:

  • Travis CI configuration.
  • arch-pacaur Docker image.
  • Basic package tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants