Skip to content

Commit b385604

Browse files
authored
ci: update workflows (#102)
1 parent 991ba6b commit b385604

File tree

8 files changed

+123
-58
lines changed

8 files changed

+123
-58
lines changed

.github/workflows/ci.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "develop"
8+
pull_request:
9+
types: [ready_for_review, synchronize, opened]
10+
11+
jobs:
12+
conflicts:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
with:
19+
ref: ${{ github.head_ref }}
20+
21+
- name: Merge Conflict finder
22+
uses: olivernybroe/[email protected]
23+
24+
# analyse:
25+
# runs-on: ubuntu-latest
26+
27+
# steps:
28+
# - name: Checkout code
29+
# uses: actions/checkout@v2
30+
31+
# - name: Setup PHP
32+
# uses: shivammathur/setup-php@v2
33+
# with:
34+
# php-version: "7.4"
35+
# extensions: mbstring, dom, fileinfo, intl, gd, imagick, bcmath, soap, zip, sqlite, pcov
36+
# coverage: pcov
37+
38+
# - name: Cache dependencies
39+
# uses: actions/cache@v1
40+
# with:
41+
# path: ~/.composer/cache/files
42+
# key: dependencies-composer-${{ hashFiles('composer.json') }}
43+
44+
# - name: Install Composer dependencies
45+
# run: composer install --no-ansi --no-interaction --no-suggest --no-progress --prefer-dist --optimize-autoloader
46+
47+
# - name: Prepare the database
48+
# run: touch database/database.sqlite
49+
50+
# - name: Prepare the application
51+
# run: cp .env.example .env && php artisan key:generate
52+
53+
# - name: Run PHPStan
54+
# run: ./vendor/bin/phpstan analyse --memory-limit=2G
55+
56+
format:
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- uses: actions/checkout@v2
61+
with:
62+
ref: ${{ github.head_ref }}
63+
token: ${{ secrets.GH_TOKEN }}
64+
65+
- name: Setup PHP
66+
uses: shivammathur/setup-php@v2
67+
with:
68+
php-version: "7.4"
69+
extensions: mbstring, dom, fileinfo, intl, gd, imagick, bcmath, soap, zip, sqlite, pcov
70+
coverage: pcov
71+
72+
- name: Install
73+
run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist --optimize-autoloader
74+
75+
- name: Run php-cs-fixer
76+
run: composer format
77+
78+
- uses: stefanzweifel/git-auto-commit-action@v4
79+
with:
80+
commit_message: "style: resolve style guide violations"
81+
branch: ${{ github.head_ref }}
82+
83+
unit:
84+
needs: [conflicts, format]
85+
86+
runs-on: ubuntu-latest
87+
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v2
91+
with:
92+
ref: ${{ github.head_ref }}
93+
94+
- name: Setup PHP
95+
uses: shivammathur/setup-php@v2
96+
with:
97+
php-version: "7.4"
98+
extensions: mbstring, dom, fileinfo, intl, gd, imagick, bcmath, soap, zip, sqlite, pcov
99+
coverage: pcov
100+
101+
- name: Cache dependencies
102+
uses: actions/cache@v2
103+
with:
104+
path: ~/.composer/cache/files
105+
key: dependencies-composer-${{ hashFiles('composer.json') }}
106+
107+
- name: Install Composer dependencies
108+
run: composer install --no-ansi --no-interaction --no-suggest --no-progress --prefer-dist --optimize-autoloader
109+
110+
- name: Run Tests
111+
run: ./vendor/bin/pest --coverage --coverage-html=.coverage --coverage-clover=coverage.xml

.github/workflows/format.yml

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

.github/workflows/test.yml

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ clover.xml
55
.phpunit.result.cache
66
.coverage
77
coverage.xml
8+
.php_cs.cache

src/API/AbstractAPI.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
namespace ArkEcosystem\Client\API;
1515

16-
use GuzzleHttp\Client;
1716
use ArkEcosystem\Client\Connection;
18-
use ArkEcosystem\Client\Http\Request;
1917
use ArkEcosystem\Client\Contracts\API;
18+
use ArkEcosystem\Client\Http\Request;
19+
use GuzzleHttp\Client;
2020

2121
/**
2222
* This is the abstract resource class.

src/Connection.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
namespace ArkEcosystem\Client;
1515

16-
use RuntimeException;
17-
use GuzzleHttp\Client;
1816
use BadMethodCallException;
17+
use GuzzleHttp\Client;
1918
use GuzzleHttp\HandlerStack;
2019
use Illuminate\Support\Str;
20+
use RuntimeException;
2121

2222
/**
2323
* This is the connection class.
@@ -36,14 +36,14 @@ class Connection
3636
/**
3737
* Make a new connection instance.
3838
*
39-
* @param array $config
39+
* @param array $config
4040
* @param \GuzzleHttp\HandlerStack $handler
4141
*/
4242
public function __construct(array $config, HandlerStack $handler = null)
4343
{
4444
$options = [
4545
'base_uri' => Str::finish($config['host'], '/'),
46-
'headers' => [
46+
'headers' => [
4747
'Content-Type' => 'application/json',
4848
],
4949
];
@@ -81,7 +81,7 @@ public function __call($name, $args)
8181
*/
8282
public function api(string $name): API\AbstractAPI
8383
{
84-
$name = ucfirst($name);
84+
$name = ucfirst($name);
8585
$class = "ArkEcosystem\\Client\\API\\{$name}";
8686

8787
if (! class_exists($class)) {
@@ -93,6 +93,7 @@ public function api(string $name): API\AbstractAPI
9393

9494
/**
9595
* Get the Guzzle client instance.
96+
*
9697
* @return \GuzzleHttp\Client
9798
*/
9899
public function getHttpClient(): Client

tests/ConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace ArkEcosystem\Tests\Client;
1515

16-
use ArkEcosystem\Client\Connection;
1716
use ArkEcosystem\Client\API\AbstractAPI;
17+
use ArkEcosystem\Client\Connection;
1818
use ArkEcosystem\Client\ConnectionManager;
1919

2020
/**

tests/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
namespace ArkEcosystem\Tests\Client;
1515

16+
use ArkEcosystem\Client\Connection;
17+
use GuzzleHttp\Handler\MockHandler;
1618
use GuzzleHttp\HandlerStack;
1719
use GuzzleHttp\Psr7\Request;
1820
use GuzzleHttp\Psr7\Response;
19-
use ArkEcosystem\Client\Connection;
20-
use GuzzleHttp\Handler\MockHandler;
2121
use PHPUnit\Framework\TestCase as BaseTestCase;
2222

2323
abstract class TestCase extends BaseTestCase

0 commit comments

Comments
 (0)