Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing: Travis Integration out-of-date #36451

Open
gklandes opened this issue Apr 6, 2020 · 2 comments · May be fixed by #37473
Open

Testing: Travis Integration out-of-date #36451

gklandes opened this issue Apr 6, 2020 · 2 comments · May be fixed by #37473

Comments

@gklandes
Copy link

@gklandes gklandes commented Apr 6, 2020

📚 Docs or angular.io bug report

Description

The docs for Travis integration under Angular.io > Guide > Testing link do not lead to a working integration.

There are a couple of issues in the sample .travis.yml:

  • sudo: false is not necessary and gets flagged in the build log; remove this line
  • the addons section should use the newer invocation of google chrome (see example below)
  • under the script section
    ** the test line references ChromeHeadlessCI which should be ChromeHeadless
    ** the e2e line references the config file e2e/protractor-ci.conf.js but this file's name is actually e2e/protractor.conf.js

Also in protractor.conf.js I found that capabilities needed to define some options for chrome:

  capabilities: {
    'browserName': 'chrome',
    'goog:chromeOptions': {
      args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
    }
  },

🔬 Minimal Reproduction

What's the affected URL?**

https://angular.io/guide/testing#configure-project-for-travis-ci

Reproduction Steps**

  • create new cli app ng new app
  • verify that ng test and ng e2e complete successfully
  • publish to Github
  • connect to Travis CI
  • Use the sample provided at the "affected URL" above to create a .travis.yml file

I created a demo repo on Github with Travis CI:

Expected vs Actual Behavior**

EXPECT

  • pristine app to build successfully

ACTUAL

  • Travis logging should an error: apt-get install failed The command "sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install google-chrome-stable" failed and exited with 100 during .
  • remediation involves the fixes mentioned above in the "Description"; there are other errors that are revealed as fixes are applied.

📷Screenshot

none; example repo w/ build provided

🔥 Exception or Error


apt-get install failed
The command "sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install google-chrome-stable" failed and exited with 100 during .

🌍 Your Environment

  • mac OS
  • ng version:

Angular CLI: 9.0.7
Node: 12.13.0
OS: darwin x64

Angular: 9.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.7
@angular-devkit/build-angular     0.900.7
@angular-devkit/build-optimizer   0.900.7
@angular-devkit/build-webpack     0.900.7
@angular-devkit/core              9.0.7
@angular-devkit/schematics        9.0.7
@ngtools/webpack                  9.0.7
@schematics/angular               9.0.7
@schematics/update                0.900.7
rxjs                              6.5.5
typescript                        3.7.5
webpack                           4.41.2

Browser info

does not appear to be browser related.

Anything else relevant?

The changes to protractor.conf.js may warrant a separate ticket on the angular repo. Please advise if you'd like that bugged separately.

@ngbot ngbot bot added this to the needsTriage milestone Apr 6, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Apr 6, 2020
@kapunahelewong kapunahelewong added this to Committed - Selected for development in docs Apr 6, 2020
@kapunahelewong
Copy link
Contributor

@kapunahelewong kapunahelewong commented May 28, 2020

@gklandes Thanks so much for explaining the details! This is super helpful for the docs team. 🚀

Status: Docs team, there's enough info here to test, confirm, and update the docs.

@obumnwabude
Copy link

@obumnwabude obumnwabude commented Jun 6, 2020

Thanks, @gklandes for this.
Yes, you are right, some things are out of date.

  • sudo: false is of no use

Concerning the first point you raised:

sudo: false is not necessary and gets flagged in the build log; remove this line

sudo: false was used to specify that the Travis CI build should take place in container-based environments. But this, however, ceased to be applicable since 2018. Travis CI specified that all builds will take place in the virtual machine environment since the virtual machines provided more CPU and memory resources than the container-based environments. Consequently, sudo: false in the .travis.yml file is simply been ignored by Travis CI and as @gklandes rightly said, it needs to be removed. Check out the Travis CI blog on this subject at https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration

  • Using the newer invocation of Google Chrome

Concerning the second point you raised:

the addons section should use the newer invocation of google chrome (see example below)

Yes you are equally right in this, Chrome addon is now added in .travis.yml file with chrome: beta or chrome: stable as specified at https://docs.travis-ci.com/user/chrome. And no longer with apt. This needs to be changed too.

  • No need to edit the script section of .travis.yml file

Concerning the third point you raised:

under the script section
** the test line references ChromeHeadlessCI which should be ChromeHeadless
** the e2e line references the config file e2e/protractor-ci.conf.js but this file's name is actually e2e/protractor.conf.js

Just immediately after the Configure project for Travis CI section in the Angular Documentation at https://angular.io/guide/testing#configure-project-for-travis-ci, are instructions to set up the ChromeHeadlessCI custom launcher in the karma.conf.js file and the protractor-ci.conf.js file in the root of e2e folder. These instructions are directly after the Travis CI section, under the Configure CLI for CI testing in Chrome section at https://angular.io/guide/testing#configure-cli-for-ci-testing-in-chrome

So, if those instructions are followed, one does not need to add the capabilities option directly in the protractor.conf.js file. Also, there will be no need to edit the script commands in .travis.yml file since ChromeHeadlessCI would have been set in karma.conf.js and e2e/protractor-ci.conf.js will be present and will contain the capabilities option specified by the Angular Docs Team.

  • Trusty is old, Xenial is most recent

As of now, the latest version of Chrome Driver used by ng e2e is version 83 and it requires Chrome to be of version 83 too. If one uses the Travis CI, CLI and Chrome setup as specified at in the Angular Documentation, and if they just removed the sudo: false and change addon for Chrome from apt to chrome: stable, they will still face build errors from Travis CI.

The error will be like such:
E/launcher - session not created: This version of ChromeDriver only supports Chrome version 83 (Driver info: chromedriver=83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}),platform=Linux 4.4.0-101-generic x86_64) E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 83

This because the Ubuntu system specified in .travis.yml by the dist key is trusty, but that is outdated too and it has an old version of Chrome. Removing dist: trusty entirely from .travis.yml leaves Travis CI to run the build with the latest Ubuntu system which is Xenial. One can still specify dist: xenial in .travis.yml file but without it, the build will still run in Xenial. It is the current default. Besides, it is better left out so that future changes on dist by Travis CI will not require an edit to the Angular Docs.

So dist: trusty needs to be removed.

Read more about it at https://blog.travis-ci.com/2019-04-15-xenial-default-build-environment

  • Reviewing your demo

I made a pull request with the above-discussed changes to the demo repository you provided. Please check it out gklandes/angular-travis-docs-demo#1

obumnwabude added a commit to obumnwabude/angular that referenced this issue Jun 6, 2020
Remove sudo since it no longer has use in Travis CI build configurations.
Change chrome addons to use the latest required method.
Remove dist to make the Travis CI builds run in the latest Ubuntu release: Xenial.
This because Trusty uses an older version of Chrome which is not supported
by the current the latest Chrome Driver, used in ng e2e tests.

Fixes angular#36451
@obumnwabude obumnwabude linked a pull request that will close this issue Jun 6, 2020
3 of 14 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
docs
Committed - Selected for development
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.