1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-04-21 07:51:51 +02:00

Enhancement: Switch to using GitHub actions (#1847)

* Enhancement: Switch to using GitHub actions

* Fix: Widen version constraints

* Enhancement: Use matrix strategy to reduce repetition

* Fix: Version constraint

* Enhancement: Add badge for code coverage

* Fix: Branch
This commit is contained in:
Andreas Möller 2019-12-02 20:39:19 +01:00 committed by Pim Jansen
parent 5e086da58e
commit d7b25e00f9
4 changed files with 120 additions and 29 deletions

View File

@ -12,11 +12,117 @@ on:
name: "Continuous Integration"
jobs:
hello:
name: "Hello"
coding-standards:
name: "Coding Standards"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 7.2
steps:
- name: "Hello"
run: echo "Hello, François and Pim!"
- name: "Checkout"
uses: actions/checkout@v1
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "intl"
php-version: ${{ matrix.php-version }}
- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
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 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
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v1
with:
coverage: none
extension-csv: "intl"
php-version: ${{ matrix.php-version }}
- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
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
strategy:
matrix:
php-version:
- 7.4
steps:
- name: "Checkout"
uses: actions/checkout@v1
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v1
with:
coverage: xdebug
extension-csv: "intl"
php-version: ${{ matrix.php-version }}
- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-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)

View File

@ -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

View File

@ -11,4 +11,10 @@
<directory>./test/Faker/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -1,5 +1,8 @@
# 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/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.
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 +56,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
<?php
# When installed via composer