Skip to content
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

Replace Travis CI with GitHub Actions #8

Merged
merged 11 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/github-action@1.1.3'
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