Simple way to test your ext on TravisCI

Discussion forum for Extension Writers regarding Extension Development.
User avatar
Ger
Recognised Extension Developer
Posts: 1864
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Simple way to test your ext on TravisCI

Post by Ger » Wed Aug 31, 2016 2:21 pm

That's already there. Every time I push something to the repository, there is a request at https://travis-ci.org/GerB/cmbb/requests
However, every request that I find there reports
Branch "1.0.0-dev" not included per configuration.
Edit:
Urgh, found the problem. In .travis.yml there is an option for branches.

Code: Select all

branches:
  only:
    - master
    - /^\d+(\.\d+)?\.x$/
My branche is called 1.0.0-dev and was therefore excluded. Added that, and now it works. Build is failing with hundreds of code-formatting issues, but those are easily sorted. After that, it fails at the EPV. Some warnings and this error:
Error: Packaging structure doesn't meet the extension DB policies.
Not sure what's wrong with it though, since the structure comes from the skeleton-tool...
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25316
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Simple way to test your ext on TravisCI

Post by Paul » Wed Aug 31, 2016 5:57 pm

You can ignore that error from EPV, it is meant for validation in the extensions database. That message should not result in a broken build.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
Ger
Recognised Extension Developer
Posts: 1864
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Simple way to test your ext on TravisCI

Post by Ger » Wed Aug 31, 2016 6:13 pm

So when that is the only error, I can assume the extension will validate for The automated part?
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25316
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Simple way to test your ext on TravisCI

Post by Paul » Wed Aug 31, 2016 6:43 pm

yes
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
Ger
Recognised Extension Developer
Posts: 1864
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Simple way to test your ext on TravisCI

Post by Ger » Thu Sep 01, 2016 8:53 am

Thanks.

Now, I've cleaned up the code a bit and have set the code formatting to phpBB standards. It seems like everything checks out, however the job for PHP 5.5 fails.
The command "sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME; fi"" exited with 1.
There is 1 warning in that job:

Code: Select all

FILE: ...ome/travis/build/phpBB3/phpBB/ext/ger/cmbb/cmbb/presentation.php

----------------------------------------------------------------------

FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE

----------------------------------------------------------------------

 1 | WARNING | A file should declare new symbols (classes, functions,

   |         | constants, etc.) and cause no other side effects, or it should

   |         | execute logic with side effects, but should not do both. The

   |         | first symbol is defined on line 24 and the first side effect

   |         | is on line 16. (PSR1.Files.SideEffects.FoundWithSymbols)

----------------------------------------------------------------------
But that's because phpBB requires the IN_PHPBB check in that file since it's only a collection of functions.

Is this even the reason for the build failure or has it nothing to do with it? Besides this one, all other jobs pass so I'd like to have this one passing as well. :)
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25316
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Simple way to test your ext on TravisCI

Post by Paul » Thu Sep 01, 2016 9:10 am

You should make a helper class instead of having a bunch of functions.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
Ger
Recognised Extension Developer
Posts: 1864
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Simple way to test your ext on TravisCI

Post by Ger » Thu Sep 01, 2016 9:25 am

I understand and quite honestly it wouldn't be that difficult (just a bit of needless overhead IMO). But if that's the case, phpBB would have to rebuild every file that's directly in the ./includes folder...
Also the documentation should mention that instead of advising it the way I have done it currently.

But hey, if this is needed to get my green badge from Travis I'll wrap it in a class.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25316
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Simple way to test your ext on TravisCI

Post by Paul » Thu Sep 01, 2016 9:49 am

Well, rewriting includes is in progress, but that is not something done within a year :). The goal is to move away completely from the includes folder, and a bunch of those methods in there is already deprecated.

The overhead of using a helper class is not that much, and the code itself will be a lot cleaner.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
Ger
Recognised Extension Developer
Posts: 1864
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Simple way to test your ext on TravisCI

Post by Ger » Thu Sep 01, 2016 11:53 am

Wrapped it all in a class now, build passing! :D
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

User avatar
VSE
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 4896
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: Simple way to test your ext on TravisCI

Post by VSE » Fri Sep 02, 2016 7:42 am

Ger wrote:Wrapped it all in a class now, build passing! :D
Just so you know. Getting travis-ci up and running alone is not really testing anything other than a few coding guidelines and best practices.

You have to actually start writing unit tests and functional tests that test your code, for the build passing to actually mean anything.
Dictated but not read.
Official phpBB Extensions My Extensions & MODs
Please do not PM me for support.

User avatar
Ger
Recognised Extension Developer
Posts: 1864
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Simple way to test your ext on TravisCI

Post by Ger » Fri Sep 02, 2016 7:50 am

I know, but this is just for starters. The extension is in such an early dev state now it's way to soon to start writing tests.
Just want to make sure that when I do start writing tests, results aren't clouded with basic stuff. It also helps writing clean code.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

User avatar
VSE
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 4896
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: Simple way to test your ext on TravisCI

Post by VSE » Fri Oct 14, 2016 6:22 am

View phpBB's official documentation here: Continuous Integration With Travis CI

Thank you, The Extension Development Team
Dictated but not read.
Official phpBB Extensions My Extensions & MODs
Please do not PM me for support.

andreask
Registered User
Posts: 533
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

Re: Simple way to test your ext on TravisCI

Post by andreask » Fri Oct 14, 2016 12:20 pm

I'm sorry for the "naive" question but what exactly does the phpbb test in travis"
Does it test against php versions?
because I got a "complain" on a fatal error because of his php version was < 5.5

Code: Select all

PHP Fatal error:  Can't use function return value in write context in
because empty() prior to php 5.5 does not accept function returns...

But travis test did not found this...
Last edited by andreask on Fri Oct 14, 2016 3:08 pm, edited 1 time in total.
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17050
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: Simple way to test your ext on TravisCI

Post by DavidIQ » Fri Oct 14, 2016 12:24 pm

If you're following the guide and included all of the PHP versions listed there then Travis will run your tests on those different PHP versions. If you don't want tests run using certain PHP versions and/or some DBMS types then just remove them from your .travis.yml file.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

andreask
Registered User
Posts: 533
Joined: Fri Feb 27, 2009 6:13 pm
Name: Andreas

Re: Simple way to test your ext on TravisCI

Post by andreask » Fri Oct 14, 2016 12:33 pm

Well the tests are there.
php < 5.5 are included but tests were always "green"

Code: Select all

sudo: required

language: php

matrix:
  include:
    - php: 5.3.3
      env: DB=mysqli
    - php: 5.3
      env: DB=mysqli # MyISAM
    - php: 5.4
      env: DB=mysqli
    - php: 5.4
      env: DB=mysql
    - php: 5.4
      env: DB=mariadb
    - php: 5.4
      env: DB=postgres
    - php: 5.4
      env: DB=sqlite3
    - php: 5.5
      env: DB=mysqli
    - php: 5.6
      env: DB=mysqli
    - php: hhvm
      env: DB=mysqli
  allow_failures:
    - php: hhvm
  fast_finish: true

env:
  global:
    - EXTNAME="andreask/ium"  # CHANGE name of the extension HERE
    - SNIFF="1"            # Should we run code sniffer on your code?
    - IMAGE_ICC="1"        # Should we run icc profile sniffer on your images?
    - EPV="1"              # Should we run EPV (Extension Pre Validator) on your code?
    - PHPBB_BRANCH="3.1.x"

branches:
  only:
    - master
    - /^\d+(\.\d+)?\.x$/

install:
  - travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
  - cd ../../phpBB3
  - travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
  - travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION
  - sh -c "if [ '$EPV' != '0' ] && [ '$TRAVIS_PHP_VERSION' = '5.5' ] && [ '$DB' = 'mysqli' ]; then cd phpBB; composer require phpbb/epv:dev-master --dev --no-interaction; cd ../; fi"

before_script:
  - travis/setup-database.sh $DB $TRAVIS_PHP_VERSION

script:
  - sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME; fi"
  - sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION; fi"
  - phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php
- sh -c "if [ '$EPV' != '0' ] && [ '$TRAVIS_PHP_VERSION' = '5.5' ] && [ '$DB' = 'mysqli' ]; then phpBB/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi"
but here https://travis-ci.org/andreaskou/PHPBB_IUM/builds as you can see I didn't got any errors.
Here is what I am working on right now...
Inactive User Manager for phpBB
Give it a try...
If you would like to buy me a bier ;) for my work I will drink it on a hot summer day and thank you!!!

Post Reply

Return to “Extension Writers Discussion”