Skip to content

Commit

Permalink
add Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
frasmage committed Dec 5, 2020
1 parent 502b5d8 commit 9c81aa6
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 4 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/automated-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: automated-tests
on: [push]
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.3', '7.4']
prefer-lowest: ['','--prefer-lowest']
name: PHP ${{ matrix.php-versions }} ${{ matrix.prefer-lowest }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: gd
coverage: pcov
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-version }}${{ matrix.prefer-lowest }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}${{ matrix.prefer-lowest }}-composer-

- name: Install dependencies
run: composer update --prefer-dist ${{ matrix.prefer-lowest }}
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run phpunit
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml -v

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: $YOUR_PHP_VERSION
run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v

finish-coverage:
needs: phpunit
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ before_script:
- composer update --prefer-dist --prefer-stable $PREFER_LOWEST
script:
- mkdir -p build/logs
- php vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml
- php vendor/bin/phpunit --coverage-clover build/logs/clover.xml
after_script:
- php vendor/bin/php-coveralls -v
cache:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
},
"require-dev": {
"orchestra/testbench": "^4.0|^5.0|^6.0",
"phpunit/phpunit": "^8.2.4|^9.0",
"phpunit/phpunit": "^9.5",
"vlucas/phpdotenv": "^4.0|^5.0",
"league/flysystem-aws-s3-v3" : "^1.0.23",
"guzzlehttp/promises": "^1.3",
"aws/aws-sdk-php": "^3.128.0",
"php-coveralls/php-coveralls": "^2.1",
"php-coveralls/php-coveralls": "^2.4",
"laravel/legacy-factories": "^1.0.4",
"doctrine/dbal": "^2.11"
},
Expand Down
5 changes: 4 additions & 1 deletion src/SourceAdapters/RemoteUrlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ private function getHeader($key, $default = null): ?string
*/
public function getHeaders(): array
{
$headers = @get_headers($this->source, 1);
$headers = @get_headers(
$this->source,
version_compare(phpversion(), '8.0.0', '>=') ? true : 1
);

return $headers ?: [];
}
Expand Down

0 comments on commit 9c81aa6

Please sign in to comment.