Page 6 of 8

Re: Simple way to test your ext on TravisCI

Posted: Wed Aug 31, 2016 2:21 pm
by Ger
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...

Re: Simple way to test your ext on TravisCI

Posted: Wed Aug 31, 2016 5:57 pm
by Paul
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.

Re: Simple way to test your ext on TravisCI

Posted: Wed Aug 31, 2016 6:13 pm
by Ger
So when that is the only error, I can assume the extension will validate for The automated part?

Re: Simple way to test your ext on TravisCI

Posted: Wed Aug 31, 2016 6:43 pm
by Paul
yes

Re: Simple way to test your ext on TravisCI

Posted: Thu Sep 01, 2016 8:53 am
by Ger
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. :)

Re: Simple way to test your ext on TravisCI

Posted: Thu Sep 01, 2016 9:10 am
by Paul
You should make a helper class instead of having a bunch of functions.

Re: Simple way to test your ext on TravisCI

Posted: Thu Sep 01, 2016 9:25 am
by Ger
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.

Re: Simple way to test your ext on TravisCI

Posted: Thu Sep 01, 2016 9:49 am
by Paul
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.

Re: Simple way to test your ext on TravisCI

Posted: Thu Sep 01, 2016 11:53 am
by Ger
Wrapped it all in a class now, build passing! :D

Re: Simple way to test your ext on TravisCI

Posted: Fri Sep 02, 2016 7:42 am
by VSE
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.

Re: Simple way to test your ext on TravisCI

Posted: Fri Sep 02, 2016 7:50 am
by Ger
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.

Re: Simple way to test your ext on TravisCI

Posted: Fri Oct 14, 2016 6:22 am
by VSE
View phpBB's official documentation here: Continuous Integration With Travis CI

Thank you, The Extension Development Team

Re: Simple way to test your ext on TravisCI

Posted: Fri Oct 14, 2016 12:20 pm
by andreask
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...

Re: Simple way to test your ext on TravisCI

Posted: Fri Oct 14, 2016 12:24 pm
by DavidIQ
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.

Re: Simple way to test your ext on TravisCI

Posted: Fri Oct 14, 2016 12:33 pm
by andreask
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.