Skip to content

SYS-1939: Migrate from travisci to github actions #4

SYS-1939: Migrate from travisci to github actions

SYS-1939: Migrate from travisci to github actions #4

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php: [7.2, 'nightly']
include:
- php: 'nightly'
continue-on-error: true
services:
mariadb:
image: mariadb:10.0
ports:
- 3306
options: --health-cmd="mysqladmin ping"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
env:
WP_PROJECT_TYPE: plugin
WP_VERSION: latest
WP_MULTISITE: 0
WP_TEST_URL: http://localhost:80
WP_TEST_USER: test
WP_TEST_USER_PASS: test
steps:
- uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
extensions: mbstring, xml, ctype, iconv, intl, mysql
ini-values: post_max_size=256M, short_open_tag=On
tools: composer:v2
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y apache2 libapache2-mod-fcgid nodejs mariadb-server
sudo a2enmod rewrite actions fastcgi alias
- name: Configure PHP and Apache
run: |
sudo cp $HOME/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default $HOME/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
echo "cgi.fix_pathinfo = 1" | sudo tee -a $HOME/.phpenv/versions/$(phpenv version-name)/etc/php.ini
sudo $HOME/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# Apache configuration steps
sudo tee /etc/apache2/sites-available/default > /dev/null
sudo service apache2 restart
- name: Composer Global Packages
run: |
COMPOSER_MEMORY_LIMIT=-1 composer global require "codeception/module-asserts"
COMPOSER_MEMORY_LIMIT=-1 composer global require "codeception/codeception"
- name: Setup Tests
run: |
bash ./install-wp-tests.sh test root '' localhost $WP_VERSION
- name: Run tests
run: |
codecept run
- name: Deploy
if: github.ref == 'refs/heads/master'
run: |
sudo chmod +x ./wp-plugin-deploy.sh
./wp-plugin-deploy.sh
- name: Log failure
if: failure()
run: |
sudo cat /var/log/apache2/error.log
cat ./tests/_output/ConfigurePluginCept.fail.html
cat ./tests/_output/CheckLiveSnippetCept.fail.html