From 577ab2a02a4fc42b5fedfc0f35bae86e033c1484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Hump=C3=A1l?= Date: Wed, 5 Jan 2022 15:18:22 +0100 Subject: [PATCH 1/2] GitHub workflows as CI --- .github/CONTRIBUTING.md | 53 +++++++++++++++++++++++ .github/FUNDING.yml | 1 + .github/ISSUE_TEMPLATE/Bug_report.md | 29 +++++++++++++ .github/ISSUE_TEMPLATE/Feature_request.md | 8 ++++ .github/ISSUE_TEMPLATE/config.yml | 7 +++ .github/workflows/coverage.yml | 42 ++++++++++++++++++ .github/workflows/cs.yml | 43 ++++++++++++++++++ .github/workflows/tests.yml | 52 ++++++++++++++++++++++ .travis.yml | 50 --------------------- 9 files changed, 235 insertions(+), 50 deletions(-) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/Bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/Feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/cs.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..eef6959 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,53 @@ +Contributing +============ + +Issue tracker +------------- + +The Issue tracker serves mainly as a place to report bugs and request new features. +Please do not abuse it as a general questions or troubleshooting location. + +General troubleshooting +------------- + +For these questions please use [Discussions](https://github.com/mpdf/mpdf/discussions). Add your enquiry +to appropriate category and as always, include a reproducible code example when applicable (see code example guidelines below). + +You can also use the [mpdf tag](https://stackoverflow.com/questions/tagged/mpdf) +at [Stack Overflow](https://stackoverflow.com/) +as the StackOverflow user base is more likely to answer you in a timely manner. +When doing so, make sure you comply to StackOverflow question guidelines. + +Bug reports +------------- + +* Bug reports **MUST** contain a small example in php/html that reproduces the bug. +* The code example **MUST** be reproducible by copy&paste assuming composer dependencies are installed. That means: + * No calling unrelated funcions, + * an actual final HTML code has to be present, pasting a template file is not enough, + * if the bug considers import or fonts, example source PDF/TTF/etc files have to be included. +* Failing to provide necessary information or not using the issue template will cause the issue to be closed until required information is provided. +* Please report one feature or one bug per issue. + +Feature requests +------------- + +Feature requests have to be labeled as such and have to include reasoning for the change in question. + + +Pull requests +------------- + +Pull requests should be always based on the default [development](https://github.com/mpdf/mpdf/tree/development) +branch except for backports to older versions. + +Guidelines: + +* Use an aptly named feature branch for the Pull request. +* Only files and lines affecting the scope of the Pull request must be affected. +* Make small, *atomic* commits that keep the smallest possible related code changes together. +* Code must be accompanied by a unit test testing expected behaviour whenever possible. +* To be incorporated, the PR should contain a change in the CHANGELOG.md file describing itself + +When updating a PR, do not create a new one, just `git push --force` to your former feature branch, the PR will +update itself. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..4760137 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: https://www.paypal.me/mpdf diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 0000000..aef3f66 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report 🐛 +about: The library does not work as expected +--- + + + +### I found this bug + +### This is mPDF and PHP version and environment (server/fpm/cli etc) I am using + +### This is the PHP code snippet I use + +``` + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..901d9c2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,7 @@ +contact_links: + - name: General questions and troubleshooting ❓ + url: https://github.com/mpdf/mpdf/discussions + about: You can use Github Discussions for general questions and troubleshooting. Please note that asking at Stack Overflow will probably be more successful. + - name: QA at Stack Overflow ❓ + url: https://stackoverflow.com/questions/tagged/mpdf + about: Ask at Stack Overflow for a greater chance of a quick and correct answer to your questions. Make sure to comply to SO rules, terms and conditions. diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..13b1207 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,42 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "Code coverage" + +on: + push: + branches: + - "development" + - "coverage" + +jobs: + + coverage: + + name: "Code coverage" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + 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: "xdebug" + php-version: "${{ matrix.php-version }}" + extensions: "mbstring, gd, bcmath, bz2" + tools: composer:v2 + + - name: "Install dependencies" + run: "composer install --no-interaction --no-progress" + + - name: "Code coverage" + run: composer coverage diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml new file mode 100644 index 0000000..ff003e0 --- /dev/null +++ b/.github/workflows/cs.yml @@ -0,0 +1,43 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "Coding standard check" + +on: + pull_request: + push: + branches: + - "development" + - "test" + +jobs: + + cs: + + name: "Coding standard" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + 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: "none" + php-version: "${{ matrix.php-version }}" + extensions: "mbstring" + tools: composer:v2 + + - name: "Install dependencies" + run: "composer install --no-interaction --no-progress" + + - name: "CS" + run: composer cs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ff64a81 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,52 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "CI" + +on: + pull_request: + push: + branches: + - "master" + - "development" + - "test" + +jobs: + + tests: + + name: "Tests" + + runs-on: ${{ matrix.operating-system }} + + strategy: + fail-fast: false + matrix: + php-version: + - "5.6" + - "7.0" + - "7.1" + - "7.2" + - "7.3" + - "7.4" + - "8.0" + - "8.1" + operating-system: [ubuntu-latest, windows-latest] + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "${{ matrix.php-version }}" + extensions: "mbstring, gd, bcmath, bz2" + tools: composer:v2 + ini-values: error_reporting=-1 + + - name: "Install dependencies" + run: "composer install --no-interaction --no-progress" + + - name: "Tests" + run: composer test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 399fa99..0000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -language: php - -dist: xenial - -group: edge - -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - nightly - -matrix: - - include: - - - env: LINT=1 - php: 7.1 - #- env: COVERAGE=1 - # php: 7.1 - - allow_failures: - - php: nightly - -install: - - composer self-update - - echo "${TRAVIS_PHP_VERSION:0:3}" - - | - if [[ "${TRAVIS_PHP_VERSION:0:7}" == "nightly" ]]; then - composer install --ignore-platform-reqs - else - composer install - fi - -script: - - | - if [[ "$LINT" == "1" ]]; then - ./vendor/bin/phpcs -v --report-width=160 --standard=ruleset.xml --severity=1 --warning-severity=0 --extensions=php src tests - elif [[ "$COVERAGE" == "1" ]]; then - vendor/bin/phpunit --coverage-text - else - vendor/bin/phpunit - fi - -notifications: - email: - on_success: change - on_failure: always From 1d08739129a7375d2ea46c24c4f84eedaaeac586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Hump=C3=A1l?= Date: Wed, 5 Jan 2022 15:20:33 +0100 Subject: [PATCH 2/2] Add composer CI scripts --- composer.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composer.json b/composer.json index 29e4352..2cc4ed0 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,12 @@ "tracy/tracy": "^2.5" }, + "scripts": { + "cs": "@php vendor/bin/phpcs -v --report-width=160 --standard=ruleset.xml --severity=1 --warning-severity=0 --extensions=php src utils tests", + "test": "@php vendor/bin/phpunit", + "coverage": "@php vendor/bin/phpunit --coverage-text" + }, + "suggest": { "ext-gd": "To output QR codes to PNG files" },