From e2ad48c1725db380f089a5e16973a9a1434f1bc7 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Sat, 13 Mar 2021 12:30:51 +0100 Subject: [PATCH] Add Github Actions CI --- .gitattributes | 1 + .github/workflows/continuous-integration.yml | 75 ++++++++++++++++++++ README.md | 9 ++- 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/continuous-integration.yml diff --git a/.gitattributes b/.gitattributes index 9a7ba4b..68ee07c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore +.github export-ignore .php_cs export-ignore .travis.yml export-ignore phpunit.xml.dist export-ignore diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..124570d --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,75 @@ +name: "CI" + +on: + pull_request: + push: + branches: + - "master" + schedule: + - cron: "42 3 * * *" + +jobs: + phpunit: + name: "PHPUnit" + runs-on: "ubuntu-20.04" + + strategy: + matrix: + php-version: + - "7.3" + - "7.4" + - "8.0" + dependencies: + - "highest" + include: + - dependencies: "lowest" + php-version: "7.3" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "pcov" + ini-values: "zend.assertions=1" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v1" + with: + dependency-versions: "${{ matrix.dependencies }}" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage" + path: "coverage.xml" + + upload_coverage: + name: "Upload coverage to Codecov" + runs-on: "ubuntu-20.04" + needs: + - "phpunit" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Download coverage files" + uses: "actions/download-artifact@v2" + with: + path: "reports" + + - name: "Upload to Codecov" + uses: "codecov/codecov-action@v1" + with: + directory: reports diff --git a/README.md b/README.md index 2d9bab0..07e87c8 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ DataLoaderPHP is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching. -[![Build Status](https://travis-ci.org/overblog/dataloader-php.svg?branch=master)](https://travis-ci.org/overblog/dataloader-php) -[![Coverage Status](https://coveralls.io/repos/github/overblog/dataloader-php/badge.svg?branch=master)](https://coveralls.io/github/overblog/dataloader-php?branch=master) +[![GitHub Actions][GA master image]][GA master] +[![Code Coverage][Coverage image]][CodeCov Master] [![Latest Stable Version](https://poser.pugx.org/overblog/dataloader-php/version)](https://packagist.org/packages/overblog/dataloader-php) [![License](https://poser.pugx.org/overblog/dataloader-php/license)](https://packagist.org/packages/overblog/dataloader-php) @@ -402,3 +402,8 @@ Also, large parts of the documentation have been ported from the dataLoader Node ## License Overblog/DataLoaderPHP is released under the [MIT](https://github.com/overblog/dataloader-php/blob/master/LICENSE) license. + +[Coverage image]: https://codecov.io/gh/overblog/dataloader-php/branch/master/graph/badge.svg +[CodeCov Master]: https://codecov.io/gh/overblog/dataloader-php/branch/master +[GA master]: https://github.com/overblog/dataloader-php/actions?query=workflow%3A%22CI%22+branch%3Amaster +[GA master image]: https://github.com/overblog/dataloader-php/workflows/CI/badge.svg