Skip to content

Commit f1dab93

Browse files
authored
Merge pull request #36 from j0k3r/github-actions
Ditch Travis and use GitHub Actions
2 parents ff07bfa + 7066d80 commit f1dab93

10 files changed

+148
-62
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/.gitattributes export-ignore
33
/.gitignore export-ignore
44
/.scrutinizer.yml export-ignore
5-
/.travis.yml export-ignore
65
/.php_cs export-ignore
76
/phpunit.xml.dist export-ignore
87
/tests export-ignore
8+
/.github export-ignore
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "CS"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
coding-standards:
13+
name: "CS Fixer (PHP ${{ matrix.php }})"
14+
runs-on: "ubuntu-20.04"
15+
16+
strategy:
17+
matrix:
18+
php:
19+
- "7.3"
20+
21+
steps:
22+
- name: "Checkout"
23+
uses: "actions/checkout@v2"
24+
25+
- name: "Install PHP"
26+
uses: "shivammathur/setup-php@v2"
27+
with:
28+
coverage: "none"
29+
php-version: "${{ matrix.php }}"
30+
tools: cs2pr, composer:v1
31+
ini-values: "date.timezone=Europe/Paris"
32+
env:
33+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: "Install dependencies with Composer"
36+
uses: "ramsey/composer-install@v1"
37+
38+
- name: "Run PHP CS Fixer"
39+
run: "vendor/bin/php-cs-fixer fix --verbose --dry-run --format=checkstyle | cs2pr"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: "CI"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "master"
7+
push:
8+
branches:
9+
- "master"
10+
11+
env:
12+
fail-fast: true
13+
14+
jobs:
15+
phpunit:
16+
name: "PHPUnit (PHP ${{ matrix.php }})"
17+
runs-on: "ubuntu-20.04"
18+
19+
strategy:
20+
matrix:
21+
php:
22+
- "5.6"
23+
- "7.0"
24+
- "7.1"
25+
- "7.2"
26+
- "7.3"
27+
- "7.4"
28+
29+
steps:
30+
- name: "Checkout"
31+
uses: "actions/checkout@v2"
32+
with:
33+
fetch-depth: 2
34+
35+
- name: "Install PHP with PCOV"
36+
uses: "shivammathur/setup-php@v2"
37+
with:
38+
php-version: "${{ matrix.php }}"
39+
coverage: "none"
40+
tools: composer:v1
41+
extensions: curl
42+
ini-values: "date.timezone=Europe/Paris"
43+
env:
44+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: "Install dependencies with Composer"
47+
uses: "ramsey/composer-install@v1"
48+
49+
- name: "Run PHPUnit"
50+
run: "php vendor/bin/simple-phpunit -v"
51+
52+
phpunit-coverage:
53+
name: "PHPUnit with coverage (PHP ${{ matrix.php }})"
54+
runs-on: "ubuntu-20.04"
55+
56+
strategy:
57+
matrix:
58+
php:
59+
- "7.4"
60+
61+
steps:
62+
- name: "Checkout"
63+
uses: "actions/checkout@v2"
64+
with:
65+
fetch-depth: 2
66+
67+
- name: "Install PHP with PCOV"
68+
uses: "shivammathur/setup-php@v2"
69+
with:
70+
php-version: "${{ matrix.php }}"
71+
coverage: "pcov"
72+
tools: composer:v1
73+
extensions: curl
74+
ini-values: "date.timezone=Europe/Paris"
75+
env:
76+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- name: "Install dependencies with Composer"
79+
uses: "ramsey/composer-install@v1"
80+
81+
- name: "Run PHPUnit (with coverage)"
82+
run: "php vendor/bin/simple-phpunit -v --coverage-clover=coverage.clover"
83+
84+
- name: "Retrieve ocular.phar"
85+
run: "wget https://scrutinizer-ci.com/ocular.phar"
86+
87+
- name: "Enable ocular.phar"
88+
run: "chmod +x ocular.phar"
89+
90+
- name: "Upload coverage"
91+
run: "php ocular.phar code-coverage:upload --format=php-clover coverage.clover"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ vendor
44
coverage
55
build
66
.php_cs.cache
7+
.phpunit.result.cache

.scrutinizer.yml

+7
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@ tools:
88
filter:
99
excluded_paths:
1010
- tests/*
11+
12+
build:
13+
nodes:
14+
analysis:
15+
tests:
16+
override:
17+
- php-scrutinizer-run

.travis.yml

-42
This file was deleted.

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# PHP Imgur API Client
22

3-
[![Build Status](https://travis-ci.org/j0k3r/php-imgur-api-client.svg?branch=3.x)](https://travis-ci.org/j0k3r/php-imgur-api-client)
4-
[![Code Coverage](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/badges/coverage.png?branch=3.x)](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/?branch=3.x)
5-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/badges/quality-score.png?branch=3.x)](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/?branch=3.x)
3+
![CI](https://github.com/j0k3r/php-imgur-api-client/workflows/CI/badge.svg)
4+
[![Code Coverage](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/badges/coverage.png?branch=master)](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/?branch=master)
5+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/badges/quality-score.png?branch=master)](https://scrutinizer-ci.com/g/j0k3r/php-imgur-api-client/?branch=master)
66
[![Total Downloads](https://poser.pugx.org/j0k3r/php-imgur-api-client/downloads)](https://packagist.org/packages/j0k3r/php-imgur-api-client)
77
[![License](https://poser.pugx.org/j0k3r/php-imgur-api-client/license)](https://packagist.org/packages/j0k3r/php-imgur-api-client)
88

@@ -13,8 +13,8 @@ Uses [Imgur API v3](https://api.imgur.com/).
1313
## Information
1414

1515
* Branch [1.x](https://github.com/j0k3r/php-imgur-api-client/tree/1.x) use Guzzle 3 (but is not maintained)
16-
* Branch [2.x](https://github.com/j0k3r/php-imgur-api-client/tree/2.x) use Guzzle 5
17-
* Branch [3.x](https://github.com/j0k3r/php-imgur-api-client/tree/3.x) use Guzzle 6
16+
* Branch [2.x](https://github.com/j0k3r/php-imgur-api-client/tree/2.x) use Guzzle 5 (but is not maintained)
17+
* Branch [master](https://github.com/j0k3r/php-imgur-api-client/tree/master) use Guzzle 6
1818

1919
All actives branches required PHP >= 5.6
2020

composer.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040
},
4141
"require-dev": {
4242
"friendsofphp/php-cs-fixer": "^2.0",
43-
"symfony/phpunit-bridge": "^4.0"
44-
},
45-
"extra": {
46-
"branch-alias": {
47-
"dev-master": "3.0.x-dev"
48-
}
43+
"symfony/phpunit-bridge": "^5.0"
4944
}
5045
}

lib/Imgur/Auth/OAuth2.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function getAuthenticationURL($responseType = 'code', $state = null)
9999
* @param string $code
100100
* @param string $requestType
101101
*
102-
* @return string
102+
* @return array
103103
*/
104104
public function requestAccessToken($code, $requestType)
105105
{
@@ -157,7 +157,7 @@ public function refreshToken()
157157
$response = $this->httpClient->post(
158158
self::ACCESS_TOKEN_ENDPOINT,
159159
[
160-
'refresh_token' => $token['refresh_token'],
160+
'refresh_token' => \is_array($token) ? $token['refresh_token'] : null,
161161
'client_id' => $this->clientId,
162162
'client_secret' => $this->clientSecret,
163163
'grant_type' => 'refresh_token',
@@ -207,7 +207,7 @@ public function setAccessToken($token)
207207
/**
208208
* Getter for the current access token.
209209
*
210-
* @return array
210+
* @return array|null
211211
*/
212212
public function getAccessToken()
213213
{

phpunit.xml.dist

-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
convertWarningsToExceptions="true"
88
processIsolation="false"
99
stopOnFailure="false"
10-
syntaxCheck="false"
1110
bootstrap="vendor/autoload.php"
1211
>
1312

@@ -25,8 +24,4 @@
2524
</exclude>
2625
</whitelist>
2726
</filter>
28-
29-
<logging>
30-
<log type="coverage-html" target="coverage" title="php-imgur-api-client" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
31-
</logging>
3227
</phpunit>

0 commit comments

Comments
 (0)