Skip to content

Commit cb6780c

Browse files
g105bGreg Bowler
and
Greg Bowler
authored
Upgrade CI and deps (#308)
* ci: remove old artifacts * ci: run all php versions * feature: implement selectPrefix closes #13 * tweak: ignore unused function parameter * build: update dependencies (for gt/http compatibility) * ci: upgrade workflows, fix security issue --------- Co-authored-by: Greg Bowler <[email protected]>
1 parent aed6756 commit cb6780c

File tree

3 files changed

+343
-137
lines changed

3 files changed

+343
-137
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
name: CI
22

3-
on: [push]
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
actions: read
8+
id-token: none
49

510
jobs:
611
composer:
712
runs-on: ubuntu-latest
813
strategy:
914
matrix:
10-
php: [ 8.1, 8.2, 8.3, 8.4 ]
15+
php: [ 8.3, 8.4 ]
1116

1217
steps:
1318
- uses: actions/checkout@v4
@@ -24,7 +29,7 @@ jobs:
2429
php_version: ${{ matrix.php }}
2530

2631
- name: Archive build
27-
run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./
32+
run: mkdir /tmp/github-actions/ && tar --exclude=".git" -cvf /tmp/github-actions/build.tar ./
2833

2934
- name: Upload build archive for test runners
3035
uses: actions/upload-artifact@v4
@@ -37,7 +42,7 @@ jobs:
3742
needs: [ composer ]
3843
strategy:
3944
matrix:
40-
php: [ 8.1, 8.2, 8.3, 8.4 ]
45+
php: [ 8.3, 8.4 ]
4146

4247
outputs:
4348
coverage: ${{ steps.store-coverage.outputs.coverage_text }}
@@ -56,7 +61,6 @@ jobs:
5661
env:
5762
XDEBUG_MODE: cover
5863
with:
59-
version: 10
6064
php_version: ${{ matrix.php }}
6165
php_extensions: xdebug
6266
coverage_text: _coverage/coverage.txt
@@ -73,9 +77,11 @@ jobs:
7377
needs: [ phpunit ]
7478
strategy:
7579
matrix:
76-
php: [ 8.1, 8.2, 8.3, 8.4 ]
80+
php: [ 8.3, 8.4 ]
7781

7882
steps:
83+
- uses: actions/checkout@v4
84+
7985
- uses: actions/download-artifact@v4
8086
with:
8187
name: code-coverage-${{ matrix.php }}-${{ github.run_number }}
@@ -85,16 +91,14 @@ jobs:
8591
run: cat "_coverage/coverage.txt"
8692

8793
- name: Upload to Codecov
88-
uses: codecov/codecov-action@v4
89-
with:
90-
token: ${{ secrets.CODECOV_TOKEN }}
94+
uses: codecov/codecov-action@v5
9195

9296
phpstan:
9397
runs-on: ubuntu-latest
9498
needs: [ composer ]
9599
strategy:
96100
matrix:
97-
php: [ 8.1, 8.2, 8.3, 8.4 ]
101+
php: [ 8.3, 8.4 ]
98102

99103
steps:
100104
- uses: actions/download-artifact@v4
@@ -110,14 +114,13 @@ jobs:
110114
with:
111115
php_version: ${{ matrix.php }}
112116
path: src/
113-
level: 6
114117

115118
phpmd:
116119
runs-on: ubuntu-latest
117120
needs: [ composer ]
118121
strategy:
119122
matrix:
120-
php: [ 8.1, 8.2, 8.3, 8.4 ]
123+
php: [ 8.3, 8.4 ]
121124

122125
steps:
123126
- uses: actions/download-artifact@v4
@@ -141,7 +144,7 @@ jobs:
141144
needs: [ composer ]
142145
strategy:
143146
matrix:
144-
php: [ 8.1, 8.2, 8.3, 8.4 ]
147+
php: [ 8.3, 8.4 ]
145148

146149
steps:
147150
- uses: actions/download-artifact@v4
@@ -162,12 +165,15 @@ jobs:
162165
remove_old_artifacts:
163166
runs-on: ubuntu-latest
164167

168+
permissions:
169+
actions: write
170+
165171
steps:
166172
- name: Remove old artifacts for prior workflow runs on this repository
167173
env:
168174
GH_TOKEN: ${{ github.token }}
169175
run: |
170-
gh api "/repos/${{ github.repository }}/actions/artifacts?name=build-artifact" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
176+
gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
171177
while read id
172178
do
173179
echo -n "Deleting artifact ID $id ... "

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"license": "MIT",
55

66
"require": {
7-
"php": ">=8.1",
8-
"phpgt/http": "^1.1",
9-
"phpgt/json": "^1.2"
7+
"php": ">=8.3",
8+
"phpgt/http": "1.*",
9+
"phpgt/json": "^2.1"
1010
},
1111

1212
"require-dev": {

0 commit comments

Comments
 (0)