Simple way to test your ext on TravisCI

Discussion forum for Extension Writers regarding Extension Development.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Simple way to test your ext on TravisCI

Post by 3Di »

pierredu wrote:OK, thanks, I did'nt know this command.
Because you did not read this topic, at least the very first post. ;)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
pierredu
Registered User
Posts: 1256
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)

Re: Simple way to test your ext on TravisCI

Post by pierredu »

Indeed.
You know, when you're getting too much information at one time, on a weak background, that is what happens.
I'm now cleaning the white space problems and the braces not beginning on a newline.
I expected more interesting information. Anyway, the exercise is interesting.
User avatar
pierredu
Registered User
Posts: 1256
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)

Re: Simple way to test your ext on TravisCI

Post by pierredu »

No more errors in the code, but still this:
The command "sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME; fi"" exited with 1.

Any idea?
Thanks in advance.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Simple way to test your ext on TravisCI

Post by 3Di »

You can pass on it IMHO.

BTW, re-read the first post of this topic. You'll find you are missing another file for the Travis thinghy to add to your repository. ;)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
gn#36
Translator
Posts: 210
Joined: Fri Oct 13, 2006 1:16 pm
Contact:

Re: Simple way to test your ext on TravisCI

Post by gn#36 »

I don't know if anybody is interested, but I have written a small script to use the phpbb language validator to also check all the translations of an extension based upon the english version. It can probably be improved still (for example, it currently sets a fixed plural rule that has the maximum number of array elements that I actually need, this may be too small for some translations), but maybe it is still useful to someone:
  1. Add the following to your travis configuration (Full example, including epv and tests):

    Code: Select all

    # Section "install" before cd ../../phpBB, e.g. after  - travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
     - travis/prepare-langtest.sh $EXTNAME $PHPBB_BRANCH
    # Section "script"
    # You can also use any other PHP Version if you wish, I simply chose 5.4 over 5.3 because that will also be present for phpBB 3.2.
    - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.4' ] && [ '$DB' = 'mysqli' ]; then ../langtest/travis/test-lang.sh; fi"
    
  2. Add these two scripts to your travis folder:
  3. Add the translation validator as a dev-dependency to your extensions composer.json:

    Code: Select all

    "require-dev" : {
    		"phpbb/translation-validator" : "1.3.*"
    	},
This should cause your build to fail if any of the translations does not provide the same language keys as english, is missing email files or similar, just as the regular translation validator will on a full language pack. Here you can see a build of my hookup extension failing due to missing files and language keys in the french translation (Job details).

If the language you develop your extension in is not english, you can use a different language as the base for comparison as well, if you wish.

If you have any comments, please let me know.
German Support Team Member • http://www.phpbb.deMy Extensions in the CDBMy Extensions on Github • Contact with caos is inavoidable but no catastrophy if you keep an overview.
User avatar
Sajaki
Registered User
Posts: 1390
Joined: Mon Mar 02, 2009 1:41 pm
Location: Amsterdam
Contact:

Re: Simple way to test your ext on TravisCI

Post by Sajaki »

The language check looks quite useful. i package 4 languages in my ext to be.
But the job failed. do you have any idea why ?
https://travis-ci.org/bbDKP/bbGuild/jobs/105911961

Code: Select all

The command "sh -c "if [ '$EPV' != '0' ] && [ '$TRAVIS_PHP_VERSION' = '5.3.3' ] && [ '$DB' = 'mysqli' ]; then phpBB/ext/$EXTNAME/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi"" exited with 0.

0.00s$ sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.4' ] && [ '$DB' = 'mysqli' ]; then ../langtest/travis/test-lang.sh; fi"

sh: 1: ../langtest/travis/test-lang.sh: Permission denied

The command "sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.4' ] && [ '$DB' = 'mysqli' ]; then ../langtest/travis/test-lang.sh; fi"" exited with 126.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Simple way to test your ext on TravisCI

Post by 3Di »

3Di wrote:You should set executable perms also in the repo (local).

In win file properties, then Run git update-index --chmod=+x travis/test-lang.sh from the git bash then commit/push it to the github repo.
I believe is the case, not tried though.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
gn#36
Translator
Posts: 210
Joined: Fri Oct 13, 2006 1:16 pm
Contact:

Re: Simple way to test your ext on TravisCI

Post by gn#36 »

I would also assume that is the case:
sh: 1: ../langtest/travis/test-lang.sh: Permission denied
German Support Team Member • http://www.phpbb.deMy Extensions in the CDBMy Extensions on Github • Contact with caos is inavoidable but no catastrophy if you keep an overview.
Skouat
Code Contributor
Posts: 1038
Joined: Mon Mar 10, 2008 5:30 pm
Location: France
Contact:

Re: Simple way to test your ext on TravisCI

Post by Skouat »

Hi guys,

Since a couple of days, TravisCI seems to permanently fail with PHP 5.3.3 and EPV.
After some research, I saw that VSE has migrated the EPV test in PHP 5.5.

Perhaps it would be interesting to update this topic and repo demo acme?
Last edited by Skouat on Sun May 01, 2016 8:24 am, edited 1 time in total.
User avatar
MattF
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 5861
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman

Re: Simple way to test your ext on TravisCI

Post by MattF »

Running EPV (Extension Pre Validator) on Travis Tests:

Here are updated instructions to enable EPV testing of your extension on Travis-ci.

Take a look a the phpbb-acme-demo .travis.yml to see how.

Basically you need to:

1. Add to the env/global:

Code: Select all

- EPV="1"              # Should we run EPV (Extension Pre Validator) on your code?
2. Add to the end of the install:

Code: Select all

- 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"
3. Add to the end of the script:

Code: Select all

- sh -c "if [ '$EPV' != '0' ] && [ '$TRAVIS_PHP_VERSION' = '5.5' ] && [ '$DB' = 'mysqli' ]; then phpBB/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi"
Note: If you were using the old way of testing EPV described earlier in this thread, you can not use that technique anymore. You should undo the changes recommended by the old way, including reverting any changes to .travis.yml, composer.json and removing or updating your composer.lock file (EPV should not be a dependency of your extension). All that is needed now are the three lines above added to your .travis.yml file.
Formerly known as VSEMy ExtensionsPlease do not PM me for support.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Simple way to test your ext on TravisCI

Post by 3Di »

At this very point could be an option to just run EPV locally, instead.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Ger
Registered User
Posts: 2108
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 »

I'm having trouble getting started with Travis.

My repository: https://github.com/GerB/cmbb
As you can see, there is a .travis.yml file in the root of my extension folder. Yet Travis says:
WARNING: We were unable to find a .travis.yml file.
And than start testing for Ruby, which totally fails of course.

I suspect this has to do with the fact that I have full path in my repository: phpBB3/ext/ger/cmbb and the Travis stuff resides there. What is the best approach now? I would like to hold that path like that since I have a local setup with phpBB and the extension in it's correct place. I've ignored everything but my extension folder for Git so that should not be a problem. However, it is a problem for Travis, it seems.
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:

-Don't PM me for support-
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28654
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 »

You need it in the root of your repo, if you include the complete directory structure in your repo (Which most extension authors don't)
User avatar
Ger
Registered User
Posts: 2108
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 »

Well, I've updated the folder structure, omitting the complete phpBB path. Still no dice. It seems like Travis still can't find my travis.yml file. It now says:
Branch "1.0.0-dev" not included per configuration.
There was a setting "Build only if .travis.yml is present" which I've had on for a few minutes, but I quickly turned it off again.
When I go to http://lint.travis-ci.org/GerB/cmbb it still says
failed to fetch .travis.yml
Yet it is there. I'm unsure how to proceed.

Quite annoying I must say. Now I realise I'm probably doing something wrong, but than again it's not really straightforward either.
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:

-Don't PM me for support-
User avatar
Sajaki
Registered User
Posts: 1390
Joined: Mon Mar 02, 2009 1:41 pm
Location: Amsterdam
Contact:

Re: Simple way to test your ext on TravisCI

Post by Sajaki »

you need to setup your github webhook for travis for that repository too.

github repo -> preferences -> webhooks & services -> add service -> choose travis CI.
Post Reply

Return to “Extension Writers Discussion”