mirror of
https://hk.gh-proxy.com/https://github.com/wp-cli/profile-command.git
synced 2025-08-20 06:30:52 +08:00
Update file(s) from wp-cli/.github
This commit is contained in:
parent
70faeade40
commit
18c17a8d7b
3 changed files with 8 additions and 337 deletions
85
.github/workflows/code-quality.yml
vendored
85
.github/workflows/code-quality.yml
vendored
|
@ -7,87 +7,6 @@ on:
|
|||
- main
|
||||
- master
|
||||
|
||||
# Cancels all previous workflow runs for the same branch that have not yet completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name.
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
lint: #-----------------------------------------------------------------------
|
||||
name: Lint PHP files
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check existence of composer.json file
|
||||
id: check_composer_file
|
||||
uses: andstor/file-existence-action@v2
|
||||
with:
|
||||
files: "composer.json"
|
||||
|
||||
- name: Set up PHP environment
|
||||
if: steps.check_composer_file.outputs.files_exists == 'true'
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: cs2pr
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install Composer dependencies & cache dependencies
|
||||
if: steps.check_composer_file.outputs.files_exists == 'true'
|
||||
uses: "ramsey/composer-install@v2"
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
|
||||
|
||||
- name: Check existence of vendor/bin/parallel-lint file
|
||||
id: check_linter_file
|
||||
uses: andstor/file-existence-action@v2
|
||||
with:
|
||||
files: "vendor/bin/parallel-lint"
|
||||
|
||||
- name: Run Linter
|
||||
if: steps.check_linter_file.outputs.files_exists == 'true'
|
||||
run: vendor/bin/parallel-lint -j 10 . --exclude vendor --checkstyle | cs2pr
|
||||
|
||||
phpcs: #----------------------------------------------------------------------
|
||||
name: PHPCS
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check existence of composer.json & phpcs.xml.dist files
|
||||
id: check_files
|
||||
uses: andstor/file-existence-action@v2
|
||||
with:
|
||||
files: "composer.json, phpcs.xml.dist"
|
||||
|
||||
- name: Set up PHP environment
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
tools: cs2pr
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install Composer dependencies & cache dependencies
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
uses: "ramsey/composer-install@v2"
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
|
||||
|
||||
- name: Check existence of vendor/bin/phpcs file
|
||||
id: check_phpcs_binary_file
|
||||
uses: andstor/file-existence-action@v2
|
||||
with:
|
||||
files: "vendor/bin/phpcs"
|
||||
|
||||
- name: Run PHPCS
|
||||
if: steps.check_phpcs_binary_file.outputs.files_exists == 'true'
|
||||
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
|
||||
code-quality:
|
||||
uses: wp-cli/.github/.github/workflows/reusable-code-quality.yml
|
||||
|
|
95
.github/workflows/regenerate-readme.yml
vendored
95
.github/workflows/regenerate-readme.yml
vendored
|
@ -7,96 +7,9 @@ on:
|
|||
- main
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'features/**'
|
||||
- 'README.md'
|
||||
|
||||
# Cancels all previous workflow runs for the same branch that have not yet completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name.
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
- "features/**"
|
||||
- "README.md"
|
||||
|
||||
jobs:
|
||||
|
||||
regenerate-readme: #----------------------------------------------------------
|
||||
name: Regenerate README.md file
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'wp-cli' && ! contains(fromJson('[".github", "wp-cli", "wp-cli-bundle", "wp-super-cache-cli", "php-cli-tools", "wp-config-transformer"]'), github.event.repository.name) }}
|
||||
steps:
|
||||
- name: Check out source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up PHP envirnoment
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check existence of composer.json file
|
||||
id: check_composer_file
|
||||
uses: andstor/file-existence-action@v2
|
||||
with:
|
||||
files: "composer.json"
|
||||
|
||||
- name: Install Composer dependencies & cache dependencies
|
||||
if: steps.check_composer_file.outputs.files_exists == 'true'
|
||||
uses: "ramsey/composer-install@v2"
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
|
||||
|
||||
- name: Configure git user
|
||||
run: |
|
||||
git config --global user.email "alain.schlesser@gmail.com"
|
||||
git config --global user.name "Alain Schlesser"
|
||||
|
||||
- name: Check if remote branch exists
|
||||
run: echo "REMOTE_BRANCH_EXISTS=$([[ -z $(git ls-remote --heads origin regenerate-readme) ]] && echo "0" || echo "1")" >> $GITHUB_ENV
|
||||
|
||||
- name: Create branch to base pull request on
|
||||
if: env.REMOTE_BRANCH_EXISTS == 0
|
||||
run: |
|
||||
git checkout -b regenerate-readme
|
||||
|
||||
- name: Fetch existing branch to add commits to
|
||||
if: env.REMOTE_BRANCH_EXISTS == 1
|
||||
run: |
|
||||
git fetch --all --prune
|
||||
git checkout regenerate-readme
|
||||
git pull --no-rebase
|
||||
|
||||
- name: Install WP-CLI
|
||||
run: |
|
||||
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar
|
||||
sudo mv wp-cli-nightly.phar /usr/local/bin/wp
|
||||
sudo chmod +x /usr/local/bin/wp
|
||||
|
||||
- name: Regenerate README.md file
|
||||
run: |
|
||||
wp package install "wp-cli/scaffold-package-command:^2"
|
||||
wp scaffold package-readme --branch=${{ github.event.repository.default_branch }} --force .
|
||||
|
||||
- name: Check if there are changes
|
||||
run: echo "CHANGES_DETECTED=$([[ -z $(git status --porcelain) ]] && echo "0" || echo "1")" >> $GITHUB_ENV
|
||||
|
||||
- name: Commit changes
|
||||
if: env.CHANGES_DETECTED == 1
|
||||
run: |
|
||||
git add README.md
|
||||
git commit -m "Regenerate README file - $(date +'%Y-%m-%d')"
|
||||
git push origin regenerate-readme
|
||||
|
||||
- name: Create pull request
|
||||
if: |
|
||||
env.CHANGES_DETECTED == 1 &&
|
||||
env.REMOTE_BRANCH_EXISTS == 0
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
source_branch: regenerate-readme
|
||||
destination_branch: ${{ github.event.repository.default_branch }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
pr_title: Regenerate README file
|
||||
pr_body: "**This is an automated pull-request**\n\nRefreshes the `README.md` file with the latest changes to the docblocks in the source code."
|
||||
pr_reviewer: schlessera
|
||||
pr_label: scope:documentation
|
||||
regenerate-readme:
|
||||
uses: wp-cli/.github/.github/workflows/reusable-regenerate-readme.yml
|
||||
|
|
165
.github/workflows/testing.yml
vendored
165
.github/workflows/testing.yml
vendored
|
@ -7,167 +7,6 @@ on:
|
|||
- main
|
||||
- master
|
||||
|
||||
# Cancels all previous workflow runs for the same branch that have not yet completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name.
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
unit: #-----------------------------------------------------------------------
|
||||
name: Unit test / PHP ${{ matrix.php }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Check out source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check existence of composer.json file
|
||||
id: check_files
|
||||
uses: andstor/file-existence-action@v2
|
||||
with:
|
||||
files: "composer.json, phpunit.xml.dist"
|
||||
|
||||
- name: Set up PHP environment
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '${{ matrix.php }}'
|
||||
coverage: none
|
||||
tools: composer,cs2pr
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install Composer dependencies & cache dependencies
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
uses: "ramsey/composer-install@v2"
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
|
||||
|
||||
- name: Setup problem matcher to provide annotations for PHPUnit
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
|
||||
- name: Run PHPUnit
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: composer phpunit
|
||||
|
||||
functional: #----------------------------------------------------------------------
|
||||
name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }} with MySQL ${{ matrix.mysql }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
|
||||
wp: ['latest']
|
||||
mysql: ['8.0']
|
||||
include:
|
||||
- php: '5.6'
|
||||
wp: 'trunk'
|
||||
mysql: '8.0'
|
||||
- php: '5.6'
|
||||
wp: 'trunk'
|
||||
mysql: '5.7'
|
||||
- php: '5.6'
|
||||
wp: 'trunk'
|
||||
mysql: '5.6'
|
||||
- php: '7.4'
|
||||
wp: 'trunk'
|
||||
mysql: '8.0'
|
||||
- php: '8.0'
|
||||
wp: 'trunk'
|
||||
mysql: '8.0'
|
||||
- php: '8.0'
|
||||
wp: 'trunk'
|
||||
mysql: '5.7'
|
||||
- php: '8.0'
|
||||
wp: 'trunk'
|
||||
mysql: '5.6'
|
||||
- php: '8.1'
|
||||
wp: 'trunk'
|
||||
mysql: '8.0'
|
||||
- php: '5.6'
|
||||
wp: '3.7'
|
||||
mysql: '5.6'
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:${{ matrix.mysql }}
|
||||
ports:
|
||||
- 3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wp_cli_test --entrypoint sh mysql:${{ matrix.mysql }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
|
||||
|
||||
steps:
|
||||
- name: Check out source code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check existence of composer.json & behat.yml files
|
||||
id: check_files
|
||||
uses: andstor/file-existence-action@v2
|
||||
with:
|
||||
files: "composer.json, behat.yml"
|
||||
|
||||
- name: Install Ghostscript
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ghostscript -y
|
||||
|
||||
- name: Set up PHP environment
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '${{ matrix.php }}'
|
||||
extensions: gd, imagick, mysql, zip
|
||||
coverage: none
|
||||
tools: composer
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Change ImageMagick policy to allow pdf->png conversion.
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: |
|
||||
sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
|
||||
|
||||
- name: Install Composer dependencies & cache dependencies
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
uses: "ramsey/composer-install@v2"
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
|
||||
|
||||
- name: Start MySQL server
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: sudo systemctl start mysql
|
||||
|
||||
- name: Configure DB environment
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: |
|
||||
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
|
||||
echo "MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}" >> $GITHUB_ENV
|
||||
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
|
||||
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
|
||||
echo "WP_CLI_TEST_DBNAME=wp_cli_test" >> $GITHUB_ENV
|
||||
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
|
||||
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
|
||||
echo "WP_CLI_TEST_DBHOST=127.0.0.1:${{ job.services.mysql.ports['3306'] }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Prepare test database
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
run: composer prepare-tests
|
||||
|
||||
- name: Check Behat environment
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
env:
|
||||
WP_VERSION: '${{ matrix.wp }}'
|
||||
run: WP_CLI_TEST_DEBUG_BEHAT_ENV=1 composer behat
|
||||
|
||||
- name: Run Behat
|
||||
if: steps.check_files.outputs.files_exists == 'true'
|
||||
env:
|
||||
WP_VERSION: '${{ matrix.wp }}'
|
||||
run: composer behat || composer behat-rerun
|
||||
test:
|
||||
uses: wp-cli/.github/.github/workflows/reusable-testing.yml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue