Skip to content

Commit 7ceedd5

Browse files
committed
added GitHub Actions as CI provider
1 parent f3652be commit 7ceedd5

File tree

1 file changed

+47
-32
lines changed

1 file changed

+47
-32
lines changed

guides/12-ContinuousIntegration.md

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -77,43 +77,46 @@ Jenkins should locate `report.html` at `tests/_output/`. Now Jenkins will displa
7777
![Jenkins HTML Report](https://codeception.com/images/jenkins/Jenki10.png)
7878
![Jenkins Codeception HTML Results](https://codeception.com/images/jenkins/Jenki11.png)
7979

80-
## TeamCity
80+
## GitHub Actions
8181

82-
![TeamCity](https://codeception.com/images/teamcity/logo.jpg)
83-
84-
TeamCity is a hosted solution from JetBrains. The setup of it can be a bit tricky as TeamCity uses its own reporter format for parsing test results. PHPUnit since version 5.x has integrated support for this format, so does Codeception. What we need to do is to configure Codeception to use custom reporter. By default there is `--report` option which provides an alternative output. You can change the reporter class in `codeception.yml` configuration:
82+
GitHub Actions CI can be used to launch tests. Install PHP and Composer and execute tests:
8583

8684
```yaml
87-
reporters:
88-
report: PHPUnit\Util\Log\TeamCity
85+
on:
86+
pull_request:
87+
branches-ignore: gh-pages
88+
push:
89+
branches-ignore: gh-pages
90+
91+
name: Codeception Tests
92+
93+
jobs:
94+
build:
95+
runs-on: ubuntu-latest
96+
97+
steps:
98+
- name: Checkout
99+
uses: actions/checkout@v2
100+
101+
- name: Install PHP
102+
uses: shivammathur/setup-php@v2
103+
with:
104+
php-version: ${{ matrix.php }}
105+
extensions: curl, mbstring, openssl, pdo, pdo_sqlite
106+
ini-values: memory_limit=-1, date.timezone='UTC'
107+
coverage: xdebug
108+
tools: composer:v2
109+
110+
- name: Validate composer.json and composer.lock
111+
run: composer validate
112+
113+
- name: Install dependencies
114+
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
115+
116+
- name: Run tests
117+
run: php vendor/bin/codecept run
89118
```
90119
91-
As an alternative you can use 3rd-party [TeamCity extension](https://github.com/neronmoon/TeamcityCodeception) for better reporting.
92-
93-
After you create build project you should define build step with Codeception which is
94-
95-
```php
96-
php vendor/bin/codecept run --report
97-
```
98-
99-
![build step](https://codeception.com/images/teamcity/build.png)
100-
101-
Once you execute your first build you should see detailed report inside TeamCity interface:
102-
103-
![report](https://codeception.com/images/teamcity/report2.png)
104-
105-
## TravisCI
106-
107-
![Travis CI](https://codeception.com/images/travis.png)
108-
109-
Travis CI is popular service CI with good GitHub integration. Codeception is self-tested with Travis CI. There nothing special about configuration. Just add to the bottom line of travis configuration:
110-
111-
```
112-
php vendor/bin/codecept run
113-
```
114-
115-
Travis doesn't provide visualization for XML or HTML reports so you can't view reports in format any different than console output. However, Codeception produces nice console output with detailed error reports.
116-
117120
## GitLab CI
118121
119122
![report](https://codeception.com/images/gitlab/logo.png)
@@ -181,3 +184,15 @@ test:
181184
reports:
182185
junit: tests/_output/report.xml
183186
```
187+
188+
## TravisCI
189+
190+
![Travis CI](https://codeception.com/images/travis.png)
191+
192+
Travis CI is popular service CI with good GitHub integration. Codeception is self-tested with Travis CI. There nothing special about configuration. Just add to the bottom line of travis configuration:
193+
194+
```
195+
php vendor/bin/codecept run
196+
```
197+
198+
Travis doesn't provide visualization for XML or HTML reports so you can't view reports in format any different than console output. However, Codeception produces nice console output with detailed error reports.

0 commit comments

Comments
 (0)