-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CMS-319] Add Github Actions support (#107)
* Add Github Actions support - Convert TravisCI to Github Actions - Convert PHAR generation to use Box - Remove (now) unused prep scripts - Add release workflow (WIP) * Remove unused TravisCI / CircleCI config, remove console output * Update description * Add release workflow * Testing release * Add release asset * Try new changelog action
- Loading branch information
1 parent
c2b33ee
commit 6994197
Showing
12 changed files
with
294 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: Deploy and Release | ||
on: | ||
push: | ||
tags: ["v[0-9]+.[0-9]+.[0-9]+*"] | ||
|
||
jobs: | ||
validate: | ||
name: "Run validation test suite" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: ["7.2", "7.3", "7.4"] | ||
env: | ||
# GITHUB_CONTEXT: ${{ toJson(github) }} | ||
PANTHEON_WPVULNDB_API_TOKEN: ${{ secrets.PANTHEON_WPVULNDB_API_TOKEN }} | ||
WP_CLI_BIN_DIR: /tmp/wp-cli-phar | ||
DB_NAME: pantheon | ||
DB_USER: pantheon | ||
DB_PASSWORD: pantheon | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_DATABASE: ${{ env.DB_NAME }} | ||
MYSQL_HOST: 127.0.0.1 | ||
MYSQL_USER: ${{ env.DB_USER }} | ||
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }} | ||
MYSQL_ROOT_PASSWORD: rootpass | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=5 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
ini-values: post_max_size=256M, max_execution_time=120 | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache Composer Downloads | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Cache PHP dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Install composer dependencies | ||
run: | | ||
composer --no-interaction --no-progress --prefer-dist install | ||
- name: Install WP-CLI | ||
run: | | ||
# The Behat test suite will pick up the executable found in $WP_CLI_BIN_DIR | ||
mkdir -p $WP_CLI_BIN_DIR | ||
curl -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > $WP_CLI_BIN_DIR/wp | ||
chmod +x $WP_CLI_BIN_DIR/wp | ||
- name: Generate Phar | ||
run: | | ||
php -dphar.readonly=0 vendor/bin/box build -v | ||
- name: Run Behat tests | ||
run: | | ||
vendor/bin/behat --ansi | ||
- name: Archive phar | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wp-launch-check-phar | ||
path: wp_launch_check.phar | ||
retention-days: 5 | ||
|
||
deploy-packages: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
needs: [validate] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download Phar | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: wp-launch-check-phar | ||
|
||
- name: Generate changelog | ||
id: changelog | ||
uses: metcalfc/[email protected] | ||
with: | ||
myToken: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body: | | ||
${{ steps.changelog.outputs.changelog }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./wp_launch_check.phar | ||
asset_name: wp_launch_check.phar | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Behat tests | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
validate: | ||
name: "Run validation test suite" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: ["7.2", "7.3", "7.4"] | ||
env: | ||
# GITHUB_CONTEXT: ${{ toJson(github) }} | ||
PANTHEON_WPVULNDB_API_TOKEN: ${{ secrets.PANTHEON_WPVULNDB_API_TOKEN }} | ||
WP_CLI_BIN_DIR: /tmp/wp-cli-phar | ||
DB_NAME: pantheon | ||
DB_USER: pantheon | ||
DB_PASSWORD: pantheon | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_DATABASE: ${{ env.DB_NAME }} | ||
MYSQL_HOST: 127.0.0.1 | ||
MYSQL_USER: ${{ env.DB_USER }} | ||
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }} | ||
MYSQL_ROOT_PASSWORD: rootpass | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=5 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
ini-values: post_max_size=256M, max_execution_time=120 | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache Composer Downloads | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Cache PHP dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }} | ||
|
||
- name: Install composer dependencies | ||
run: | | ||
composer --no-interaction --no-progress --prefer-dist install | ||
- name: Install WP-CLI | ||
run: | | ||
# The Behat test suite will pick up the executable found in $WP_CLI_BIN_DIR | ||
mkdir -p $WP_CLI_BIN_DIR | ||
curl -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > $WP_CLI_BIN_DIR/wp | ||
chmod +x $WP_CLI_BIN_DIR/wp | ||
- name: Generate Phar | ||
run: | | ||
php -dphar.readonly=0 vendor/bin/box build -v | ||
- name: Run Behat tests | ||
run: | | ||
vendor/bin/behat --ansi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) { | ||
echo "Error: wp_launch_check can only be loaded by WP-CLI. Use `wp --require=wp_launch_check.phar`" . PHP_EOL; | ||
exit(1); | ||
} | ||
|
||
Phar::mapPhar(); | ||
require 'phar://' . __FILE__ . '/php/commands/launchcheck.php'; | ||
|
||
__HALT_COMPILER(); | ||
?> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"main": "php/commands/launchcheck.php", | ||
"output": "wp_launch_check.phar", | ||
"finder": [ | ||
{ | ||
"name": "*.php", | ||
"exclude": ["test", "tests", "Tests"], | ||
"in": "php" | ||
} | ||
], | ||
"stub": ".wp_launch_check.stub" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
{ | ||
"name": "pantheon-systems/wp_launch_check", | ||
"description": "Check against a WordPress for performance and security", | ||
"type": "wp-cli-package", | ||
"license": "MIT", | ||
"authors": [], | ||
"minimum-stability": "dev", | ||
"autoload": { | ||
"files": [ "php/commands/launchcheck.php" ] | ||
}, | ||
"require": {}, | ||
"require-dev": { | ||
"symfony/finder": "~2.3", | ||
"behat/behat": "~2.5" | ||
} | ||
"name": "pantheon-systems/wp_launch_check", | ||
"description": "Performs performance and security checks for WordPress.", | ||
"type": "wp-cli-package", | ||
"license": "MIT", | ||
"authors": [], | ||
"minimum-stability": "stable", | ||
"autoload": { | ||
"files": [ | ||
"php/commands/launchcheck.php" | ||
] | ||
}, | ||
"require-dev": { | ||
"humbug/box": "^2", | ||
"behat/behat": "^2" | ||
} | ||
} |
Oops, something went wrong.