From e21e79b49f0a698da0dc304a66e2786ffccd25d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Thu, 14 Nov 2019 15:46:48 +0100 Subject: [PATCH 1/6] Enhancement: Switch to using GitHub actions --- .github/workflows/continuous-integration.yml | 104 ++++++++++++++++++- .travis.yml | 24 ----- phpunit.xml.dist | 6 ++ readme.md | 4 +- 4 files changed, 109 insertions(+), 29 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5e495b2b91..8cc7a4ded5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -12,11 +12,107 @@ on: name: "Continuous Integration" jobs: - hello: - name: "Hello" + coding-standards: + name: "Coding Standards" runs-on: ubuntu-latest steps: - - name: "Hello" - run: echo "Hello, François and Pim!" + - name: "Checkout" + uses: actions/checkout@v1.2.0 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@1.5.5 + with: + coverage: none + extension-csv: "intl" + php-version: 7.2 + + - name: "Cache dependencies installed with composer" + uses: actions/cache@v1.0.3 + with: + path: ~/.composer/cache + key: php7.2-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + php7.2-composer- + + - name: "Install dependencies with composer" + run: $(which composer) install --no-interaction --no-progress --no-suggest + + - name: "Run squizlabs/php_codesniffer" + run: vendor/bin/phpcs --standard=PSR2 src -n + + tests: + name: "Tests" + + runs-on: ubuntu-latest + + strategy: + matrix: + php-version: + - 7.2 + - 7.3 + - 7.4 + + steps: + - name: "Checkout" + uses: actions/checkout@v1.2.0 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@1.5.5 + with: + coverage: none + extension-csv: "intl" + php-version: ${{ matrix.php-version }} + + - name: "Cache dependencies installed with composer" + uses: actions/cache@v1.0.3 + with: + path: ~/.composer/cache + key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + php${{ matrix.php-version }}-composer- + + - name: "Install dependencies with composer" + run: $(which composer) install --no-interaction --no-progress --no-suggest + + - name: "Run tests with phpunit/phpunit" + run: vendor/bin/phpunit + + code-coverage: + name: "Code Coverage" + + runs-on: ubuntu-latest + + steps: + - name: "Checkout" + uses: actions/checkout@v1.2.0 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@1.5.5 + with: + coverage: xdebug + extension-csv: "intl" + php-version: 7.4 + + - name: "Cache dependencies installed with composer" + uses: actions/cache@v1.0.3 + with: + path: ~/.composer/cache + key: php7.4-composer-locked-${{ hashFiles('**/composer.json') }} + restore-keys: | + php7.4-composer-locked- + + - name: "Install locked dependencies with composer" + run: $(which composer) install --no-interaction --no-progress --no-suggest + + - name: "Create build directory" + run: mkdir -p .build/logs + + - name: "Collect code coverage with Xdebug and phpunit/phpunit" + run: vendor/bin/phpunit --coverage-clover=.build/logs/clover.xml + + - name: "Send code coverage report to Codecov.io" + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4279b47f8b..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: php - -dist: precise - -php: - - 7.2 - - 7.3 - - nightly - -matrix: - allow_failures: - - nightly - -cache: - directories: - - $HOME/.composer/cache - -before_install: - - phpenv config-rm xdebug.ini || true - -before_script: - - travis_retry composer install --no-interaction --prefer-dist - -script: make sniff test diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f871fdada8..af082d9dff 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,4 +11,10 @@ ./test/Faker/ + + + + src/ + + diff --git a/readme.md b/readme.md index c9bac035e9..3c3de8ddfe 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,7 @@ # Faker +[![Continuous Integration](https://github.com/fzaninotto/Faker/workflows/Continuous%20Integration/badge.svg)](https://github.com/fzaninotto/Faker/actions) + Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you. Faker is heavily inspired by Perl's [Data::Faker](http://search.cpan.org/~jasonk/Data-Faker-0.07/), and by ruby's [Faker](https://rubygems.org/gems/faker). @@ -53,7 +55,7 @@ composer require fzaninotto/faker ### Autoloading -Faker supports both `PSR-0` as `PSR-4` autoloaders. +Faker supports both `PSR-0` as `PSR-4` autoloaders. ```php Date: Sun, 1 Dec 2019 12:37:00 +0100 Subject: [PATCH 2/6] Fix: Widen version constraints --- .github/workflows/continuous-integration.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8cc7a4ded5..9b07df9d7e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -19,17 +19,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.2.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@1.5.5 + uses: shivammathur/setup-php@1 with: coverage: none extension-csv: "intl" php-version: 7.2 - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.3 + uses: actions/cache@v1 with: path: ~/.composer/cache key: php7.2-composer-${{ hashFiles('**/composer.json') }} @@ -56,17 +56,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.2.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@1.5.5 + uses: shivammathur/setup-php@1 with: coverage: none extension-csv: "intl" php-version: ${{ matrix.php-version }} - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.3 + uses: actions/cache@v1 with: path: ~/.composer/cache key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} @@ -86,17 +86,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.2.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@1.5.5 + uses: shivammathur/setup-php@1 with: coverage: xdebug extension-csv: "intl" php-version: 7.4 - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.3 + uses: actions/cache@v1 with: path: ~/.composer/cache key: php7.4-composer-locked-${{ hashFiles('**/composer.json') }} From 49c7b118560bdc6bebc82b13a9733eb721a9ad2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 1 Dec 2019 12:38:14 +0100 Subject: [PATCH 3/6] Enhancement: Use matrix strategy to reduce repetition --- .github/workflows/continuous-integration.yml | 22 ++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 9b07df9d7e..81ae0872b5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -17,6 +17,11 @@ jobs: runs-on: ubuntu-latest + strategy: + matrix: + php-version: + - 7.2 + steps: - name: "Checkout" uses: actions/checkout@v1 @@ -26,15 +31,15 @@ jobs: with: coverage: none extension-csv: "intl" - php-version: 7.2 + php-version: ${{ matrix.php-version }} - name: "Cache dependencies installed with composer" uses: actions/cache@v1 with: path: ~/.composer/cache - key: php7.2-composer-${{ hashFiles('**/composer.json') }} + key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: | - php7.2-composer- + php${{ matrix.php-version }}-composer- - name: "Install dependencies with composer" run: $(which composer) install --no-interaction --no-progress --no-suggest @@ -84,6 +89,11 @@ jobs: runs-on: ubuntu-latest + strategy: + matrix: + php-version: + - 7.4 + steps: - name: "Checkout" uses: actions/checkout@v1 @@ -93,15 +103,15 @@ jobs: with: coverage: xdebug extension-csv: "intl" - php-version: 7.4 + php-version: ${{ matrix.php-version }} - name: "Cache dependencies installed with composer" uses: actions/cache@v1 with: path: ~/.composer/cache - key: php7.4-composer-locked-${{ hashFiles('**/composer.json') }} + key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.json') }} restore-keys: | - php7.4-composer-locked- + php${{ matrix.php-version }}-composer-locked- - name: "Install locked dependencies with composer" run: $(which composer) install --no-interaction --no-progress --no-suggest From a71e4164a53f4ac44ebcc6dc5d0bbc11e3d78aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 1 Dec 2019 12:39:17 +0100 Subject: [PATCH 4/6] Fix: Version constraint --- .github/workflows/continuous-integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 81ae0872b5..8fd62f6353 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@1 + uses: shivammathur/setup-php@v1 with: coverage: none extension-csv: "intl" @@ -64,7 +64,7 @@ jobs: uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@1 + uses: shivammathur/setup-php@v1 with: coverage: none extension-csv: "intl" @@ -99,7 +99,7 @@ jobs: uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@1 + uses: shivammathur/setup-php@v1 with: coverage: xdebug extension-csv: "intl" From 27a3972ec5ec5a3188d9c041e7f622d34502c527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 1 Dec 2019 12:44:53 +0100 Subject: [PATCH 5/6] Enhancement: Add badge for code coverage --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 3c3de8ddfe..81a7a40184 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,7 @@ # Faker [![Continuous Integration](https://github.com/fzaninotto/Faker/workflows/Continuous%20Integration/badge.svg)](https://github.com/fzaninotto/Faker/actions) +[![codecov](https://codecov.io/gh/fzaninotto/Faker/branch/master/graph/badge.svg)](https://codecov.io/gh/fzaninotto/Faker) Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you. From efafac9ccd455957cb367a2144ab5057725131a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 1 Dec 2019 12:45:30 +0100 Subject: [PATCH 6/6] Fix: Branch --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 81a7a40184..ea9c64f426 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # Faker [![Continuous Integration](https://github.com/fzaninotto/Faker/workflows/Continuous%20Integration/badge.svg)](https://github.com/fzaninotto/Faker/actions) -[![codecov](https://codecov.io/gh/fzaninotto/Faker/branch/master/graph/badge.svg)](https://codecov.io/gh/fzaninotto/Faker) +[![codecov](https://codecov.io/gh/fzaninotto/Faker/branch/next/graph/badge.svg)](https://codecov.io/gh/fzaninotto/Faker) Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you.