mirror of
https://ghproxy.net/https://github.com/wp-cli/scaffold-package-command.git
synced 2025-08-20 22:57:27 +08:00
Add GH actions in scaffold package test
This commit is contained in:
parent
195ccb100a
commit
f73d47a030
3 changed files with 58 additions and 1 deletions
|
@ -174,6 +174,7 @@ WP-CLI Behat framework uses Behat ~2.5, which is installed with Composer.
|
|||
options:
|
||||
- travis
|
||||
- circle
|
||||
- github
|
||||
---
|
||||
|
||||
[--force]
|
||||
|
|
52
dot-github/workflows/testing.yml
Normal file
52
dot-github/workflows/testing.yml
Normal file
|
@ -0,0 +1,52 @@
|
|||
name: Testing
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
behat:
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['8.0', '7.4']
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||
MYSQL_DATABASE: wp_cli_test
|
||||
MYSQL_USER: wp_cli_test
|
||||
MYSQL_PASSWORD: password1
|
||||
MYSQL_HOST: 127.0.0.1
|
||||
ports:
|
||||
- 3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
|
||||
steps:
|
||||
- name: Check out source code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
tools: composer
|
||||
|
||||
- name: Install composer packages
|
||||
run: composer install
|
||||
|
||||
- name: Run Behat
|
||||
run: composer run behat
|
||||
env:
|
||||
WP_CLI_TEST_DBUSER: wp_cli_test
|
||||
WP_CLI_TEST_DBPASS: password1
|
||||
WP_CLI_TEST_DBNAME: wp_cli_test
|
||||
WP_CLI_TEST_DBHOST: 127.0.0.1:${{ job.services.mysql.ports[3306] }}
|
|
@ -635,6 +635,7 @@ EOT;
|
|||
* options:
|
||||
* - travis
|
||||
* - circle
|
||||
* - github
|
||||
* ---
|
||||
*
|
||||
* [--force]
|
||||
|
@ -695,6 +696,9 @@ EOT;
|
|||
}
|
||||
} elseif ( 'circle' === $assoc_args['ci'] ) {
|
||||
$copy_source[ $package_root ]['.circleci/config.yml'] = $package_dir . '.circleci/';
|
||||
} elseif ( 'github' === $assoc_args['ci'] ) {
|
||||
$copy_source[ $package_root ]['dot-github/workflows/testing.yml'] = $package_dir . '.github/workflows/';
|
||||
$copy_source[ $package_root ]['behat.yml'] = $package_dir;
|
||||
}
|
||||
|
||||
$files_written = [];
|
||||
|
@ -729,7 +733,7 @@ EOT;
|
|||
$files_written[] = $file_path;
|
||||
|
||||
if ( ! is_dir( dirname( $file_path ) ) ) {
|
||||
Process::create( Utils\esc_cmd( 'mkdir %s', dirname( $file_path ) ) )->run();
|
||||
Process::create( Utils\esc_cmd( 'mkdir -p %s', dirname( $file_path ) ) )->run();
|
||||
}
|
||||
|
||||
Process::create( Utils\esc_cmd( 'touch %s', $file_path ) )->run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue