77 runs-on : ubuntu-latest
88 strategy :
99 matrix :
10- php : [ 8.0, 8.1, 8.2, 8.3 ]
10+ php : [ 8.0, 8.1, 8.2, 8.3, 8.4 ]
1111
1212 steps :
1313 - uses : actions/checkout@v4
1414
1515 - name : Cache Composer dependencies
16- uses : actions/cache@v3
16+ uses : actions/cache@v4
1717 with :
1818 path : /tmp/composer-cache
1919 key : ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
2020
2121 - name : Composer
22- uses : php-actions/composer@run-as-current-user
22+ uses : php-actions/composer@v6
2323 with :
2424 php_version : ${{ matrix.php }}
2525
2626 - name : Archive build
27- run : mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./
27+ run : mkdir /tmp/github-actions/ && tar --exclude=".git" - cvf /tmp/github-actions/build.tar ./
2828
2929 - name : Upload build archive for test runners
3030 uses : actions/upload-artifact@v4
3131 with :
32- name : build-php${{ matrix.php }}
32+ name : build-php- ${{ matrix.php }}
3333 path : /tmp/github-actions
3434
3535 phpunit :
3636 runs-on : ubuntu-latest
3737 needs : [composer]
3838 strategy :
3939 matrix :
40- php : [ 8.0, 8.1, 8.2, 8.3 ]
40+ php : [ 8.0, 8.1, 8.2, 8.3, 8.4 ]
41+
42+ outputs :
43+ coverage : ${{ steps.store-coverage.outputs.coverage_text }}
4144
4245 steps :
4346 - uses : actions/download-artifact@v4
4447 with :
45- name : build-php${{ matrix.php }}
48+ name : build-php- ${{ matrix.php }}
4649 path : /tmp/github-actions
4750
4851 - name : Extract build archive
@@ -54,20 +57,40 @@ jobs:
5457 version : 9
5558 php_version : ${{ matrix.php }}
5659 php_extensions : xdebug
57- configuration : test/phpunit/phpunit.xml
58- bootstrap : vendor/autoload.php
60+ configuration : phpunit.xml
61+
62+ coverage :
63+ runs-on : ubuntu-latest
64+ needs : [ phpunit ]
65+ strategy :
66+ matrix :
67+ php : [ 8.0, 8.1, 8.2, 8.3, 8.4 ]
68+
69+ steps :
70+ - uses : actions/download-artifact@v4
71+ with :
72+ name : code-coverage-${{ matrix.php }}-${{ github.run_number }}
73+ path : _coverage
74+
75+ - name : Output coverage
76+ run : cat "_coverage/coverage.txt"
77+
78+ - name : Upload to Codecov
79+ uses : codecov/codecov-action@v4
80+ with :
81+ token : ${{ secrets.CODECOV_TOKEN }}
5982
6083 phpstan :
6184 runs-on : ubuntu-latest
6285 needs : [composer]
6386 strategy :
6487 matrix :
65- php : [ 8.0, 8.1, 8.2, 8.3 ]
88+ php : [ 8.0, 8.1, 8.2, 8.3, 8.4 ]
6689
6790 steps :
6891 - uses : actions/download-artifact@v4
6992 with :
70- name : build-php${{ matrix.php }}
93+ name : build-php- ${{ matrix.php }}
7194 path : /tmp/github-actions
7295
7396 - name : Extract build archive
@@ -82,14 +105,17 @@ jobs:
82105 remove_old_artifacts :
83106 runs-on : ubuntu-latest
84107
108+ permissions :
109+ actions : write
110+
85111 steps :
86112 - name : Remove old artifacts for prior workflow runs on this repository
87113 env :
88114 GH_TOKEN : ${{ github.token }}
89115 run : |
90- gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | .id" > artifact-id-list.txt
116+ gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
91117 while read id
92118 do
93119 echo -n "Deleting artifact ID $id ... "
94- gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$id && echo "Done" || true
120+ gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$id && echo "Done"
95121 done <artifact-id-list.txt
0 commit comments