Skip to content

Commit dba263b

Browse files
committed
Update file(s) from wp-cli/.github
1 parent 6a6d50f commit dba263b

File tree

3 files changed

+8
-337
lines changed

3 files changed

+8
-337
lines changed

.github/workflows/code-quality.yml

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -7,87 +7,6 @@ on:
77
- main
88
- master
99

10-
# Cancels all previous workflow runs for the same branch that have not yet completed.
11-
concurrency:
12-
# The concurrency group contains the workflow name and the branch name.
13-
group: ${{ github.workflow }}-${{ github.ref }}
14-
cancel-in-progress: true
15-
1610
jobs:
17-
18-
lint: #-----------------------------------------------------------------------
19-
name: Lint PHP files
20-
runs-on: ubuntu-latest
21-
steps:
22-
- name: Check out source code
23-
uses: actions/checkout@v3
24-
25-
- name: Check existence of composer.json file
26-
id: check_composer_file
27-
uses: andstor/file-existence-action@v2
28-
with:
29-
files: "composer.json"
30-
31-
- name: Set up PHP environment
32-
if: steps.check_composer_file.outputs.files_exists == 'true'
33-
uses: shivammathur/setup-php@v2
34-
with:
35-
php-version: '7.4'
36-
tools: cs2pr
37-
env:
38-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
40-
- name: Install Composer dependencies & cache dependencies
41-
if: steps.check_composer_file.outputs.files_exists == 'true'
42-
uses: "ramsey/composer-install@v2"
43-
env:
44-
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
45-
46-
- name: Check existence of vendor/bin/parallel-lint file
47-
id: check_linter_file
48-
uses: andstor/file-existence-action@v2
49-
with:
50-
files: "vendor/bin/parallel-lint"
51-
52-
- name: Run Linter
53-
if: steps.check_linter_file.outputs.files_exists == 'true'
54-
run: vendor/bin/parallel-lint -j 10 . --exclude vendor --checkstyle | cs2pr
55-
56-
phpcs: #----------------------------------------------------------------------
57-
name: PHPCS
58-
runs-on: ubuntu-latest
59-
60-
steps:
61-
- name: Check out source code
62-
uses: actions/checkout@v3
63-
64-
- name: Check existence of composer.json & phpcs.xml.dist files
65-
id: check_files
66-
uses: andstor/file-existence-action@v2
67-
with:
68-
files: "composer.json, phpcs.xml.dist"
69-
70-
- name: Set up PHP environment
71-
if: steps.check_files.outputs.files_exists == 'true'
72-
uses: shivammathur/setup-php@v2
73-
with:
74-
php-version: '7.4'
75-
tools: cs2pr
76-
env:
77-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
79-
- name: Install Composer dependencies & cache dependencies
80-
if: steps.check_files.outputs.files_exists == 'true'
81-
uses: "ramsey/composer-install@v2"
82-
env:
83-
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
84-
85-
- name: Check existence of vendor/bin/phpcs file
86-
id: check_phpcs_binary_file
87-
uses: andstor/file-existence-action@v2
88-
with:
89-
files: "vendor/bin/phpcs"
90-
91-
- name: Run PHPCS
92-
if: steps.check_phpcs_binary_file.outputs.files_exists == 'true'
93-
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
11+
code-quality:
12+
uses: wp-cli/.github/.github/workflows/reusable-code-quality.yml@85be2d1b154ddf1b2f03166c93bc75a27fb3daf1

.github/workflows/regenerate-readme.yml

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -7,96 +7,9 @@ on:
77
- main
88
- master
99
paths-ignore:
10-
- 'features/**'
11-
- 'README.md'
12-
13-
# Cancels all previous workflow runs for the same branch that have not yet completed.
14-
concurrency:
15-
# The concurrency group contains the workflow name and the branch name.
16-
group: ${{ github.workflow }}-${{ github.ref }}
17-
cancel-in-progress: true
18-
10+
- "features/**"
11+
- "README.md"
1912

2013
jobs:
21-
22-
regenerate-readme: #----------------------------------------------------------
23-
name: Regenerate README.md file
24-
runs-on: ubuntu-latest
25-
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) }}
26-
steps:
27-
- name: Check out source code
28-
uses: actions/checkout@v3
29-
30-
- name: Set up PHP envirnoment
31-
uses: shivammathur/setup-php@v2
32-
with:
33-
php-version: '7.4'
34-
env:
35-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
37-
- name: Check existence of composer.json file
38-
id: check_composer_file
39-
uses: andstor/file-existence-action@v2
40-
with:
41-
files: "composer.json"
42-
43-
- name: Install Composer dependencies & cache dependencies
44-
if: steps.check_composer_file.outputs.files_exists == 'true'
45-
uses: "ramsey/composer-install@v2"
46-
env:
47-
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
48-
49-
- name: Configure git user
50-
run: |
51-
git config --global user.email "alain.schlesser@gmail.com"
52-
git config --global user.name "Alain Schlesser"
53-
54-
- name: Check if remote branch exists
55-
run: echo "REMOTE_BRANCH_EXISTS=$([[ -z $(git ls-remote --heads origin regenerate-readme) ]] && echo "0" || echo "1")" >> $GITHUB_ENV
56-
57-
- name: Create branch to base pull request on
58-
if: env.REMOTE_BRANCH_EXISTS == 0
59-
run: |
60-
git checkout -b regenerate-readme
61-
62-
- name: Fetch existing branch to add commits to
63-
if: env.REMOTE_BRANCH_EXISTS == 1
64-
run: |
65-
git fetch --all --prune
66-
git checkout regenerate-readme
67-
git pull --no-rebase
68-
69-
- name: Install WP-CLI
70-
run: |
71-
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar
72-
sudo mv wp-cli-nightly.phar /usr/local/bin/wp
73-
sudo chmod +x /usr/local/bin/wp
74-
75-
- name: Regenerate README.md file
76-
run: |
77-
wp package install "wp-cli/scaffold-package-command:^2"
78-
wp scaffold package-readme --branch=${{ github.event.repository.default_branch }} --force .
79-
80-
- name: Check if there are changes
81-
run: echo "CHANGES_DETECTED=$([[ -z $(git status --porcelain) ]] && echo "0" || echo "1")" >> $GITHUB_ENV
82-
83-
- name: Commit changes
84-
if: env.CHANGES_DETECTED == 1
85-
run: |
86-
git add README.md
87-
git commit -m "Regenerate README file - $(date +'%Y-%m-%d')"
88-
git push origin regenerate-readme
89-
90-
- name: Create pull request
91-
if: |
92-
env.CHANGES_DETECTED == 1 &&
93-
env.REMOTE_BRANCH_EXISTS == 0
94-
uses: repo-sync/pull-request@v2
95-
with:
96-
source_branch: regenerate-readme
97-
destination_branch: ${{ github.event.repository.default_branch }}
98-
github_token: ${{ secrets.GITHUB_TOKEN }}
99-
pr_title: Regenerate README file
100-
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."
101-
pr_reviewer: schlessera
102-
pr_label: scope:documentation
14+
regenerate-readme:
15+
uses: wp-cli/.github/.github/workflows/reusable-regenerate-readme.yml@85be2d1b154ddf1b2f03166c93bc75a27fb3daf1

.github/workflows/testing.yml

Lines changed: 2 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -7,167 +7,6 @@ on:
77
- main
88
- master
99

10-
# Cancels all previous workflow runs for the same branch that have not yet completed.
11-
concurrency:
12-
# The concurrency group contains the workflow name and the branch name.
13-
group: ${{ github.workflow }}-${{ github.ref }}
14-
cancel-in-progress: true
15-
1610
jobs:
17-
18-
unit: #-----------------------------------------------------------------------
19-
name: Unit test / PHP ${{ matrix.php }}
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
24-
runs-on: ubuntu-20.04
25-
26-
steps:
27-
- name: Check out source code
28-
uses: actions/checkout@v3
29-
30-
- name: Check existence of composer.json file
31-
id: check_files
32-
uses: andstor/file-existence-action@v2
33-
with:
34-
files: "composer.json, phpunit.xml.dist"
35-
36-
- name: Set up PHP environment
37-
if: steps.check_files.outputs.files_exists == 'true'
38-
uses: shivammathur/setup-php@v2
39-
with:
40-
php-version: '${{ matrix.php }}'
41-
coverage: none
42-
tools: composer,cs2pr
43-
env:
44-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
46-
- name: Install Composer dependencies & cache dependencies
47-
if: steps.check_files.outputs.files_exists == 'true'
48-
uses: "ramsey/composer-install@v2"
49-
env:
50-
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
51-
52-
- name: Setup problem matcher to provide annotations for PHPUnit
53-
if: steps.check_files.outputs.files_exists == 'true'
54-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
55-
56-
- name: Run PHPUnit
57-
if: steps.check_files.outputs.files_exists == 'true'
58-
run: composer phpunit
59-
60-
functional: #----------------------------------------------------------------------
61-
name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }} with MySQL ${{ matrix.mysql }}
62-
strategy:
63-
fail-fast: false
64-
matrix:
65-
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
66-
wp: ['latest']
67-
mysql: ['8.0']
68-
include:
69-
- php: '5.6'
70-
wp: 'trunk'
71-
mysql: '8.0'
72-
- php: '5.6'
73-
wp: 'trunk'
74-
mysql: '5.7'
75-
- php: '5.6'
76-
wp: 'trunk'
77-
mysql: '5.6'
78-
- php: '7.4'
79-
wp: 'trunk'
80-
mysql: '8.0'
81-
- php: '8.0'
82-
wp: 'trunk'
83-
mysql: '8.0'
84-
- php: '8.0'
85-
wp: 'trunk'
86-
mysql: '5.7'
87-
- php: '8.0'
88-
wp: 'trunk'
89-
mysql: '5.6'
90-
- php: '8.1'
91-
wp: 'trunk'
92-
mysql: '8.0'
93-
- php: '5.6'
94-
wp: '3.7'
95-
mysql: '5.6'
96-
runs-on: ubuntu-20.04
97-
98-
services:
99-
mysql:
100-
image: mysql:${{ matrix.mysql }}
101-
ports:
102-
- 3306
103-
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"
104-
105-
steps:
106-
- name: Check out source code
107-
uses: actions/checkout@v3
108-
109-
- name: Check existence of composer.json & behat.yml files
110-
id: check_files
111-
uses: andstor/file-existence-action@v2
112-
with:
113-
files: "composer.json, behat.yml"
114-
115-
- name: Install Ghostscript
116-
if: steps.check_files.outputs.files_exists == 'true'
117-
run: |
118-
sudo apt-get update
119-
sudo apt-get install ghostscript -y
120-
121-
- name: Set up PHP environment
122-
if: steps.check_files.outputs.files_exists == 'true'
123-
uses: shivammathur/setup-php@v2
124-
with:
125-
php-version: '${{ matrix.php }}'
126-
extensions: gd, imagick, mysql, zip
127-
coverage: none
128-
tools: composer
129-
env:
130-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131-
132-
- name: Change ImageMagick policy to allow pdf->png conversion.
133-
if: steps.check_files.outputs.files_exists == 'true'
134-
run: |
135-
sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
136-
137-
- name: Install Composer dependencies & cache dependencies
138-
if: steps.check_files.outputs.files_exists == 'true'
139-
uses: "ramsey/composer-install@v2"
140-
env:
141-
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
142-
143-
- name: Start MySQL server
144-
if: steps.check_files.outputs.files_exists == 'true'
145-
run: sudo systemctl start mysql
146-
147-
- name: Configure DB environment
148-
if: steps.check_files.outputs.files_exists == 'true'
149-
run: |
150-
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
151-
echo "MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}" >> $GITHUB_ENV
152-
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
153-
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
154-
echo "WP_CLI_TEST_DBNAME=wp_cli_test" >> $GITHUB_ENV
155-
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
156-
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
157-
echo "WP_CLI_TEST_DBHOST=127.0.0.1:${{ job.services.mysql.ports['3306'] }}" >> $GITHUB_ENV
158-
159-
- name: Prepare test database
160-
if: steps.check_files.outputs.files_exists == 'true'
161-
run: composer prepare-tests
162-
163-
- name: Check Behat environment
164-
if: steps.check_files.outputs.files_exists == 'true'
165-
env:
166-
WP_VERSION: '${{ matrix.wp }}'
167-
run: WP_CLI_TEST_DEBUG_BEHAT_ENV=1 composer behat
168-
169-
- name: Run Behat
170-
if: steps.check_files.outputs.files_exists == 'true'
171-
env:
172-
WP_VERSION: '${{ matrix.wp }}'
173-
run: composer behat || composer behat-rerun
11+
test:
12+
uses: wp-cli/.github/.github/workflows/reusable-testing.yml@85be2d1b154ddf1b2f03166c93bc75a27fb3daf1

0 commit comments

Comments
 (0)