-
-
Notifications
You must be signed in to change notification settings - Fork 281
Tester: added new section about running Tester with Travis CI #173
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
Conversation
******************************** | ||
|
||
/--div .[perex] | ||
Znáte to. Napsali jste testy, které teď procházejí, poplácali se po zádech a váš spánek začal být mnohem klidnější. Máte jistotu, že váš kód spolehlivě funguje. A pak se to stane. Hodiny ukazují 3:15 a do nočního ticha se zakousne nepříjemný zvuk drnčení mobilu na nočním stolku. Volá šéf. Zase to nefunguje. Zalije vás studený pot. Vždyť na to máme testy! V tu chvíli se vynoří vzpomínka na páteční odpoledne - spěcháte domů a zapomínáte spustit testy po poslední úpravě. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pohádka hezká, ale do dokumentace IMHO nepatří (je moc dlouhá).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naopak!
@Majkl578 @JanTvrdik díky! |
Spouštění testů | ||
=============== | ||
|
||
Testy se spouštějí v sekci `script`, kde stačí zavolat tester. Předpokládejeme, že testy jsou umístěny ve složce `tests/` a používáte vlastní `php.ini` umístěné ve složce s testy. Pomocí `-s` si necháme vypsat i přeskočen testy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
přeskočené + „vypsat testy“ nedává česky moc smysl. Lépe asi „ vypsat informace o přeskočených testech“
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Předpokládejme místo Předpokládejeme
Wow, hodně dobře napsáno. Ještě mě napadlo – Nedáme to radši do dokumentace Testeru, než do dokumentace Nette? Tj. místo |
Ještě mi došlo, že tam úplně chybí zmínka o nastavení hooku GitHubu. |
@JanTvrdik |
Ano, to vysvětlení |
@JanTvrdik fair enough |
env: | ||
- TESTER_PHP_BIN="php" | ||
- TESTER_PHP_BIN="hhvm" | ||
\-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Až teď mi došlo (opravte mě, cc @Majkl578, pokud se mýlím), že tohle rozdělení nedává vůbec smysl, protože když Travis testuje HHVM, tak hhvm binárky je simlinknutá i jako php. Aby tam byl nějaké rozdíl, tak by tam muselo být místo php
php-cgi
, které není při běhu HHVM dostupné.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funguje to i pokud použiješ pouze php
, ale jak jsem psal výše, nenapadla mě lepší možnost na čem demonstrovat env
. Nicméně bych mohl zmínit, že to jde i jinak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tak ještě se dá env taky využít na to, že jednou nainstaluješ závislosti normálně a podruhé s --prefer-lowest
. Nicméně pokud tam dáš místo TESTER_PHP_BIN="php"
radši TESTER_PHP_BIN="php-cgi"
, tak by to mělo stačit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proč je php-cgi
lepší možnost než php
?
Mimochodem php-cgi
na Travisu nefunguje ani pro PHP 5.3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Protože tam pak bude rozdíl v tom, jestli používáš
env
nebo ne. - Protože normálně ti webové aplikace taky neběží pod CLI. Není dobré, abys testoval přes jiné SAPI, než přes které aplikaci normálně provozuješ. Nebo tak něco, @dg bude vědět.
- Ano, je potřeba použít PHP 5.3.3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Díky za osvětu :)
Zbytek opraven
@klimesf Paráda. Napíšu ještě pár návrhů. |
Jak funguje Travis CI | ||
===================== | ||
|
||
Travis CI (dále jen Travis) je velmi populární nástroj pro automatizaci [průběžné integrace](http://cs.wikipedia.org/wiki/Průběžná_integrace). Je plně integrován do prostředí GitHubu. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis CI((Continuous Integration)) (dále jen Travis) je velmi populární služba pro... Je poskytována zdarma a nabízí automatizované spouštění testů po zápisu změny do repozitáře. Je plně integrován...
env: TESTER_PHP_BIN="php-cgi" | ||
\-- | ||
|
||
Aby testování bylo označeno Travisem jako úspěšné, musí projít všechny dílčí testy. Pokud nechceme, aby výsledek některé z nich ovlivňovaly, můžeme to deklarovat v bloku `allow_failures`. V našem případě nám nebude vadit, pokud neprojdou testy na HHVM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
..., musí testy projít ve všech prostředích.
@klimesf Ode mě vše. Nějak jsem se rozjel... jestli se Ti něco nepozdává, dej vědět. Šlo mi o to to trochu sjednotit s názvoslovím Travisu. |
@milo Děkuju moc za feedback a korekturu. :) Text mi teď přijde jasnější. Jestli už nikdo nebude mít připomínky, pomalu se pustím do překladu. |
Mám takový pocit, že tohle bude nejvymakanější stránka, co v dokumentaci máme 😄 |
@JanTvrdik Whoops, díky. |
Matice testů | ||
------------ | ||
|
||
Na základě předchozích údajů vytvořena testovací matice, tedy varianty prostředíve kterých budou testy spuštěny (v našem příkladě 10 variant). Nastavení matice je umožněno v bloku `matrix`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Na základě předchozích údajů je vytvořena testovací matice...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prostředíve -> prostředí, ve
Feedback for EN version would be appreciated. |
Interesting. I have discovered that you can do this: env:
- TESTER_PHP_BIN="php-cgi"
- TESTER_PHP_BIN="hhvm"
matrix:
allow_failures:
- php: hhvm
exclude:
- env: TESTER_PHP_BIN="hhvm"
include:
- php: hhvm
env: TESTER_PHP_BIN="hhvm" It excludes all jobs with TESTER_PHP_BIN = 'hhvm' from existing matrix and then includes job with HHVM and TESTER_PHP_BIN = 'hhvm'. Notice that you need to have two rows in env. Should I mention it in the documentation? Do you think it's better than excluding 5 ouf of 10 rows explicitly? EDIT: output can be seen here |
Not needed. See recent @dg's commits where he switched to php binary (which is aliased to HHVM eventually). |
If you don't have any other objections, we are ready to merge. |
Great work! Can you squash it? |
Travis CI((Continuous Integration)) (dále jen Travis) je velmi populární služba pro automatizaci [průběžné integrace](http://cs.wikipedia.org/wiki/Průběžná_integrace). Je poskytována zdarma((Pro soukromé repozitáře je zpoplatněna.)) a nabízí automatizované spouštění testů po zápisu změny do repozitáře. Je plně integrována do prostředí GitHubu. | ||
|
||
Travis se konfiguruje souborem `.travis.yml` umístěným v kořenovém adresáři projektu. Obsahuje několik bloků, které si podrobněji popíšeme. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ještě mě nepadá, že bych tam dodal, že většina z těch bloků je nepovinná, ať to nevypadá tak složitě.
Nebude to jednoznakové odsazování málo? |
@dg kde přesně? |
Sry, to mi dělal plugin do Chrome. |
Btw, co s timhle?
|
Asi bych to, dokud se nepředělá struktura webu, nechal jako součást doc.nette.org. |
Tester: added new section about running Tester with Travis CI
👍 díky moc všem zúčastněným! |
@klimesf Díky! |
Added new section about running tester with Travis CI.
This is just a draft, feedback needed.
After the draft is approved, I will translate the article in English and then squash all the commits.
ref nette/tester#189