Refactor workflows and templates

This commit is contained in:
Shivam Mathur 2022-01-29 07:29:03 +05:30
parent 96857323bb
commit 44ff4ed92d
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
9 changed files with 60 additions and 47 deletions

View File

@ -1,37 +1,26 @@
# Contributing to setup-php # Contributing to setup-php
## Welcome!
We look forward to your contributions! Here are some examples how you can contribute:
* [Ask any questions you may have](https://github.com/shivammathur/setup-php/discussions/new?category=Q-A-Help)
* [Report a bug](https://github.com/shivammathur/setup-php/issues/new?labels=type/bug&template=bug.md)
* [Propose a new feature](https://github.com/shivammathur/setup-php/issues/new?labels=enhancement&template=feature.md)
* [Send a pull request](https://github.com/shivammathur/setup-php/pulls)
## Contributor Code of Conduct ## Contributor Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
## Workflow ## Getting Started
* Fork the project. To get started fork `setup-php` and clone it using git:
* Make your bug fix or feature addition.
* Add tests for it, so we don't break it in a future version unintentionally.
* If editing the scripts, create a demo integration test.
* Send a pull request to the develop branch with all the details.
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 <root@localhost>` look really stupid in the commit history of a project.
Due to time constraints, you may not always get a quick response. Please do not take delays personally and feel free to remind.
## Coding Guidelines
## Using setup-php from a Git checkout
The following commands can be used to perform the initial checkout of setup-php:
```bash ```bash
$ git clone https://github.com/shivammathur/setup-php.git git clone https://github.com/<your-username>/setup-php.git
$ cd setup-php cd setup-php
```
Install setup-php dependencies using [npm](https://www.npmjs.com/):
```bash
$ npm install
``` ```
If you are using `Windows` configure `git` to handle line endings. If you are using `Windows` configure `git` to handle line endings.
@ -40,31 +29,54 @@ If you are using `Windows` configure `git` to handle line endings.
git config --local core.autocrlf true git config --local core.autocrlf true
``` ```
Install `setup-php` dependencies using [npm](https://www.npmjs.com/):
```bash
npm install
```
## Workflow to create Pull Requests
* Fork the `setup-php` project and clone it.
* Create a new branch from the develop branch.
* Make your bug fix or feature addition.
* Add tests for it, so we don't break it in a future version unintentionally.
* Ensure the test suite passes and the code complies with our coding guidelines (see below).
* Send a pull request to the develop branch with all the details.
* If possible, create a GitHub Actions workflow with an integration test for the change in a demo repository and link it in your pull request.
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 <root@localhost>` look really stupid in the commit history of a project.
Due to time constraints, you may not always get a quick response. Please do not take delays personally and feel free to remind.
## Coding Guidelines
This project comes with `.prettierrc.json` and `eslintrc.json` configuration files. Please run the following commands to fix and verify the code quality. This project comes with `.prettierrc.json` and `eslintrc.json` configuration files. Please run the following commands to fix and verify the code quality.
```bash ```bash
$ npm run format npm run format
$ npm run lint npm run lint
``` ```
## Running the test suite ### Running the test suite
After following the steps shown above, The `setup-php` tests in the `__tests__` directory can be run using this command: After following the steps shown above, The `setup-php` tests in the `__tests__` directory can be run using this command:
```bash ```bash
$ npm test npm test
``` ```
## Creating a release ### Creating a release
Create a release before you push your changes. Creating a release means compiling all the TypeScript code to a single file which `setup-php` can run. Run this, before you push your changes.
```bash ```bash
$ npm run release npm run release
``` ```
## Reporting issues ### Reporting issues and discussions
Please submit the issue using the appropriate template provided for a bug report or a feature request: For questions or support, we prefer GitHub Discussions. For any bugs or new features you can create an issue using the appropriate template:
* [Discussions](https://github.com/shivammathur/setup-php/discussions)
* [Issues](https://github.com/shivammathur/setup-php/issues) * [Issues](https://github.com/shivammathur/setup-php/issues)

11
.github/SECURITY.md vendored
View File

@ -2,23 +2,18 @@
## Supported Versions ## Supported Versions
The following versions of this project are supported for security updates. The latest patch versions of `v1` and `v2` releases of this project are supported for security updates.
| Version | Supported |
| ------- | ------------------ |
| 1.11.x | :white_check_mark: |
| 2.14.x | :white_check_mark: |
## Supported PHP Versions ## Supported PHP Versions
This security policy only applies to the latest patches of the following PHP versions. This security policy only applies to the latest patches of the following PHP versions.
| Version | Supported | | Version | Supported |
| ------- | ------------------ | |---------|--------------------|
| 7.3 | :white_check_mark: |
| 7.4 | :white_check_mark: | | 7.4 | :white_check_mark: |
| 8.0 | :white_check_mark: | | 8.0 | :white_check_mark: |
| 8.1 | :white_check_mark: | | 8.1 | :white_check_mark: |
| 8.2 | :white_check_mark: |
## Reporting a Vulnerability ## Reporting a Vulnerability

View File

@ -17,7 +17,7 @@ jobs:
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
- name: Save unix - name: Create for Linux and macOS
env: env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }} version: ${{ matrix.php-versions }}
@ -29,7 +29,7 @@ jobs:
php -m >> "$file" php -m >> "$file"
echo "\`\`\`" >> "$file" echo "\`\`\`" >> "$file"
printf "\n" >> "$file" printf "\n" >> "$file"
- name: Save Windows - name: Create for Windows
env: env:
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version: ${{ matrix.php-versions }} version: ${{ matrix.php-versions }}
@ -39,7 +39,8 @@ jobs:
Write-Output "``````" | Out-File -FilePath "$env:file" -Append Write-Output "``````" | Out-File -FilePath "$env:file" -Append
php -m | Out-File -FilePath "$env:file" -Append php -m | Out-File -FilePath "$env:file" -Append
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
- uses: actions/upload-artifact@v2 - name: Upload artifacts
uses: actions/upload-artifact@v2
with: with:
name: lists name: lists
path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md path: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
@ -52,13 +53,16 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
repository: ${{ github.repository }}.wiki repository: ${{ github.repository }}.wiki
- uses: actions/download-artifact@v2 - name: Download artifacts
uses: actions/download-artifact@v2
with: with:
path: ${{ github.workspace }} path: ${{ github.workspace }}
- name: Combine - name: Configure Git
run : | run : |
git config --local user.email "${{ secrets.email }}" git config --local user.email "${{ secrets.email }}"
git config --local user.name "${{ github.repository_owner }}" git config --local user.name "${{ github.repository_owner }}"
- name: Combine
run: |
for os in ubuntu-20.04 ubuntu-18.04 windows-2022 windows-2019 macos-11 macos-10.15; do for os in ubuntu-20.04 ubuntu-18.04 windows-2022 windows-2019 macos-11 macos-10.15; do
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2; do for version in 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2; do
@ -72,6 +76,8 @@ jobs:
done done
done done
rm -rf ./lists rm -rf ./lists
- name: Update
run: |
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
git add . git add .
git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')" git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')"