Skip to content

Commit 2983446

Browse files
committed
Replace Travis CI with GitHub Actions
2 parents 4b4b199 + 8100858 commit 2983446

File tree

6 files changed

+185
-58
lines changed

6 files changed

+185
-58
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.gitattributes export-ignore
22
.gitignore export-ignore
3-
/.travis.yml export-ignore
3+
/.github export-ignore
44
/build export-ignore
55
/build.xml export-ignore
66
/tests export-ignore

.github/dependabot.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
3+
updates:
4+
-
5+
package-ecosystem: 'github-actions'
6+
directory: '/'
7+
schedule:
8+
interval: 'weekly'
9+
open-pull-requests-limit: 3

.github/workflows/ci.yml

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: 'CI'
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'master'
8+
9+
env:
10+
CONSISTENCE_PHP_VERSION: '7.3'
11+
12+
jobs:
13+
composer-validate:
14+
name: 'Composer validate'
15+
runs-on: 'ubuntu-latest'
16+
17+
steps:
18+
-
19+
name: 'Checkout'
20+
uses: 'actions/checkout@v3'
21+
-
22+
name: 'Setup PHP ${{ env.CONSISTENCE_PHP_VERSION }}'
23+
uses: 'shivammathur/setup-php@v2'
24+
with:
25+
php-version: '${{ env.CONSISTENCE_PHP_VERSION }}'
26+
coverage: 'none'
27+
-
28+
name: 'Setup problem matchers for PHP'
29+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
30+
-
31+
name: 'Composer install'
32+
uses: 'ramsey/composer-install@v1'
33+
with:
34+
dependency-versions: 'highest'
35+
-
36+
name: 'Composer validate'
37+
run: 'bin/phing composer-validate'
38+
39+
lint:
40+
name: 'Lint - PHP ${{ matrix.php-version }}'
41+
needs: 'composer-validate'
42+
runs-on: 'ubuntu-latest'
43+
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
php-version:
48+
- '7.2'
49+
- '7.3'
50+
51+
steps:
52+
-
53+
name: 'Checkout'
54+
uses: 'actions/checkout@v3'
55+
-
56+
name: 'Setup PHP ${{ matrix.php-version }}'
57+
uses: 'shivammathur/setup-php@v2'
58+
with:
59+
php-version: '${{ matrix.php-version }}'
60+
coverage: 'none'
61+
-
62+
name: 'Setup problem matchers for PHP'
63+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
64+
-
65+
name: 'Composer install'
66+
uses: 'ramsey/composer-install@v1'
67+
with:
68+
dependency-versions: 'highest'
69+
-
70+
name: 'Lint'
71+
run: 'bin/phing phplint'
72+
73+
coding-standard:
74+
name: 'Coding standard'
75+
needs: 'lint'
76+
runs-on: 'ubuntu-latest'
77+
78+
steps:
79+
-
80+
name: 'Checkout'
81+
uses: 'actions/checkout@v3'
82+
-
83+
name: 'Setup PHP ${{ env.CONSISTENCE_PHP_VERSION }}'
84+
uses: 'shivammathur/setup-php@v2'
85+
with:
86+
php-version: '${{ env.CONSISTENCE_PHP_VERSION }}'
87+
coverage: 'none'
88+
tools: 'cs2pr'
89+
-
90+
name: 'Setup problem matchers for PHP'
91+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
92+
-
93+
name: 'Composer install'
94+
uses: 'ramsey/composer-install@v1'
95+
with:
96+
dependency-versions: 'highest'
97+
-
98+
name: 'Check coding standard'
99+
run: 'bin/phing create-dirs cs || cat build/log/phpcs-checkstyle.xml | cs2pr'
100+
101+
tests:
102+
name: 'Tests - PHP ${{ matrix.php-version }}, ${{ matrix.composer-dependencies }} dependencies'
103+
needs: 'lint'
104+
runs-on: 'ubuntu-latest'
105+
106+
strategy:
107+
fail-fast: false
108+
matrix:
109+
php-version:
110+
- '7.2'
111+
- '7.3'
112+
composer-dependencies:
113+
- 'highest'
114+
- 'lowest'
115+
116+
steps:
117+
-
118+
name: 'Checkout'
119+
uses: 'actions/checkout@v3'
120+
-
121+
name: 'Setup PHP ${{ matrix.php-version }}'
122+
uses: 'shivammathur/setup-php@v2'
123+
with:
124+
php-version: '${{ matrix.php-version }}'
125+
coverage: 'xdebug'
126+
-
127+
name: 'Setup problem matchers for PHP'
128+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
129+
-
130+
name: 'Setup problem matchers for PHPUnit'
131+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"'
132+
-
133+
name: 'Composer install'
134+
uses: 'ramsey/composer-install@v1'
135+
with:
136+
dependency-versions: '${{ matrix.composer-dependencies }}'
137+
-
138+
name: 'Run tests'
139+
run: 'bin/phing tests'
140+
-
141+
name: 'Upload code coverage to Coveralls'
142+
env:
143+
COVERALLS_REPO_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
144+
COVERALLS_PARALLEL: true
145+
COVERALLS_FLAG_NAME: 'php-${{ matrix.php-version }}+${{ matrix.composer-dependencies }}-dependencies'
146+
run: |
147+
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
148+
php php-coveralls.phar --verbose --config build/coveralls.yml
149+
150+
finish_coveralls:
151+
name: 'Finish Coveralls upload'
152+
needs: 'tests'
153+
runs-on: 'ubuntu-latest'
154+
155+
steps:
156+
-
157+
name: 'Finish Coveralls upload'
158+
uses: 'coverallsapp/[email protected]'
159+
with:
160+
github-token: '${{ secrets.GITHUB_TOKEN }}'
161+
parallel-finished: true

.travis.yml

-33
This file was deleted.

build.xml

+13-23
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

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

9+
<property name="file.mode.writable" value="0775"/>
10+
911
<property name="path.bin" value="${path.root}/bin"/>
12+
<property name="path.build.log" value="${path.build}/log"/>
1013
<property name="path.composer.executable" value="composer"/>
1114
<property name="path.phpcs.executable" value="${path.bin}/phpcs"/>
1215
<property name="path.phpcs.ruleset" value="${path.build}/cs-ruleset.xml"/>
@@ -17,38 +20,17 @@
1720
<property name="path.src" value="${path.standard}"/>
1821
<property name="path.standard" value="${path.root}/Consistence"/>
1922
<property name="path.tests" value="${path.root}/tests"/>
20-
<property name="path.tests.coverage.clover" value="${path.build}/log/coverage/clover.xml"/>
23+
<property name="path.tests.coverage.clover" value="${path.build.log}/coverage/clover.xml"/>
2124
<property name="path.vendor" value="${path.root}/vendor"/>
2225

2326
<target name="build" depends="
27+
create-dirs,
2428
composer,
2529
phplint,
2630
cs,
2731
tests
2832
"/>
2933

30-
<target name="ci-build" depends="
31-
composer-validate,
32-
phplint,
33-
cs,
34-
ci-tests
35-
"/>
36-
37-
<target name="ci-tests">
38-
<exec
39-
executable="${path.phpunit.executable}"
40-
logoutput="true"
41-
passthru="true"
42-
checkreturn="true"
43-
>
44-
<arg value="--configuration"/>
45-
<arg value="${path.phpunit.configuration}"/>
46-
<arg value="--coverage-clover"/>
47-
<arg value="${path.tests.coverage.clover}"/>
48-
<arg path="${path.tests}"/>
49-
</exec>
50-
</target>
51-
5234
<target name="composer" depends="composer-validate">
5335
<exec
5436
executable="${path.composer.executable}"
@@ -72,6 +54,10 @@
7254
</exec>
7355
</target>
7456

57+
<target name="create-dirs">
58+
<mkdir dir="${path.build.log}" mode="${file.mode.writable}"/>
59+
</target>
60+
7561
<target name="cs">
7662
<exec
7763
executable="${path.phpcs.executable}"
@@ -83,6 +69,8 @@
8369
<arg value="--extensions=php"/>
8470
<arg value="--encoding=utf-8"/>
8571
<arg value="--ignore=*/data/*"/>
72+
<arg value="--report=full"/>
73+
<arg value="--report-checkstyle=${path.build.log}/phpcs-checkstyle.xml"/>
8674
<arg value="-sp"/>
8775
<arg path="${path.src}"/>
8876
<arg path="${path.tests}"/>
@@ -110,6 +98,8 @@
11098
>
11199
<arg value="--configuration"/>
112100
<arg value="${path.phpunit.configuration}"/>
101+
<arg value="--coverage-clover"/>
102+
<arg value="${path.tests.coverage.clover}"/>
113103
<arg path="${path.tests}"/>
114104
</exec>
115105
</target>

build/coveralls.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
coverage_clover: build/log/coverage/clover.xml
22
json_path: build/log/coverage/coveralls-upload.json
3-
service_name: travis-ci
3+
service_name: github

0 commit comments

Comments
 (0)