Skip to content

Commit f9db663

Browse files
authored
Merge pull request #37 from pug-php/feature/github-actions
Switch to GitHub Actions
2 parents ed1c375 + 10be2b5 commit f9db663

23 files changed

+353
-245
lines changed

.github/workflows/tests.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
17+
setup: ['lowest', 'stable', 'next']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v3
33+
with:
34+
path: vendor
35+
key: ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-
38+
39+
- name: Install dependencies
40+
if: steps.composer-cache.outputs.cache-hit != 'true'
41+
run: |
42+
${{ matrix.php >= 8.1 && 'composer require --no-update phpunit/phpunit:^8.5.14 --no-interaction' || '' }}
43+
composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress --no-suggest ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }}
44+
45+
- name: Code Climate Test Reporter Preparation
46+
if: matrix.php == '7.4' && matrix.setup == 'stable'
47+
run: |
48+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
49+
chmod +x ./cc-test-reporter;
50+
./cc-test-reporter before-build;
51+
env:
52+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
53+
54+
- name: Run test suite
55+
run: |
56+
if [[ ${MATRIX_CONFIG} == "7.4-stable" ]]; then
57+
vendor/bin/phpunit --verbose --coverage-text --coverage-clover=clover.xml;
58+
else
59+
vendor/bin/phpunit --no-coverage;
60+
fi;
61+
env:
62+
MATRIX_CONFIG: ${{ matrix.php }}-${{ matrix.setup }}
63+
64+
- name: Code Climate Test Reporter
65+
if: ${{ matrix.php == '7.4' && matrix.setup == 'stable' && env.CC_TEST_REPORTER_ID != '' }}
66+
run: ./cc-test-reporter after-build --exit-code 0
67+
env:
68+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
69+
70+
- name: Coverage
71+
if: matrix.php == '7.4' && matrix.setup == 'stable'
72+
run: bash <(curl -s https://codecov.io/bash)

.travis.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"ext-mbstring": "*"
1515
},
1616
"require-dev": {
17-
"phpunit/phpunit": "^6.0 || ^7.0",
18-
"codeclimate/php-test-reporter": "dev-master"
17+
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.31 || ^9.5.27"
1918
},
2019
"minimum-stability": "stable",
2120
"autoload": {

src/JsPhpize/Compiler/Helpers/Dot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function ($base) {
7373
{
7474
$value = $this->getValue();
7575

76-
if (method_exists($value, '__toBoolean')) {
76+
if (is_object($value) && method_exists($value, '__toBoolean')) {
7777
return $value->__toBoolean();
7878
}
7979

src/JsPhpize/Compiler/Helpers/Dot.ref.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function (&$base) {
7373
{
7474
$value = $this->getValue();
7575

76-
if (method_exists($value, '__toBoolean')) {
76+
if (is_object($value) && method_exists($value, '__toBoolean')) {
7777
return $value->__toBoolean();
7878
}
7979

src/JsPhpize/Compiler/Helpers/DotObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function ($base) {
7373
{
7474
$value = $this->getValue();
7575

76-
if (method_exists($value, '__toBoolean')) {
76+
if (is_object($value) && method_exists($value, '__toBoolean')) {
7777
return $value->__toBoolean();
7878
}
7979

src/JsPhpize/Compiler/Helpers/DotObject.ref.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function (&$base) {
7373
{
7474
$value = $this->getValue();
7575

76-
if (method_exists($value, '__toBoolean')) {
76+
if (is_object($value) && method_exists($value, '__toBoolean')) {
7777
return $value->__toBoolean();
7878
}
7979

src/JsPhpize/Compiler/Helpers/DotWithArrayPrototype.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function ($base) {
153153
{
154154
$value = $this->getValue();
155155

156-
if (method_exists($value, '__toBoolean')) {
156+
if (is_object($value) && method_exists($value, '__toBoolean')) {
157157
return $value->__toBoolean();
158158
}
159159

src/JsPhpize/Compiler/Helpers/DotWithArrayPrototype.ref.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function (&$base) {
153153
{
154154
$value = $this->getValue();
155155

156-
if (method_exists($value, '__toBoolean')) {
156+
if (is_object($value) && method_exists($value, '__toBoolean')) {
157157
return $value->__toBoolean();
158158
}
159159

src/JsPhpize/Compiler/Helpers/Set.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function ($base, $key, $operator, $value) {
55
$base[$key] = $value;
66
break;
77
}
8-
if (method_exists($base, $method = "set" . ucfirst($key))) {
8+
if (is_object($base) && method_exists($base, $method = "set" . ucfirst($key))) {
99
$base->$method($value);
1010
break;
1111
}

0 commit comments

Comments
 (0)