dancryer / PHPCI

PHPCI is a free and open source continuous integration tool specifically designed for PHP.
BSD 2-Clause "Simplified" License
2.42k stars 439 forks source link

Building latest commit from a set of pushed commits #656

Open poul-kg opened 9 years ago

poul-kg commented 9 years ago

When I develop a new feature, I create new local branch. When feature is done I merge this local branch with master and push to GIT. This results in a lot of commits in GIT as well as lot of builds in PHPCI. I want PHPCI to build from the latest commit only, and not create build from each and every new commit.

Is there a way how to achieve this?

EmmanuelVella commented 9 years ago

:+1: That would be great

SamMousa commented 9 years ago

Should in progress builds be canceled? If not we could do a relatively simple pruning on the queue.

tomschlick commented 9 years ago

This would be great. Many people use git to commit early and often and merging/pushing a branch could potentially spawn hundreds of jobs.

tvbeek commented 9 years ago

I think it need to be an option. Here we want to see the status of all the commits (especially if people work local and commit a whole set of commits in one time)

But you can delete the builds while they didn't start yet, maybe it is nice to have the option to delete a set of builds in action.

tomschlick commented 9 years ago

I don't understand the point of running builds on outdated / potentially broken commits.

If I push up 10 commits: commit number 8 could fix something I did in commit number 2. All I would care about is that as of commit 10 the build is good.

If there is an option I would think this should be default behavior and running a build per commit would be the option.

MarkMaldaba commented 9 years ago

If I push up 10 commits: commit number 8 could fix something I did in commit number 2. All I would care about is that as of commit 10 the build is good.

Yes, but if someone else broke something in number 2 and only number 10 is checked, it will look like you broke it.

As far as default behaviour, the whole point of CI is to report on changes over time. If not, and - as you suggest - you don't care about any history, you might as well just run your tests manually before you commit. Therefore it makes sense to me for default behaviour to be as it currently is.

I suspect both models are desirable for different use-cases, but the 'review every commit' model is definitely the most sensible default, and I would recommend it as best-practice for any project involving more than one person.

asgrim commented 8 years ago

:+1: for me; I just rebased a load of branches and pushed them all, every single commit has been created as a build!

dancryer commented 8 years ago

I tend to squash the history into one commit if I'm not interested in testing all of the distinct commits... Generally though we push individual commits to branches on an ongoing basis, so the builds don't stack up like that.

asgrim commented 8 years ago

@dancryer if you rebase that branch however, it rebuilds every single commit, even with a 4 minute build time, that can really stack up... :|

asgrim commented 8 years ago

Just to give you an idea of the scale of the problem, we have an open PR on a private project that currently has 122 commits, each build takes about 8 minutes to run (it runs on some slow IBM i hardware), which means when we come to rebase that (which we have to do to get the build to actually pass), this PR will take 16 HOURS to build because of this. Any other sane build system will only build the latest commit as discussed above. Additionally, if something is merged to master whilst something is building, every single subsequent build will fail, with messages like:

Checking out files:  99% (821/829)   
Checking out files: 100% (829/829)   
Checking out files: 100% (829/829), done.

Auto-merging phpunit.xml.dist
CONFLICT (add/add): Merge conflict in phpunit.xml.dist
... (redacted many conflit messages) ...
Auto-merging config/autoload/templates.global.php
CONFLICT (add/add): Merge conflict in config/autoload/templates.global.php
Auto-merging config/autoload/routes.global.php
CONFLICT (add/add): Merge conflict in config/autoload/routes.global.php
Auto-merging config/autoload/middleware-pipeline.global.php
CONFLICT (add/add): Merge conflict in config/autoload/middleware-pipeline.global.php
Auto-merging config/autoload/doctrine.global.php
CONFLICT (add/add): Merge conflict in config/autoload/doctrine.global.php
Auto-merging config/autoload/dependencies.global.php
CONFLICT (add/add): Merge conflict in config/autoload/dependencies.global.php
Auto-merging composer.json
CONFLICT (add/add): Merge conflict in composer.json
Automatic merge failed; fix conflicts and then commit the result.
Switched to a new branch 'phpci/1002'

Failed to clone remote git repository.
Exception: Could not create a working copy.