From 46ac6f2211bb4ebe2ed35d638fcabee8d594a7bb Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sat, 2 Nov 2019 22:09:42 +0530 Subject: [PATCH 1/2] Cache node_modules in workflows --- .github/workflows/darwin.yml | 10 ++++++++++ .github/workflows/ubuntu.yml | 10 ++++++++++ .github/workflows/windows.yml | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/.github/workflows/darwin.yml b/.github/workflows/darwin.yml index b7ed2f32..40f161f4 100644 --- a/.github/workflows/darwin.yml +++ b/.github/workflows/darwin.yml @@ -21,7 +21,17 @@ jobs: with: node-version: 12.x + - name: Cache node modules + uses: actions/cache@preview + id: cache + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Installing NPM packages + if: steps.cache.outputs.cache-hit != 'true' run: npm install - name: Run tests diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 5c4f5893..5d78e39f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,7 +21,17 @@ jobs: with: node-version: 12.x + - name: Cache node modules + uses: actions/cache@preview + id: cache + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Installing NPM packages + if: steps.cache.outputs.cache-hit != 'true' run: npm install - name: Run tests diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 0716f097..aacac4f8 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -21,7 +21,17 @@ jobs: with: node-version: 12.x + - name: Cache node modules + uses: actions/cache@preview + id: cache + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**\package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Installing NPM packages + if: steps.cache.outputs.cache-hit != 'true' run: npm install - name: Run tests From 06e916db9d57ee7584b222d4326ffa30f4d1cf02 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sun, 3 Nov 2019 10:11:44 +0530 Subject: [PATCH 2/2] Improve documentation --- .github/CONTRIBUTING.md | 6 +-- .github/PULL_REQUEST_TEMPLATE.md | 9 ++-- .github/PULL_REQUEST_TEMPLATE/FAILING_TEST.md | 30 ----------- .github/PULL_REQUEST_TEMPLATE/FIX.md | 1 + .github/PULL_REQUEST_TEMPLATE/IMPROVEMENT.md | 1 + .github/PULL_REQUEST_TEMPLATE/NEW_FEATURE.md | 1 + README.md | 52 +++++++++++++++++-- 7 files changed, 56 insertions(+), 44 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE/FAILING_TEST.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 1ba7b207..774f77b7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -13,11 +13,11 @@ Please note that this project is released with a [Contributor Code of Conduct](C Please make sure that you have [set up your user name and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git. Strings such as `silly nick name ` look really stupid in the commit history of a project. -Due to time constraints, you may not always get a quick responce. Please do not take delays personal and feel free to remind me. +Due to time constraints, you may not always get a quick response. Please do not take delays personal and feel free to remind. ## Coding Guidelines -This project comes with a `.prettierrc.json` configuration file. Please run the following command to format the code before commiting it. +This project comes with a `.prettierrc.json` configuration file. Please run the following command to format the code before committing it. ```bash $ npm run format @@ -49,6 +49,6 @@ $ npm test ## Reporting issues -Please submit the issue using the appropiate template provided for a bug report or a feature request: +Please submit the issue using the appropriate template provided for a bug report or a feature request: * [Issues](https://github.com/shivammathur/setup-php/issues) \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 6cfc53c1..73a0a734 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,11 +1,8 @@ --- -name: | - 🐞 Failing Test - 🐞 Bug Fix - ⚙ Improvement - 🎉 New Feature -about: You found a bug, have a failing test, want to improve something or add a new feature +name: 🐞 Bug Fix, ⚙ Improvement or 🎉 New Feature +about: You found a bug, want to improve something or add a new feature labels: bug or enhancement + --- ## A Pull Request should be associated with an Issue. diff --git a/.github/PULL_REQUEST_TEMPLATE/FAILING_TEST.md b/.github/PULL_REQUEST_TEMPLATE/FAILING_TEST.md deleted file mode 100644 index b69150f6..00000000 --- a/.github/PULL_REQUEST_TEMPLATE/FAILING_TEST.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: 🐞 Failing Test -about: You found a bug and have a failing test? -labels: bug ---- - -## A Pull Request should be associated with an Issue. - -> We wish to have discussions in Issues. A single issue may be targeted by multiple PRs. -> If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues, -> and potentially we'll be able to point development in a particular direction. - -Related issue: - -> Further notes in [Contribution Guidelines](.github/CONTRIBUTING.md) -> Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR - -### Description - -This PR [briefly explain what it does] - -> In case this PR introduced TypeScript/JavaScript code changes: - -- [ ] I have written test cases for the changes in this pull request -- [ ] I have run `npm run format` before the commit. -- [ ] `npm test` returns with no unit test errors. - - diff --git a/.github/PULL_REQUEST_TEMPLATE/FIX.md b/.github/PULL_REQUEST_TEMPLATE/FIX.md index 3d1bc7e3..d964461f 100644 --- a/.github/PULL_REQUEST_TEMPLATE/FIX.md +++ b/.github/PULL_REQUEST_TEMPLATE/FIX.md @@ -2,6 +2,7 @@ name: 🐞 Bug Fix about: You have a fix for a bug? labels: bug + --- ## A Pull Request should be associated with an Issue. diff --git a/.github/PULL_REQUEST_TEMPLATE/IMPROVEMENT.md b/.github/PULL_REQUEST_TEMPLATE/IMPROVEMENT.md index b1bf337e..3958c000 100644 --- a/.github/PULL_REQUEST_TEMPLATE/IMPROVEMENT.md +++ b/.github/PULL_REQUEST_TEMPLATE/IMPROVEMENT.md @@ -2,6 +2,7 @@ name: ⚙ Improvement about: You have some improvement to make setup-php better? labels: enhancement + --- ## A Pull Request should be associated with an Issue. diff --git a/.github/PULL_REQUEST_TEMPLATE/NEW_FEATURE.md b/.github/PULL_REQUEST_TEMPLATE/NEW_FEATURE.md index c8192d78..7c695c9b 100644 --- a/.github/PULL_REQUEST_TEMPLATE/NEW_FEATURE.md +++ b/.github/PULL_REQUEST_TEMPLATE/NEW_FEATURE.md @@ -2,6 +2,7 @@ name: 🎉 New Feature about: You have implemented some neat idea that you want to make part of setup-php? labels: enhancement + --- ## A Pull Request should be associated with an Issue. diff --git a/README.md b/README.md index 493d9d81..fc23203c 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,26 @@ Setup PHP with required extensions, php.ini configuration and composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action can be added as a step in your action workflow and it will setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this. +## Contents + +- [PHP Support](#tada-php-support) +- [OS/Platform Support](#cloud-osplatform-support) +- [PHP Extension Support](#wrench-php-extension-support) +- [Coverage support](#signal_strength-coverage-support) + - [Xdebug](#xdebug) + - [PCOV](#pcov) + - [Disable coverage](#disable-coverage) +- [Usage](#memo-usage) + - [Basic Usage](#basic-usage) + - [Matrix Testing](#matrix-testing) + - [Cache dependencies](#cache-dependencies) + - [Examples](#examples) +- [License](#scroll-license) +- [Contributions](#1-contributions) +- [Support this project](#sparkling_heart-support-this-project) +- [This action uses the following works](#bookmark-this-action-uses-the-following-works) +- [Further Reading](#bookmark_tabs-further-reading) + ## :tada: PHP Support |PHP Version|Stability|Release Support| @@ -64,7 +84,7 @@ with: Specify `coverage: pcov` to use `PCOV`. It is much faster than `Xdebug`. -`PCOV` needs `PHP >= 7.1` +`PCOV` needs `PHP >= 7.1`. If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values-csv` input. @@ -80,9 +100,10 @@ with: Specify `coverage: none` to disable both `Xdebug` and `PCOV`. Consider disabling the coverage using this PHP action for these reasons. + - You are not generating coverage reports while testing. - It will disable `Xdebug`, which will have a positive impact on PHP performance. -- You are using `phpdbg`. +- You are using `phpdbg` for running your tests. ```yaml uses: shivammathur/setup-php@master @@ -153,6 +174,24 @@ jobs: run: php -m ``` +### Cache dependencies + +You can cache you dependencies using the [`action/cache`](https://github.com/actions/cache) GitHub Action and add a condition in your `composer install` step to run only if your dependencies are not cached. The files cached using this method are available across check-runs and will reduce the workflow execution time. + +```yaml +- name: Cache dependencies +- uses: actions/cache@preview + id: cache + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- +- name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: composer install +``` + ### Examples Examples for setting up this GitHub Action with different PHP Frameworks/Packages. @@ -181,12 +220,15 @@ The scripts and documentation in this project are released under the [MIT Licens ## :+1: Contributions -Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide"). +Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "shivammathur/setup-php contribution guide"). If you face any issues while using this or want to suggest a feature/improvement, create an issue [here](https://github.com/shivammathur/setup-php/issues "Issues reported"). ## :sparkling_heart: Support this project -- Please star the project and share it. -- Please support on Support me on Patreon and Support me on Paypal. +If this action helped you. + +- Please star the project and share it, this helps reach more people. +- If you blog, write about your experience using this. +- Support on this project on Patreon or using Paypal. ## :bookmark: This action uses the following works