Skip to content

Instantly share code, notes, and snippets.

@imgerson
Last active November 27, 2020 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imgerson/8b3a981ed4257bd702d3dfb3a09150b2 to your computer and use it in GitHub Desktop.
Save imgerson/8b3a981ed4257bd702d3dfb3a09150b2 to your computer and use it in GitHub Desktop.
WC_MEXICO_2020: CI_WordPress
name: CI
# Trigers on new pull requests
on:
push:
branches:
- main
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# Runs PHP coding standards checks.
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information.
# - Logs PHP_CodeSniffer debug information.
# - Runs PHPCS on the full codebase with warnings suppressed.
# - Runs PHPCS on the `tests` directory without warnings suppressed.
# - todo: Configure Slack notifications for failing scans.
phpcs:
name: PHP coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@2.9.0
with:
php-version: '7.3'
coverage: none
tools: composer, cs2pr
- name: Log debug information
run: |
php --version
composer --version
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-suggest --no-progress --no-ansi --no-interaction
echo "vendor/bin" >> $GITHUB_PATH
- name: Log PHPCS debug information
run: phpcs -i
- name: Run PHPCS on all Core files
run: phpcs -qnl --standard=WordPress --report=checkstyle $GITHUB_WORKSPACE | cs2pr
# Run end to end tests
e2e:
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node 12.
# - Installs dependencies.
# - Starts WordPress environment and activate child theme.
# - Runs Cypress test suite.
name: Cypress end to end tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.2
with:
node-version: 12
- name: Install dependencies
run: npm install
- name: Start WordPress environment
run: |
npx wp-env start
npx wp-env run cli wp theme activate mostlydevstuff
- name: Run Cypress tests
run: |
cp cypress.json.example cypress.json
npx cypress run --config video=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment