From 4ebf211d71f1d56af4af4c33a14057d71c020948 Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Sat, 19 Dec 2020 19:39:30 +0100 Subject: [PATCH 1/6] Replace travis with GitHub actions --- .github/workflows/coding-standards.yml | 59 ++++++++++++++++++++++++ .github/workflows/phpunit.yml | 62 ++++++++++++++++++++++++++ .travis.yml | 32 ------------- 3 files changed, 121 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/coding-standards.yml create mode 100644 .github/workflows/phpunit.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 00000000..6afd99e7 --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,59 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "Check Coding Standards" + +on: + pull_request: + push: + branches: + - "master" + +jobs: + coding-standards: + name: "Check Coding Standards" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "locked" + php-version: + - "7.4" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "pcov" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + + - name: "Cache dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.composer/cache + vendor + key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + + - name: "Install lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" + + - name: "Install highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction --no-progress --no-suggest" + + - name: "Install locked dependencies" + if: ${{ matrix.dependencies == 'locked' }} + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Coding Standard" + run: "vendor/bin/phpcs" diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 00000000..520e9444 --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,62 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "PHPUnit tests" + +on: + pull_request: + push: + branches: + - "master" + +jobs: + phpunit: + name: "PHPUnit tests" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "lowest" + - "highest" + - "locked" + php-version: + - "7.4" + operating-system: + - "ubuntu-latest" + - "windows-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "pcov" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + + - name: "Cache dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.composer/cache + vendor + key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + + - name: "Install lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" + + - name: "Install highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction --no-progress --no-suggest" + + - name: "Install locked dependencies" + if: ${{ matrix.dependencies == 'locked' }} + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Tests" + run: "vendor/bin/phpunit" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 48273c62..00000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -dist: trusty -language: php - -php: - - 7.2 - - 7.3 - - 7.4 - - hhvm - -## Cache composer -cache: - directories: - - $HOME/.composer/cache - -matrix: - include: - - php: 7.2 - env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"' - -before_script: - - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist - -script: - - vendor/bin/phpcs --standard=psr2 src/ - - vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover - -after_script: - - | - if [[ "$TRAVIS_PHP_VERSION" != 'hhvm' ]]; then - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover coverage.clover - fi From 3a136b19113d008b50eddce5e5f5e79e39b5243d Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Sat, 19 Dec 2020 21:49:16 +0100 Subject: [PATCH 2/6] Remove .travis.yml and add github --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 48a95b67..d2faa93c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,10 +7,10 @@ /.gitignore export-ignore /.scrutinizer.yml export-ignore /.styleci.yml export-ignore -/.travis.yml export-ignore /PULL_REQUEST_TEMPLATE.md export-ignore /ISSUE_TEMPLATE.md export-ignore /phpcs.xml.dist export-ignore /phpunit.xml.dist export-ignore /tests export-ignore /docs export-ignore +/.github export-ignore From df52b2c2874a10f4f178201fb53b68315410d7e6 Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Sat, 19 Dec 2020 21:49:57 +0100 Subject: [PATCH 3/6] Fix phpcs command --- .github/workflows/coding-standards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 6afd99e7..4385ec0e 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -56,4 +56,4 @@ jobs: run: "composer install --no-interaction --no-progress --no-suggest" - name: "Coding Standard" - run: "vendor/bin/phpcs" + run: "vendor/bin/phpcs --standard=psr2 src/" From 049420eb0fd552e234b2e28f4bb72af7d8ea8b91 Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Sat, 19 Dec 2020 21:50:06 +0100 Subject: [PATCH 4/6] Don't run on windows by default --- .github/workflows/phpunit.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 520e9444..fed6c066 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -24,7 +24,6 @@ jobs: - "7.4" operating-system: - "ubuntu-latest" - - "windows-latest" steps: - name: "Checkout" From 66a5b43c43db45698b90c7147c28f919bd3a22c6 Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Sun, 20 Dec 2020 12:02:06 +0100 Subject: [PATCH 5/6] Don't cache dependencies, use composer v2 --- .github/workflows/coding-standards.yml | 10 +--------- .github/workflows/phpunit.yml | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 4385ec0e..01ab94ff 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -33,15 +33,7 @@ jobs: coverage: "pcov" php-version: "${{ matrix.php-version }}" ini-values: memory_limit=-1 - - - name: "Cache dependencies" - uses: "actions/cache@v2" - with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + tools: composer:v2 - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index fed6c066..85d18d98 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -35,15 +35,7 @@ jobs: coverage: "pcov" php-version: "${{ matrix.php-version }}" ini-values: memory_limit=-1 - - - name: "Cache dependencies" - uses: "actions/cache@v2" - with: - path: | - ~/.composer/cache - vendor - key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" - restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" + tools: composer:v2 - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} From bab279c090fe08e01903ce296d8065e555109df2 Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Sun, 20 Dec 2020 12:02:22 +0100 Subject: [PATCH 6/6] Run test suite on all supported PHP versions See https://www.php.net/supported-versions.php --- .github/workflows/phpunit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 85d18d98..9b86644c 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -21,7 +21,9 @@ jobs: - "highest" - "locked" php-version: + - "7.3" - "7.4" + - "8.0" operating-system: - "ubuntu-latest"