Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis failed push but passed PR

How is it possible that Travis the build failed for the latest push but passed the Pull Request?

On this Gist, you could find the failed and passed output log of the npm run build command that Travis gives. You could also find the configuration of Travis and here below:

install:
  - npm install
  - npm install -g angular-cli
language: node_js
script:
  - gulp html
  - gulp scss
  - gulp ts
  - gulp node
  - npm run build
node_js:
  - "6.9"
cache:
  directories:
    - node_modules
    - bower_components
like image 531
H. Pauwelyn Avatar asked Jan 07 '17 18:01

H. Pauwelyn


2 Answers

Background

This repository is configured in Travis CI to run tests on two environments - named pr and push.

A Pull Request (pr) build will be named continuous-integration/travis-ci/pr and from the docs:

Rather than test the commits that have been pushed to the branch the pull request is from, we test the merge between the origin and the upstream branch. To only build on push events, you can disable Build on Pull Requests from your repository settings.

A push build will be named continuous-integration/travis-ci/push and from the docs

Travis only runs a build on the commits you push AFTER adding the repository to Travis.

Solution

Since the merge of your branch into the base branch passed tests for continuous-integration/travis-ci/push, updating your branch to include the latest commits from the base branch will get your branch passing tests. From the image above, the GitHub UI should allow you to Update branch from the Pull Request page.

Caveat

With branch protections in place, it should be unlikely that your branch fails tests while merging into the base branch succeeds.

Be sure that you confirm that whatever was broken was actually fixed. That is, did someone "fix the build" by disabling that failing test in the base branch? As a cautious person, I would cherry-pick fixes into your branch to verify the problem is resolved.

like image 53
osowskit Avatar answered Nov 20 '22 01:11

osowskit


By a comment of @osowskit, I've found the solution of the problem. He/she said:

PR will merge your changes into the base branch and run CI tests. Push will run CI tests on the current branch. Merging the base branch into your branch will likely resolve your build test on the branch.

like image 33
H. Pauwelyn Avatar answered Nov 20 '22 01:11

H. Pauwelyn