diff --git a/.github/workflows/bc.yml b/.github/workflows/bc.yml index 2d288ed..18b35c8 100644 --- a/.github/workflows/bc.yml +++ b/.github/workflows/bc.yml @@ -1,4 +1,9 @@ -on: [push, pull_request] +on: + pull_request: ~ + push: + branches: + - "master" + name: Roave jobs: roave_bc_check: diff --git a/.github/workflows/branch-alias.yml b/.github/workflows/branch-alias.yml index 9c08d7f..377cd29 100644 --- a/.github/workflows/branch-alias.yml +++ b/.github/workflows/branch-alias.yml @@ -53,23 +53,14 @@ jobs: composer config extra.branch-alias.dev-main ${{ steps.find_alias.outputs.alias }}-dev - - name: Commit & push the new files - run: | - echo "::group::git status" - git status - echo "::endgroup::" - - git add -N . - if [[ $(git diff --numstat | wc -l) -eq 0 ]]; then - echo "No changes found. Exiting." - exit 0; - fi - - git config --local user.email "noreply@github.com" - git config --local user.name "GitHub" - - echo "::group::git push" - git add . - git commit -m "Update branch alias" - git push - echo "::endgroup::" + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + base: main + branch: branch-alias-update + author: GitHub + committer: GitHub + commit-message: Updating branch alias to ${{ steps.find_alias.outputs.alias }} + title: Update branch alias + body: | + Since we just tagged a new version, we need to update composer.json branch alias. diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 0089206..11b808e 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,4 +1,9 @@ -on: [push, pull_request] +on: + pull_request: ~ + push: + branches: + - "master" + name: Static analysis jobs: phpstan: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..bcf0f4e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,82 @@ +on: + pull_request: ~ + push: + branches: + - "master" + +name: Tests + +jobs: + phpunit: + name: PHPUnit with PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }} + + strategy: + matrix: + operating-system: + - 'ubuntu-latest' + php-version: + - '7.1' + - '7.2' + - '7.3' + - '7.4' + - '8.0' + include: + - operating-system: 'windows-latest' + php-version: '7.4' + + runs-on: ${{ matrix.operating-system }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + coverage: none + php-version: ${{ matrix.php-version }} + + - 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: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }} + restore-keys: | + composer-${{ runner.os }}-${{ matrix.php-version }}- + composer-${{ runner.os }}- + composer- + + - name: Download dependencies + run: composer update --no-interaction --no-progress --optimize-autoloader + + - name: Run PHPUnit + run: ./vendor/bin/phpunit + + phpunit-lowest: + name: PHPUnit lowest dependencies + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + coverage: none + php-version: 7.4 + + - name: Download dependencies + run: composer update --no-interaction --no-progress --optimize-autoloader --prefer-stable --prefer-lowest + + - name: Run PHPUnit + run: ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml + + - name: Upload coverage + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover coverage.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 908de13..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: php -sudo: false - -cache: - directories: - - $HOME/.composer/cache - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -env: - global: - - TEST_COMMAND="./vendor/bin/phpunit" - -branches: - except: - - /^patch-.*$/ - -matrix: - fast_finish: true - include: - - name: "PHP: 8.0" - php: nightly - - - name: "Lowest version of dependencies" - php: 7.2 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="./vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" - -install: - - composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction - -script: - - $TEST_COMMAND - -after_success: - - if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi - - if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi diff --git a/composer.json b/composer.json index a5b9dc0..0741e74 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.4-dev" } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1e5ba2a..51ebcd4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,5 @@ - - - src/ - - tests/ diff --git a/tests/UploadedFileTest.php b/tests/UploadedFileTest.php index 085967c..42f2201 100644 --- a/tests/UploadedFileTest.php +++ b/tests/UploadedFileTest.php @@ -134,7 +134,7 @@ public function testGetStream() $upload = new UploadedFile(__DIR__.'/Resources/foo.txt', 0, UPLOAD_ERR_OK); $stream = $upload->getStream(); $this->assertInstanceOf(StreamInterface::class, $stream); - $this->assertEquals("Foobar\n", $stream->__toString()); + $this->assertEquals('Foobar'.PHP_EOL, $stream->__toString()); } public function testSuccessful()