Page MenuHomePhabricator

Activate phan CI tests
Closed, ResolvedPublic

Description

Phan tests are fairly common in WMFs CI setup, as such it would be good to have it enabled for the Wikispeech extension.

While it is fairly easy to set-up it takes some fiddling to to get it to run under Vagrant (see T234240)

The implementation path would be

  • Activate locally (add config and dependencies to composer.json)
  • Fix any issues P11555
  • Document how to run this locally (in Vagrant)
  • Activate in CI (integration/config)

Event Timeline

Change 606131 had a related patch set uploaded (by Lokal Profil; owner: Lokal Profil):
[mediawiki/extensions/Wikispeech@master] [WIP]Add Phan support

https://gerrit.wikimedia.org/r/606131

Instructions for getting phan to run on vagrant exist at https://gist.github.com/lokal-profil/eab463ba21ffe620e20548e068c32e91 (note that the .sh hasn't been tested)

Lokal_Profil set the point value for this task to 4.Jun 17 2020, 6:49 PM
Lokal_Profil moved this task from Backlog to In progress on the Wikispeech-Jobrunner (Sprint) board.
Lokal_Profil updated the task description. (Show Details)

@Sebastian_Berlin-WMSE Think you are the most suited for reviewing the fixes as these primarily affect code you had written

I had to go back and manually run sudo pear/bin/pecl install ast to get it to install properly, otherwise I got the error below.

PHP Warning:  PHP Startup: Unable to load dynamic library 'ast.so' (tried: /usr/lib/php/20170718/ast.so (/usr/lib/php/20170718/ast.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/ast.so.so (/usr/lib/php/20170718/ast.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'ast.so' (tried: /usr/lib/php/20170718/ast.so (/usr/lib/php/20170718/ast.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/ast.so.so (/usr/lib/php/20170718/ast.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
ERROR: The php-ast extension must be loaded in order for Phan to work. Either install and enable php-ast, or invoke Phan with the CLI option --allow-polyfill-parser (which is noticeably slower)
php-ast can be installed in the following ways:

1. Unix (PECL): Run 'pecl install ast' and add extension=ast.so to your php.ini.

2. Unix (Compile): Download https://github.com/nikic/php-ast then compile and install the extension as follows:

   cd path/to/php-ast
   phpize
   ./configure
   make
   sudo make install

   Additionally, add extension=ast.so to your php.ini file.
For more information, see https://github.com/phan/phan/wiki/Getting-Started#installing-dependencies

I had to go back and manually run sudo pear/bin/pecl install ast to get it to install properly, otherwise I got the error below.

Did you follow the instructions or run the shell script? If the latter then I might have to tweak it to make sure it answers the prompts raised by php go-pear.phar, possibly those meant the pecl call didn't go though.

Change 606131 merged by jenkins-bot:
[mediawiki/extensions/Wikispeech@master] Add Phan support

https://gerrit.wikimedia.org/r/606131

I ran the script, though I did run the first few steps manually before realizing that there was a script. I don't know if that may have broken something. I also don't know how to easily start from scratch and try again.

Change 606940 had a related patch set uploaded (by Lokal Profil; owner: Lokal Profil):
[integration/config@master] Add phan to Wikispeech

https://gerrit.wikimedia.org/r/606940

Change 606940 merged by jenkins-bot:
[integration/config@master] Add phan to Wikispeech

https://gerrit.wikimedia.org/r/606940

I ran the script, though I did run the first few steps manually before realizing that there was a script. I don't know if that may have broken something. I also don't know how to easily start from scratch and try again.

I've updated the script to pass the prompts to the installer. Can check if it works for @kalle before digging into it any deeper.

Ok. To test the documentation I'll have to manually uninstall php-ast (sudo pear/bin/pecl uninstall ast) and pear (maybe sudo pear/bin/pear uninstall pear) and make sure any changes to the .ini files are reverted, as well as nuking the go-pear.phar and Vagrantfile-extra.rb files. I'll put that on the back-burner for now.

Ok. To test the documentation I'll have to manually uninstall php-ast (sudo pear/bin/pecl uninstall ast) and pear (maybe sudo pear/bin/pear uninstall pear) and make sure any changes to the .ini files are reverted, as well as nuking the go-pear.phar and Vagrantfile-extra.rb files. I'll put that on the back-burner for now.

Removed everything then tested and it seems to work

Change 607613 had a related patch set uploaded (by Lokal Profil; owner: Lokal Profil):
[mediawiki/extensions/Wikispeech@master] Add php-ast install script and intructions to dev/

https://gerrit.wikimedia.org/r/607613

Lokal_Profil changed the point value for this task from 4 to 1.Jun 25 2020, 8:41 AM
Lokal_Profil removed a project: Patch-For-Review.
Lokal_Profil moved this task from In progress to Done on the Wikispeech-Jobrunner (Sprint) board.

Change 607613 had a related patch set uploaded (by Lokal Profil; owner: Lokal Profil):
[mediawiki/extensions/Wikispeech@master] Add php-ast install script and intructions to dev/

https://gerrit.wikimedia.org/r/607613

Moved to subtask T260874: Add php-ast install script and intructions to dev/