Skip to content

Commit

Permalink
Replace Travis CI with GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
VasekPurchart committed Mar 18, 2022
2 parents 93a1b9a + 3ac565f commit e595c37
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.gitattributes export-ignore
.gitignore export-ignore
/.travis.yml export-ignore
/.github export-ignore
/build export-ignore
/build.xml export-ignore
/tests export-ignore
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

updates:
-
package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
open-pull-requests-limit: 3
161 changes: 161 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: 'CI'

on:
pull_request:
push:
branches:
- 'master'

env:
CONSISTENCE_PHP_VERSION: '7.3'

jobs:
composer-validate:
name: 'Composer validate'
runs-on: 'ubuntu-latest'

steps:
-
name: 'Checkout'
uses: 'actions/checkout@v3'
-
name: 'Setup PHP ${{ env.CONSISTENCE_PHP_VERSION }}'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ env.CONSISTENCE_PHP_VERSION }}'
coverage: 'none'
-
name: 'Setup problem matchers for PHP'
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
-
name: 'Composer install'
uses: 'ramsey/composer-install@v1'
with:
dependency-versions: 'highest'
-
name: 'Composer validate'
run: 'bin/phing composer-validate'

lint:
name: 'Lint - PHP ${{ matrix.php-version }}'
needs: 'composer-validate'
runs-on: 'ubuntu-latest'

strategy:
fail-fast: false
matrix:
php-version:
- '7.2'
- '7.3'

steps:
-
name: 'Checkout'
uses: 'actions/checkout@v3'
-
name: 'Setup PHP ${{ matrix.php-version }}'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'
-
name: 'Setup problem matchers for PHP'
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
-
name: 'Composer install'
uses: 'ramsey/composer-install@v1'
with:
dependency-versions: 'highest'
-
name: 'Lint'
run: 'bin/phing phplint'

coding-standard:
name: 'Coding standard'
needs: 'lint'
runs-on: 'ubuntu-latest'

steps:
-
name: 'Checkout'
uses: 'actions/checkout@v3'
-
name: 'Setup PHP ${{ env.CONSISTENCE_PHP_VERSION }}'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ env.CONSISTENCE_PHP_VERSION }}'
coverage: 'none'
tools: 'cs2pr'
-
name: 'Setup problem matchers for PHP'
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
-
name: 'Composer install'
uses: 'ramsey/composer-install@v1'
with:
dependency-versions: 'highest'
-
name: 'Check coding standard'
run: 'bin/phing create-dirs cs || cat build/log/phpcs-checkstyle.xml | cs2pr'

tests:
name: 'Tests - PHP ${{ matrix.php-version }}, ${{ matrix.composer-dependencies }} dependencies'
needs: 'lint'
runs-on: 'ubuntu-latest'

strategy:
fail-fast: false
matrix:
php-version:
- '7.2'
- '7.3'
composer-dependencies:
- 'highest'
- 'lowest'

steps:
-
name: 'Checkout'
uses: 'actions/checkout@v3'
-
name: 'Setup PHP ${{ matrix.php-version }}'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'xdebug'
-
name: 'Setup problem matchers for PHP'
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
-
name: 'Setup problem matchers for PHPUnit'
run: 'echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"'
-
name: 'Composer install'
uses: 'ramsey/composer-install@v1'
with:
dependency-versions: '${{ matrix.composer-dependencies }}'
-
name: 'Run tests'
run: 'bin/phing tests'
-
name: 'Upload code coverage to Coveralls'
env:
COVERALLS_REPO_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: 'php-${{ matrix.php-version }}+${{ matrix.composer-dependencies }}-dependencies'
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
php php-coveralls.phar --verbose --config build/coveralls.yml
finish_coveralls:
name: 'Finish Coveralls upload'
needs: 'tests'
runs-on: 'ubuntu-latest'

steps:
-
name: 'Finish Coveralls upload'
uses: 'coverallsapp/[email protected]'
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
parallel-finished: true
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

36 changes: 13 additions & 23 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

<property file="${path.build.properties.local}"/>

<property name="file.mode.writable" value="0775"/>

<property name="path.bin" value="${path.root}/bin"/>
<property name="path.build.log" value="${path.build}/log"/>
<property name="path.composer.executable" value="composer"/>
<property name="path.phpcs.executable" value="${path.bin}/phpcs"/>
<property name="path.phpcs.ruleset" value="${path.build}/cs-ruleset.xml"/>
Expand All @@ -16,38 +19,17 @@
<property name="path.root" value="${project.basedir}"/>
<property name="path.src" value="${path.root}/src"/>
<property name="path.tests" value="${path.root}/tests"/>
<property name="path.tests.coverage.clover" value="${path.build}/log/coverage/clover.xml"/>
<property name="path.tests.coverage.clover" value="${path.build.log}/coverage/clover.xml"/>
<property name="path.vendor" value="${path.root}/vendor"/>

<target name="build" depends="
create-dirs,
composer,
phplint,
cs,
tests
"/>

<target name="ci-build" depends="
composer-validate,
phplint,
cs,
ci-tests
"/>

<target name="ci-tests">
<exec
executable="${path.phpunit.executable}"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="--configuration"/>
<arg value="${path.phpunit.configuration}"/>
<arg value="--coverage-clover"/>
<arg value="${path.tests.coverage.clover}"/>
<arg path="${path.tests}"/>
</exec>
</target>

<target name="composer" depends="composer-validate">
<exec
executable="${path.composer.executable}"
Expand All @@ -71,6 +53,10 @@
</exec>
</target>

<target name="create-dirs">
<mkdir dir="${path.build.log}" mode="${file.mode.writable}"/>
</target>

<target name="cs">
<exec
executable="${path.phpcs.executable}"
Expand All @@ -81,6 +67,8 @@
<arg value="--standard=${path.phpcs.ruleset}"/>
<arg value="--extensions=php"/>
<arg value="--encoding=utf-8"/>
<arg value="--report=full"/>
<arg value="--report-checkstyle=${path.build.log}/phpcs-checkstyle.xml"/>
<arg value="-sp"/>
<arg path="${path.src}"/>
<arg path="${path.tests}"/>
Expand Down Expand Up @@ -108,6 +96,8 @@
>
<arg value="--configuration"/>
<arg value="${path.phpunit.configuration}"/>
<arg value="--coverage-clover"/>
<arg value="${path.tests.coverage.clover}"/>
<arg path="${path.tests}"/>
</exec>
</target>
Expand Down
2 changes: 1 addition & 1 deletion build/coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
coverage_clover: build/log/coverage/clover.xml
json_path: build/log/coverage/coveralls-upload.json
service_name: travis-ci
service_name: github
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"php": "~7.2",
"consistence/consistence": "~1.0|~2.0",
"doctrine/annotations": "~1.2",
"doctrine/cache": "^1.11",
"doctrine/orm": "^2.6.3"
},
"require-dev": {
"consistence/coding-standard": "3.7",
"doctrine/persistence": "^1.3|^2.0",
"jakub-onderka/php-console-highlighter": "0.4",
"jakub-onderka/php-parallel-lint": "1.0",
"phing/phing": "2.16.1",
Expand Down
4 changes: 2 additions & 2 deletions tests/Enum/EnumPostLoadEntityListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Persistence\Mapping\ClassMetadata as CommonClassMetadata;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Persistence\Mapping\ClassMetadata as PersistenceClassMetadata;

class EnumPostLoadEntityListenerTest extends \PHPUnit\Framework\TestCase
{
Expand All @@ -20,7 +20,7 @@ public function testLoadWrongClassMetadata(): void

$postLoadListener = new EnumPostLoadEntityListener($reader);

$classMetadata = $this->createMock(CommonClassMetadata::class);
$classMetadata = $this->createMock(PersistenceClassMetadata::class);

$entityManager = $this->createMock(EntityManager::class);
$entityManager
Expand Down

0 comments on commit e595c37

Please sign in to comment.