基础代码

This commit is contained in:
2021-02-26 22:23:13 +08:00
parent 7884df52f0
commit a719feebba
2585 changed files with 328263 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
* @wp-cli/committers
+11
View File
@@ -0,0 +1,11 @@
<!--
Thanks for creating a new issue!
Found a bug or want to suggest an enhancement? Before completing your issue, please review our best practices: https://make.wordpress.org/cli/handbook/bug-reports/
Need help with something? GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
You can safely delete this comment.
-->
@@ -0,0 +1,16 @@
<!--
Thanks for submitting a pull request!
Please review our contributing guidelines if you haven't recently: https://make.wordpress.org/cli/handbook/contributing/#creating-a-pull-request
Here's an overview to our process:
1. One of the project committers will soon provide a code review: https://make.wordpress.org/cli/handbook/code-review/
2. You are expected to address the code review comments in a timely manner (if we don't hear from you in two weeks, we'll consider your pull request abandoned).
3. Please make sure to include functional tests for your changes.
4. The reviewing committer will merge your pull request as soon as it passes code review (and provided it fits within the scope of the project).
You can safely delete this comment.
-->
+9
View File
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- scope:distribution
+19
View File
@@ -0,0 +1,19 @@
# Configuration for move-issues - https://github.com/dessant/move-issues
# Repository to extend settings from
_extends: wp-cli/wp-cli
# Delete the command comment when it contains no other content
# deleteCommand: true
# Close the source issue after moving
# closeSourceIssue: true
# Lock the source issue after moving
# lockSourceIssue: false
# Mention issue and comment authors
# mentionAuthors: true
# Preserve mentions in the issue content
# keepContentMentions: true
+28
View File
@@ -0,0 +1,28 @@
# Used by Probot Settings: https://probot.github.io/apps/settings/
repository:
description: Provides internationalization tools for WordPress projects.
labels:
- name: bug
color: fc2929
- name: scope:documentation
color: 0e8a16
- name: scope:testing
color: 5319e7
- name: good-first-issue
color: eb6420
- name: help-wanted
color: 159818
- name: maybelater
color: c2e0c6
- name: state:unconfirmed
color: bfe5bf
- name: state:unsupported
color: bfe5bf
- name: wontfix
color: c2e0c6
- name: command:i18n
color: c5def5
- name: command:i18n-make-pot
color: c5def5
- name: command:i18n-make-json
color: c5def5
@@ -0,0 +1,102 @@
name: Code Quality Checks
on: pull_request
jobs:
lint: #-----------------------------------------------------------------------
name: Lint PHP files
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: Check existence of composer.json file
id: check_composer_file
uses: andstor/file-existence-action@v1
with:
files: "composer.json"
- name: Set up PHP envirnoment
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: cs2pr
- name: Get Composer cache Directory
if: steps.check_composer_file.outputs.files_exists == 'true'
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Use Composer cache
if: steps.check_composer_file.outputs.files_exists == 'true'
uses: actions/cache@v1
with:
path: ${{ steps['composer-cache'].outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
if: steps.check_composer_file.outputs.files_exists == 'true'
run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest
- name: Check existence of vendor/bin/parallel-lint file
id: check_linter_file
uses: andstor/file-existence-action@v1
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@v2
- name: Check existence of composer.json & phpcs.xml.dist files
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "composer.json, phpcs.xml.dist"
- name: Set up PHP envirnoment
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: cs2pr
- name: Get Composer cache Directory
if: steps.check_files.outputs.files_exists == 'true'
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Use Composer cache
if: steps.check_files.outputs.files_exists == 'true'
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
if: steps.check_files.outputs.files_exists == 'true'
run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest
- name: Check existence of vendor/bin/phpcs file
id: check_phpcs_binary_file
uses: andstor/file-existence-action@v1
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
+146
View File
@@ -0,0 +1,146 @@
name: Testing
on: pull_request
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']
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: Check existence of composer.json file
id: check_files
uses: andstor/file-existence-action@v1
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
- name: Get Composer cache Directory
if: steps.check_files.outputs.files_exists == 'true'
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Use Composer cache
if: steps.check_files.outputs.files_exists == 'true'
uses: actions/cache@master
with:
path: ${{ steps['composer-cache'].outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
if: steps.check_files.outputs.files_exists == 'true'
run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest
- 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 }}
strategy:
fail-fast: false
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
wp: ['latest']
test: ["composer behat || composer behat-rerun"]
include:
- php: '5.6'
wp: 'trunk'
test: "composer behat || composer behat-rerun"
- php: '7.4'
wp: 'trunk'
test: "composer behat || composer behat-rerun"
- php: '5.6'
wp: '3.7'
test: "composer behat || composer behat-rerun || true"
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: wp_cli_test
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: Check existence of composer.json & behat.yml files
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "composer.json, behat.yml"
- name: Set up PHP envirnoment
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php }}'
extensions: mysql, zip
coverage: none
tools: composer
- name: Get Composer cache Directory
if: steps.check_files.outputs.files_exists == 'true'
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Use Composer cache
if: steps.check_files.outputs.files_exists == 'true'
uses: actions/cache@master
with:
path: ${{ steps['composer-cache'].outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
if: steps.check_files.outputs.files_exists == 'true'
run: COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest
- name: Start MySQL server
if: steps.check_files.outputs.files_exists == 'true'
run: sudo service mysql start
- name: Prepare test database
if: steps.check_files.outputs.files_exists == 'true'
run: |
export MYQSL_HOST=127.0.0.1
export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
- name: Run Behat
if: steps.check_files.outputs.files_exists == 'true'
env:
WP_VERSION: '${{ matrix.wp }}'
run: ${{ matrix.test }}