Skip to content

Commit 669766f

Browse files
authored
Event model (#41)
* build: upgrade dependencies * test: isolate functionality for #3 * feature: implement pub:sub model closes #3 * test: php 8.2
1 parent c55d2d5 commit 669766f

8 files changed

Lines changed: 289 additions & 117 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
name: CI
22

3-
on: [push]
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
actions: read
410

511
jobs:
612
composer:
713
runs-on: ubuntu-latest
814
strategy:
915
matrix:
10-
php: [ 8.1, 8.2, 8.3, 8.4 ]
16+
php: [ 8.2, 8.3, 8.4, 8.5 ]
1117

1218
steps:
13-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v6
1420

1521
- name: Cache Composer dependencies
16-
uses: actions/cache@v4
22+
uses: actions/cache@v5
1723
with:
1824
path: /tmp/composer-cache
1925
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
@@ -22,9 +28,10 @@ jobs:
2228
uses: php-actions/composer@v6
2329
with:
2430
php_version: ${{ matrix.php }}
31+
php_extensions: pcntl
2532

2633
- name: Archive build
27-
run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./
34+
run: mkdir /tmp/github-actions/ && tar --exclude=".git" -cvf /tmp/github-actions/build.tar ./
2835

2936
- name: Upload build archive for test runners
3037
uses: actions/upload-artifact@v4
@@ -37,7 +44,7 @@ jobs:
3744
needs: [ composer ]
3845
strategy:
3946
matrix:
40-
php: [ 8.1, 8.2, 8.3, 8.4 ]
47+
php: [ 8.2, 8.3, 8.4, 8.5 ]
4148

4249
outputs:
4350
coverage: ${{ steps.store-coverage.outputs.coverage_text }}
@@ -72,7 +79,7 @@ jobs:
7279
needs: [ phpunit ]
7380
strategy:
7481
matrix:
75-
php: [ 8.1, 8.2, 8.3, 8.4 ]
82+
php: [ 8.2, 8.3, 8.4, 8.5 ]
7683

7784
steps:
7885
- uses: actions/checkout@v4
@@ -87,13 +94,15 @@ jobs:
8794

8895
- name: Upload to Codecov
8996
uses: codecov/codecov-action@v5
97+
with:
98+
token: ${{ secrets.CODECOV_TOKEN }}
9099

91100
phpstan:
92101
runs-on: ubuntu-latest
93102
needs: [ composer ]
94103
strategy:
95104
matrix:
96-
php: [ 8.1, 8.2, 8.3, 8.4 ]
105+
php: [ 8.2, 8.3, 8.4, 8.5 ]
97106

98107
steps:
99108
- uses: actions/download-artifact@v4
@@ -109,13 +118,15 @@ jobs:
109118
with:
110119
php_version: ${{ matrix.php }}
111120
path: src/
121+
level: 6
122+
memory_limit: 256M
112123

113124
phpmd:
114125
runs-on: ubuntu-latest
115126
needs: [ composer ]
116127
strategy:
117128
matrix:
118-
php: [ 8.1, 8.2, 8.3, 8.4 ]
129+
php: [ 8.2, 8.3, 8.4, 8.5 ]
119130

120131
steps:
121132
- uses: actions/download-artifact@v4
@@ -139,7 +150,7 @@ jobs:
139150
needs: [ composer ]
140151
strategy:
141152
matrix:
142-
php: [ 8.1, 8.2, 8.3, 8.4 ]
153+
php: [ 8.2, 8.3, 8.4, 8.5 ]
143154

144155
steps:
145156
- uses: actions/download-artifact@v4
@@ -160,12 +171,15 @@ jobs:
160171
remove_old_artifacts:
161172
runs-on: ubuntu-latest
162173

174+
permissions:
175+
actions: write
176+
163177
steps:
164178
- name: Remove old artifacts for prior workflow runs on this repository
165179
env:
166180
GH_TOKEN: ${{ github.token }}
167181
run: |
168-
gh api "/repos/${{ github.repository }}/actions/artifacts?name=build-artifact" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
182+
gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
169183
while read id
170184
do
171185
echo -n "Deleting artifact ID $id ... "

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
.idea/
12
/vendor
23
/test/phpunit/_coverage
34
.phpunit.result.cache
4-
/example.*
5+
/example.*
6+
test/phpunit/.phpunit.cache

composer.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,26 @@
2424
"psr-4": {
2525
"Gt\\Async\\Test\\": "./test/phpunit"
2626
}
27-
}
27+
},
28+
29+
"scripts": {
30+
"phpunit": "vendor/bin/phpunit --configuration phpunit.xml",
31+
"phpunit:coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --coverage-text",
32+
"phpstan": "vendor/bin/phpstan analyse --level 6 src",
33+
"phpcs": "vendor/bin/phpcs src --standard=phpcs.xml",
34+
"phpmd": "vendor/bin/phpmd src/ text phpmd.xml",
35+
"test": [
36+
"@phpunit",
37+
"@phpstan",
38+
"@phpcs",
39+
"@phpmd"
40+
]
41+
},
42+
43+
"funding": [
44+
{
45+
"type": "github",
46+
"url": "https://github.com/sponsors/PhpGt"
47+
}
48+
]
2849
}

0 commit comments

Comments
 (0)