Skip to content

Commit 1bad16e

Browse files
emmas-yotiecharrodRodion Liuborets
authored
SDK-1863: Migrate travis to github actions (#225)
* SDK-1863: Migrate travis to github actions * SDK-1863: Remove Travis status from README * SDK-1863: Add script to generate sonar coverage * Include "pecl install protobuf-3.13.0" command When running Protobuf C Extension 3.13 unit tests * Correct Github Action build status badge * SDK-1863: Fix type check * SDK-1863:small fix for php8.0 * SDK-1368: Change protobuf version * SDK-1368: Trying to install pecl * SDK-1368: Trying to install pecl * SDK-1368: Trying to install pecl * SDK-1368: Trying to install pecl * SDK-1368: Trying to install pecl Co-authored-by: Ed Harrod <[email protected]> Co-authored-by: Rodion Liuborets <[email protected]>
1 parent af34242 commit 1bad16e

File tree

6 files changed

+155
-4
lines changed

6 files changed

+155
-4
lines changed

.github/workflows/sonar.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Sonar Scan
2+
on: [push, pull_request_target]
3+
4+
jobs:
5+
sonar:
6+
name: Sonar Scan
7+
runs-on: ubuntu-latest
8+
# always run on push events
9+
# only run on pull_request_target event when pull request pulls from fork repository
10+
if: >
11+
github.event_name == 'push' ||
12+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: shivammathur/[email protected]
20+
with:
21+
php-version: 8.0
22+
23+
- run: composer install
24+
- run: composer coverage-clover
25+
26+
- uses: sonarsource/sonarcloud-github-action@master
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
30+

.github/workflows/tests.yaml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Unit Tests
2+
on: [ push, pull_request_target ]
3+
4+
jobs:
5+
php8compat:
6+
name: Unit Tests PHP8 Compatibility (php ${{ matrix.php-version }})
7+
runs-on: ubuntu-latest
8+
# always run on push events
9+
# only run on pull_request_target event when pull request pulls from fork repository
10+
if: >
11+
github.event_name == 'push' ||
12+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php-version: [ 8.0 ]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: shivammathur/[email protected]
22+
with:
23+
php-version: ${{ matrix.php-version }}
24+
25+
# Remove php-cs-fixer until compatible with PHP 8
26+
- run: composer remove --dev --no-update --no-interaction friendsofphp/php-cs-fixer
27+
28+
- run: composer self-update
29+
30+
- run: composer install --no-interaction --prefer-source --dev
31+
32+
- run: composer test
33+
34+
php7:
35+
name: Unit Tests (php ${{ matrix.php-version }})
36+
runs-on: ubuntu-latest
37+
# always run on push events
38+
# only run on pull_request_target event when pull request pulls from fork repository
39+
if: >
40+
github.event_name == 'push' ||
41+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
php-version: [ 7.4, 7.3, 7.2, 7.1 ]
46+
47+
steps:
48+
- uses: actions/checkout@v2
49+
50+
- uses: shivammathur/[email protected]
51+
with:
52+
php-version: ${{ matrix.php-version }}
53+
54+
- run: composer self-update
55+
56+
- run: composer install --no-interaction --prefer-source --dev
57+
58+
- run: composer test
59+
60+
- run: composer lint
61+
62+
guzzle:
63+
name: Unit Tests With Guzzle 6 (php ${{ matrix.php-version }})
64+
runs-on: ubuntu-latest
65+
# always run on push events
66+
# only run on pull_request_target event when pull request pulls from fork repository
67+
if: >
68+
github.event_name == 'push' ||
69+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
php-version: [ 7.4 ]
74+
75+
steps:
76+
- uses: actions/checkout@v2
77+
78+
- uses: shivammathur/[email protected]
79+
with:
80+
php-version: ${{ matrix.php-version }}
81+
82+
- run: composer require guzzlehttp/guzzle "^6.5"
83+
84+
- run: composer self-update
85+
86+
- run: composer install --no-interaction --prefer-source --dev
87+
88+
- run: composer test
89+
90+
- run: composer lint
91+
92+
protobuf:
93+
name: Unit Tests With Protobuf C Extension 3.13 (php ${{ matrix.php-version }})
94+
runs-on: ubuntu-latest
95+
# always run on push events
96+
# only run on pull_request_target event when pull request pulls from fork repository
97+
if: >
98+
github.event_name == 'push' ||
99+
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
php-version: [ 7.4 ]
104+
105+
steps:
106+
- uses: actions/checkout@v2
107+
108+
- uses: shivammathur/[email protected]
109+
with:
110+
php-version: ${{ matrix.php-version }}
111+
extensions: protobuf
112+
113+
- run: composer self-update
114+
115+
- run: composer install --no-interaction --prefer-source --dev
116+
117+
- run: composer test
118+
119+
- run: composer lint
120+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Yoti PHP SDK
22

3-
[![Build Status](https://travis-ci.com/getyoti/yoti-php-sdk.svg?branch=master)](https://travis-ci.com/getyoti/yoti-php-sdk)
3+
[![Build Status](https://github.com/getyoti/yoti-php-sdk/workflows/Unit%20Tests/badge.svg?branch=master)](https://github.com/getyoti/yoti-php-sdk/actions)
44
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aphp&metric=coverage)](https://sonarcloud.io/dashboard?id=getyoti%3Aphp)
55
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aphp&metric=bugs)](https://sonarcloud.io/dashboard?id=getyoti%3Aphp)
66
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=getyoti%3Aphp&metric=code_smells)](https://sonarcloud.io/dashboard?id=getyoti%3Aphp)

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"psr/http-client": "^1.0",
1818
"psr/http-message": "^1.0",
1919
"psr/log": "^1.1",
20-
"guzzlehttp/psr7": "^1.7"
20+
"guzzlehttp/psr7": "^1.7",
21+
"ext-openssl": "*"
2122
},
2223
"autoload": {
2324
"psr-4": {

src/Profile/Util/Attribute/AttributeListConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static function convertToYotiAttributesList(
2828

2929
foreach ($attributeList->getAttributes() as $attr) { /** @var \Yoti\Protobuf\Attrpubapi\Attribute $attr */
3030
$attrName = $attr->getName();
31-
if (null === $attrName || strlen($attrName) === 0) {
31+
if (null == $attrName || strlen($attrName) === 0) {
3232
continue;
3333
}
3434
$yotiAttribute = AttributeConverter::convertToYotiAttribute($attr, $logger);

src/Util/PemFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PemFile
1818
/**
1919
* Private Key.
2020
*
21-
* @var resource
21+
* @var mixed
2222
*/
2323
private $privateKey;
2424

0 commit comments

Comments
 (0)