Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 18 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: CI

on: [push, pull_request]
on:
push:
pull_request:

permissions:
contents: read
actions: read
id-token: none

jobs:
composer:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.4 ]
php: [ 8.4, 8.5 ]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Cache Composer dependencies
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
Expand All @@ -27,6 +28,7 @@ jobs:
uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php }}
php_extensions: pcntl

- name: Archive build
run: mkdir /tmp/github-actions/ && tar --exclude=".git" -cvf /tmp/github-actions/build.tar ./
Expand All @@ -36,13 +38,14 @@ jobs:
with:
name: build-artifact-${{ matrix.php }}
path: /tmp/github-actions
retention-days: 1

phpunit:
runs-on: ubuntu-latest
needs: [ composer ]
strategy:
matrix:
php: [ 8.4 ]
php: [ 8.4, 8.5 ]

outputs:
coverage: ${{ steps.store-coverage.outputs.coverage_text }}
Expand Down Expand Up @@ -71,13 +74,14 @@ jobs:
with:
name: code-coverage-${{ matrix.php }}-${{ github.run_number }}
path: _coverage
retention-days: 1

coverage:
runs-on: ubuntu-latest
needs: [ phpunit ]
strategy:
matrix:
php: [ 8.4 ]
php: [ 8.4, 8.5 ]

steps:
- uses: actions/checkout@v4
Expand All @@ -92,13 +96,15 @@ jobs:

- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

phpstan:
runs-on: ubuntu-latest
needs: [ composer ]
strategy:
matrix:
php: [ 8.4 ]
php: [ 8.4, 8.5 ]

steps:
- uses: actions/download-artifact@v4
Expand All @@ -114,13 +120,15 @@ jobs:
with:
php_version: ${{ matrix.php }}
path: src/
level: 6
memory_limit: 256M

phpmd:
runs-on: ubuntu-latest
needs: [ composer ]
strategy:
matrix:
php: [ 8.4 ]
php: [ 8.4, 8.5 ]

steps:
- uses: actions/download-artifact@v4
Expand All @@ -144,7 +152,7 @@ jobs:
needs: [ composer ]
strategy:
matrix:
php: [ 8.4 ]
php: [ 8.4, 8.5 ]

steps:
- uses: actions/download-artifact@v4
Expand All @@ -161,21 +169,3 @@ jobs:
php_version: ${{ matrix.php }}
path: src/
standard: phpcs.xml

remove_old_artifacts:
runs-on: ubuntu-latest

permissions:
actions: write

steps:
- name: Remove old artifacts for prior workflow runs on this repository
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith(\"build-artifact\")) | .id" > artifact-id-list.txt
while read id
do
echo -n "Deleting artifact ID $id ... "
gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$id && echo "Done"
done <artifact-id-list.txt
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/vendor
/test/unit/_coverage
/.idea
/.idea
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ See also, the [JavaScript implementation][fetch-js] that ships as standard in al

```php
<?php
$http = new Gt\Fetch\Http();
$http = new GT\Fetch\Http();

// Rather than creating the request now, `fetch` returns a Promise,
// for later resolution with the BodyResponse.
Expand Down
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",

"require": {
"php": ">=8.3",
"php": ">=8.4",
"ext-curl": "*",
"ext-json": "*",
"phpgt/async": "^1.0",
Expand All @@ -25,13 +25,17 @@

"autoload": {
"psr-4": {
"GT\\Fetch\\": "./src",
"Gt\\Fetch\\": "./src"
}
},
"files": [
"namespace-aliases.php"
]
},

"autoload-dev": {
"psr-4": {
"Gt\\Fetch\\Test\\": "./test/phpunit"
"GT\\Fetch\\Test\\": "./test/phpunit"
}
},

Expand Down
Loading
Loading