Skip to content

Commit

Permalink
Merge pull request #71 from jspaetzel/github_action_tests
Browse files Browse the repository at this point in the history
switch to github actions and fix issues with coverage reporting
  • Loading branch information
rvanlaak committed May 17, 2022
2 parents e2f8411 + cbebe66 commit 632a777
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 33 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/php.yml
@@ -0,0 +1,80 @@
name: Latest Build

on:
push:
branches: [ master ]
pull_request:

env:
CC_TEST_REPORTER_ID: efd18a36922628f0536f2f08cf7ceca763f5f2feb6f3638037381487ca3312ae
APP_ENV: development

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1' ]
dependency-stability: [ prefer-stable ]
name: PHP ${{ matrix.php-versions }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
steps:
- uses: actions/checkout@v2

- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- run: composer self-update

- name: Install Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install --no-interaction --prefer-dist

- name: Run PHPUnit
run: vendor/bin/phpunit --no-coverage

coverage:
needs: [ test ]
name: Code Coverage Reporting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- run: composer self-update

- name: Install Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install --no-interaction --prefer-dist

- run: curl -L https://scrutinizer-ci.com/ocular.phar > ./ocular.phar
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
- run: composer global require php-coveralls/php-coveralls

- name: Start CodeClimate report
run: ./cc-test-reporter before-build

- name: Run Tests with Coverage
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml

- name: Format coverage for CodeClimate
run: ./cc-test-reporter format-coverage -t clover -o build/logs/codeclimate.json build/logs/clover.xml

- name: Upload coverage results to CodeClimate
run: ./cc-test-reporter upload-coverage -i build/logs/codeclimate.json

- name: End CodeClimate report
run: ./cc-test-reporter after-build --exit-code 0

- name: Upload coverage results to Scrutinizer
run: php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: php-coveralls --coverage_clover=build/logs/clover.xml -v
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -3,4 +3,4 @@
/composer.lock
/vendor
.env
.phpunit.result.cache
.phpunit.result.cache
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions phpunit.xml.dist
Expand Up @@ -11,10 +11,6 @@
<const name="WEB_SERVER_DOCROOT" value="./src/Micrometa/Tests/Fixture" />
</php>

<logging>
<log type="coverage-xml" target="build/coverage"/>
</logging>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
Expand Down

0 comments on commit 632a777

Please sign in to comment.