Skip to content

Commit efa981a

Browse files
authored
Merge pull request #32 from phpgt/31-nullable-types
Refactor & fix nullable types
2 parents e6ef77c + 0050581 commit efa981a

File tree

7 files changed

+464
-462
lines changed

7 files changed

+464
-462
lines changed

.github/workflows/ci.yml

Lines changed: 81 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,62 +5,126 @@ on: [push]
55
jobs:
66
composer:
77
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
php: [ 8.1, 8.2, 8.3, 8.4 ]
811

912
steps:
10-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1114

1215
- name: Cache Composer dependencies
13-
uses: actions/cache@v2
16+
uses: actions/cache@v4
1417
with:
1518
path: /tmp/composer-cache
16-
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
19+
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
1720

18-
- uses: php-actions/composer@v5
21+
- uses: php-actions/composer@v6
22+
with:
23+
php_version: ${{ matrix.php }}
1924

2025
- name: Archive build
21-
run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./
26+
run: mkdir /tmp/github-actions/ && tar --exclude=".git" -cvf /tmp/github-actions/build.tar ./
2227

2328
- name: Upload build archive for test runners
24-
uses: actions/upload-artifact@v2
29+
uses: actions/upload-artifact@v4
2530
with:
26-
name: build-artifact
31+
name: build-artifact-${{ matrix.php }}
2732
path: /tmp/github-actions
2833

2934
phpunit:
3035
runs-on: ubuntu-latest
3136
needs: [composer]
37+
strategy:
38+
matrix:
39+
php: [ 8.1, 8.2, 8.3, 8.4 ]
40+
41+
outputs:
42+
coverage: ${{ steps.store-coverage.outputs.coverage_text }}
3243

3344
steps:
34-
- uses: actions/download-artifact@v2
45+
- uses: actions/download-artifact@v4
3546
with:
36-
name: build-artifact
47+
name: build-artifact-${{ matrix.php }}
3748
path: /tmp/github-actions
3849

3950
- name: Extract build archive
4051
run: tar -xvf /tmp/github-actions/build.tar ./
4152

4253
- name: PHP Unit tests
43-
uses: php-actions/phpunit@v2
54+
uses: php-actions/phpunit@v3
55+
env:
56+
XDEBUG_MODE: cover
4457
with:
45-
php_version: 8.0
58+
version: 10
59+
php_version: ${{ matrix.php }}
4660
php_extensions: xdebug
47-
configuration: test/phpunit/phpunit.xml
48-
bootstrap: vendor/autoload.php
61+
coverage_text: _coverage/coverage.txt
62+
coverage_clover: _coverage/clover.xml
63+
64+
- name: Store coverage data
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: code-coverage-${{ matrix.php }}-${{ github.run_number }}
68+
path: _coverage
69+
70+
coverage:
71+
runs-on: ubuntu-latest
72+
needs: [ phpunit ]
73+
strategy:
74+
matrix:
75+
php: [ 8.1, 8.2, 8.3, 8.4 ]
76+
77+
steps:
78+
- uses: actions/checkout@v4
79+
80+
- uses: actions/download-artifact@v4
81+
with:
82+
name: code-coverage-${{ matrix.php }}-${{ github.run_number }}
83+
path: _coverage
84+
85+
- name: Output coverage
86+
run: cat "_coverage/coverage.txt"
87+
88+
- name: Upload to Codecov
89+
uses: codecov/codecov-action@v5
90+
with:
91+
token: ${{ secrets.CODECOV_TOKEN }}
92+
slug: PhpGt/Logger
4993

5094
phpstan:
5195
runs-on: ubuntu-latest
5296
needs: [composer]
97+
strategy:
98+
matrix:
99+
php: [ 8.1, 8.2, 8.3, 8.4 ]
53100

54101
steps:
55-
- uses: actions/download-artifact@v2
102+
- uses: actions/download-artifact@v4
56103
with:
57-
name: build-artifact
104+
name: build-artifact-${{ matrix.php }}
58105
path: /tmp/github-actions
59106

60107
- name: Extract build archive
61108
run: tar -xvf /tmp/github-actions/build.tar ./
62109

63110
- name: PHP Static Analysis
64-
uses: php-actions/phpstan@v2
111+
uses: php-actions/phpstan@v3
65112
with:
66-
path: src/
113+
php_version: ${{ matrix.php }}
114+
path: src/
115+
116+
117+
remove_old_artifacts:
118+
runs-on: ubuntu-latest
119+
120+
steps:
121+
- name: Remove old artifacts for prior workflow runs on this repository
122+
env:
123+
GH_TOKEN: ${{ github.token }}
124+
run: |
125+
gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
126+
while read id
127+
do
128+
echo -n "Deleting artifact ID $id ... "
129+
gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$id && echo "Done"
130+
done <artifact-id-list.txt

.scrutinizer.yml

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

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"type": "library",
55

66
"require": {
7-
"php": ">=7.4"
7+
"php": ">=8.1"
88
},
99

1010
"require-dev": {
11-
"phpstan/phpstan": "^v1.8",
12-
"phpunit/phpunit": "^v9.5"
11+
"phpstan/phpstan": "^2.1",
12+
"phpunit/phpunit": "^10.5"
1313
},
1414

1515
"license": "MIT",

0 commit comments

Comments
 (0)