Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Commit 5a6a73b

Browse files
authored
Move to Github Actions (#13)
1 parent a61faef commit 5a6a73b

File tree

13 files changed

+300
-167
lines changed

13 files changed

+300
-167
lines changed

.gitattributes

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
/.github export-ignore
12
/tests export-ignore
23
.gitattributes export-ignore
34
.gitignore export-ignore
45
.php_cs export-ignore
5-
.scrutinizer.yml export-ignore
6-
.travis.run-tests.sh export-ignore
7-
.travis.yml export-ignore
6+
Makefile export-ignore
87
phpstan.neon export-ignore
98
phpunit.xml export-ignore

.github/workflows/integrate.yaml

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
name: "Integrate"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "master"
8+
9+
jobs:
10+
composer-json-lint:
11+
name: "Lint composer.json"
12+
13+
runs-on: "ubuntu-latest"
14+
15+
strategy:
16+
matrix:
17+
php-version:
18+
- "7.4"
19+
20+
steps:
21+
- name: "Checkout"
22+
uses: "actions/checkout@v2"
23+
24+
- name: "Install PHP"
25+
uses: "shivammathur/setup-php@v2"
26+
with:
27+
coverage: "none"
28+
php-version: "${{ matrix.php-version }}"
29+
tools: composer-normalize, composer-require-checker, composer-unused
30+
31+
- name: "Get composer cache directory"
32+
id: composercache
33+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
34+
35+
- name: "Cache dependencies"
36+
uses: actions/cache@v2
37+
with:
38+
path: ${{ steps.composercache.outputs.dir }}
39+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
40+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
41+
42+
- name: "Install dependencies"
43+
run: "composer update --no-interaction --no-progress"
44+
45+
- name: "Validate composer.json"
46+
run: "composer validate --strict"
47+
48+
- name: "Normalize composer.json"
49+
run: "composer-normalize --dry-run"
50+
51+
tests:
52+
name: "Tests"
53+
54+
runs-on: "ubuntu-latest"
55+
56+
strategy:
57+
matrix:
58+
php-version:
59+
- "7.4"
60+
- "8.0"
61+
62+
steps:
63+
- name: "Checkout"
64+
uses: "actions/checkout@v2"
65+
66+
- name: "Install PHP"
67+
uses: "shivammathur/setup-php@v2"
68+
with:
69+
coverage: "none"
70+
php-version: "${{ matrix.php-version }}"
71+
ini-values: zend.assertions=1
72+
73+
- name: "Get composer cache directory"
74+
id: composercache
75+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
76+
77+
- name: "Cache dependencies"
78+
uses: actions/cache@v2
79+
with:
80+
path: ${{ steps.composercache.outputs.dir }}
81+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
82+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
83+
84+
- name: "Install dependencies"
85+
if: ${{ matrix.php-version != '8.0' }}
86+
run: "composer update --no-interaction --no-progress"
87+
88+
- name: "Install dependencies PHP 8.0"
89+
if: ${{ matrix.php-version == '8.0' }}
90+
run: "composer update --no-interaction --no-progress --ignore-platform-reqs"
91+
92+
- name: "Run tests"
93+
timeout-minutes: 3
94+
run: "vendor/bin/phpunit --no-coverage --no-logging"
95+
96+
code-coverage:
97+
name: "Code Coverage"
98+
99+
runs-on: "ubuntu-latest"
100+
101+
strategy:
102+
matrix:
103+
php-version:
104+
- "7.4"
105+
106+
steps:
107+
- name: "Checkout"
108+
uses: "actions/checkout@v2"
109+
110+
- name: "Install PHP"
111+
uses: "shivammathur/setup-php@v2"
112+
with:
113+
coverage: "pcov"
114+
php-version: "${{ matrix.php-version }}"
115+
ini-values: zend.assertions=1
116+
117+
- name: "Get composer cache directory"
118+
id: composercache
119+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
120+
121+
- name: "Cache dependencies"
122+
uses: actions/cache@v2
123+
with:
124+
path: ${{ steps.composercache.outputs.dir }}
125+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
126+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
127+
128+
- name: "Install dependencies"
129+
run: "composer update --no-interaction --no-progress"
130+
131+
- name: "Run tests"
132+
timeout-minutes: 3
133+
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
134+
135+
- name: "Send code coverage report to Codecov.io"
136+
uses: codecov/codecov-action@v1
137+
with:
138+
token: ${{ secrets.CODECOV_TOKEN }}
139+
file: ./coverage.xml
140+
fail_ci_if_error: true
141+
142+
coding-standards:
143+
name: "Coding Standards"
144+
145+
runs-on: "ubuntu-latest"
146+
147+
strategy:
148+
matrix:
149+
php-version:
150+
- "7.4"
151+
152+
steps:
153+
- name: "Checkout"
154+
uses: "actions/checkout@v2"
155+
156+
- name: "Install PHP"
157+
uses: "shivammathur/setup-php@v2"
158+
with:
159+
coverage: "none"
160+
php-version: "${{ matrix.php-version }}"
161+
162+
- name: "Get composer cache directory"
163+
id: composercache
164+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
165+
166+
- name: "Cache dependencies"
167+
uses: actions/cache@v2
168+
with:
169+
path: ${{ steps.composercache.outputs.dir }}
170+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
171+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
172+
173+
- name: "Install dependencies"
174+
run: "composer update --no-interaction --no-progress"
175+
176+
- name: "Check coding standards"
177+
run: "vendor/bin/php-cs-fixer fix --verbose --dry-run --diff"
178+
179+
static-analysis:
180+
name: "Static Analysis"
181+
182+
runs-on: "ubuntu-latest"
183+
184+
strategy:
185+
matrix:
186+
php-version:
187+
- "7.4"
188+
189+
steps:
190+
- name: "Checkout"
191+
uses: "actions/checkout@v2"
192+
193+
- name: "Install PHP"
194+
uses: "shivammathur/setup-php@v2"
195+
with:
196+
coverage: "none"
197+
php-version: "${{ matrix.php-version }}"
198+
tools: cs2pr
199+
200+
- name: "Get composer cache directory"
201+
id: composercache
202+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
203+
204+
- name: "Cache dependencies"
205+
uses: actions/cache@v2
206+
with:
207+
path: ${{ steps.composercache.outputs.dir }}
208+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
209+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
210+
211+
- name: "Install dependencies"
212+
run: "composer update --no-interaction --no-progress"
213+
214+
- name: "Run static analysis"
215+
run: "vendor/bin/phpstan analyse --no-progress --error-format=checkstyle | cs2pr"

.php_cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
$config = new SlamCsFixer\Config(SlamCsFixer\Config::LIB);
3+
$config = new SlamCsFixer\Config();
44
$config->getFinder()
55
->in(__DIR__ . '/lib/Exception')
66
->in(__DIR__ . '/lib/Helper')

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
all: csfix static-analysis test
2+
@echo "Done."
3+
4+
vendor: composer.json
5+
composer update
6+
touch vendor
7+
8+
.PHONY: csfix
9+
csfix: vendor
10+
vendor/bin/php-cs-fixer fix --verbose
11+
12+
.PHONY: static-analysis
13+
static-analysis: vendor
14+
vendor/bin/phpstan analyse
15+
16+
.PHONY: test
17+
test: vendor
18+
php -d zend.assertions=1 vendor/bin/phpunit

composer.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.3"
13+
"php": "^7.4 || ^8.0"
1414
},
1515
"require-dev": {
16-
"mikey179/vfsstream": "^1.6",
17-
"phpoffice/phpspreadsheet": "^1.10",
18-
"phpstan/phpstan": "^0.12",
19-
"phpstan/phpstan-phpunit": "^0.12",
20-
"phpunit/phpunit": "^8.5",
21-
"roave/security-advisories": "dev-master",
22-
"slam/php-cs-fixer-extensions": "^1.19",
23-
"slam/php-debug-r": "^1.6",
24-
"slam/phpstan-extensions": "^4.0",
25-
"thecodingmachine/phpstan-strict-rules": "^0.12"
16+
"mikey179/vfsstream": "^1.6.8",
17+
"phpoffice/phpspreadsheet": "^1.15.0",
18+
"phpstan/phpstan": "^0.12.50",
19+
"phpstan/phpstan-phpunit": "^0.12.16",
20+
"phpunit/phpunit": "^9.4.2",
21+
"slam/php-cs-fixer-extensions": "^2.0.0",
22+
"slam/php-debug-r": "^1.6.1",
23+
"slam/phpstan-extensions": "^5.0.2",
24+
"thecodingmachine/phpstan-strict-rules": "^0.12.1"
2625
},
2726
"autoload": {
2827
"psr-4": {

lib/Helper/Column.php

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,10 @@
66

77
final class Column implements ColumnInterface
88
{
9-
/**
10-
* @var string
11-
*/
12-
private $key;
13-
14-
/**
15-
* @var string
16-
*/
17-
private $heading;
18-
19-
/**
20-
* @var int
21-
*/
22-
private $width;
23-
24-
/**
25-
* @var CellStyleInterface
26-
*/
27-
private $cellStyle;
9+
private string $key;
10+
private string $heading;
11+
private int $width;
12+
private CellStyleInterface $cellStyle;
2813

2914
public function __construct(string $key, string $heading, int $width, CellStyleInterface $cellStyle)
3015
{

lib/Helper/ColumnCollection.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class ColumnCollection implements ColumnCollectionInterface
1111
/**
1212
* @var array<string, ColumnInterface>
1313
*/
14-
private $columns = [];
14+
private array $columns = [];
1515

1616
public function __construct(array $columns)
1717
{
@@ -29,35 +29,31 @@ private function addColumn(ColumnInterface $column): void
2929
* @param string $offset
3030
* @param mixed $value
3131
*/
32-
public function offsetSet($offset, $value)
32+
public function offsetSet($offset, $value): void
3333
{
3434
throw new Exception\RuntimeException('Collection not editable');
3535
}
3636

3737
/**
3838
* @param string $offset
39-
*
40-
* @return bool
4139
*/
42-
public function offsetExists($offset)
40+
public function offsetExists($offset): bool
4341
{
4442
return isset($this->columns[$offset]);
4543
}
4644

4745
/**
4846
* @param string $offset
4947
*/
50-
public function offsetUnset($offset)
48+
public function offsetUnset($offset): void
5149
{
5250
throw new Exception\RuntimeException('Collection not editable');
5351
}
5452

5553
/**
5654
* @param string $offset
57-
*
58-
* @return null|mixed
5955
*/
60-
public function offsetGet($offset)
56+
public function offsetGet($offset): ?ColumnInterface
6157
{
6258
return $this->columns[$offset] ?? null;
6359
}

lib/Helper/ColumnCollectionInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use ArrayAccess;
88

9+
/**
10+
* @extends ArrayAccess<string, ColumnInterface>
11+
*/
912
interface ColumnCollectionInterface extends ArrayAccess
1013
{
1114
}

0 commit comments

Comments
 (0)