Skip to content

Commit

Permalink
[TASK] Test Coveralls (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
susannemoog authored Sep 1, 2020
1 parent 0bd05d3 commit 2384465
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
45 changes: 40 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
build:
Expand All @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
typo3: [^9.5, ^10.4]
php: ['7.2', '7.3', '7.4']
php: [ '7.2', '7.3', '7.4' ]

steps:
- name: Start database server
Expand Down Expand Up @@ -38,13 +38,48 @@ jobs:
- name: Lint PHP
run: composer t3g:test:php:lint

- name: Unit Tests
- name: Unit Tests without coverage
if: matrix.typo3 == '^9.5'
run: composer t3g:test:php:unit

- name: Functional Tests
run: composer t3g:test:php:functional;
- name: Unit Tests with coverage
if: matrix.typo3 == '^10.4'
run: composer t3g:test:php:unit:cover

- name: Functional Tests without coverage
run: composer t3g:test:php:functional
if: matrix.typo3 == '^9.5'
env:
typo3DatabaseHost: 127.0.0.1
typo3DatabaseName: t3func
typo3DatabasePassword: root
typo3DatabaseUsername: root

- name: Functional Tests with coverage
run: composer t3g:test:php:functional:cover
if: matrix.typo3 == '^10.4'
env:
typo3DatabaseHost: 127.0.0.1
typo3DatabaseName: t3func
typo3DatabasePassword: root
typo3DatabaseUsername: root

- name: Upload coverage results to Coveralls
if: matrix.typo3 == '^10.4'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php }}
run: |
composer global require twinh/php-coveralls --no-progress --no-suggest --no-interaction
/home/runner/.composer/vendor/bin/php-coveralls --coverage_clover=var/log/junit/coverage-unit.xml --coverage_clover=var/log/junit/coverage-functional.xml -vvv --json_path=var/log/coveralls-upload.json
coveralls-finish:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
4 changes: 2 additions & 2 deletions Tests/Functional/AvatarProvider/GravatarProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public function testGetAvatarUrlReturnsTypo3TempUrl(): void
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['blog']['enableGravatarProxy'] = '1';

$gravatarProvider = new GravatarProvider();
self::assertSame(
'typo3temp/assets/t3g/blog/gravatar/9de8c28c6028de09355431e6435015a5.jpeg',
self::assertStringStartsWith(
'typo3temp/assets/t3g/blog/gravatar/',
$gravatarProvider->getAvatarUrl((new Author())->setEmail('[email protected]'))
);
}
Expand Down
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
"t3g:test:php:functional": [
"phpunit -c Build/FunctionalTests.xml"
],
"t3g:test:php:unit:cover": [
"Composer\\Config::disableProcessTimeout",
"mkdir -p var/log/junit/ && phpunit -c Build/UnitTests.xml --log-junit var/log/junit/phpunit.xml --coverage-clover var/log/junit/coverage-unit.xml"
],
"t3g:test:php:functional:cover": [
"Composer\\Config::disableProcessTimeout",
"mkdir -p var/log/junit/ && .build/bin/phpunit -c Build/FunctionalTests.xml --log-junit var/log/junit/phpunit.xml --coverage-clover var/log/junit/coverage-functional.xml"
],
"t3g:test": [
"@t3g:test:php:lint",
"@t3g:test:php:unit"
Expand Down

0 comments on commit 2384465

Please sign in to comment.