From 4fb0b9c8e703205eb630b6c77532b85e416fc729 Mon Sep 17 00:00:00 2001 From: taxidis <16354616+taxidis@users.noreply.github.com> Date: Mon, 3 Jun 2024 13:35:19 +0300 Subject: [PATCH] Create php.yml workflow --- .github/workflows/php.yml | 93 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..fe6305a --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,93 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + php: [7.2] + include: + - php: 'nightly' + continue-on-error: true + + services: + mariadb: + image: mariadb:10.0 + ports: + - 3306: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 php-fpm mariadb-client-10.3 mariadb-client + sudo a2enmod rewrite actions fcgid alias proxy_fcgi setenvif + sudo a2enconf php7.2-fpm + sudo mysql -h mariadb -e '\q' + sudo echo "Exit code was: $?" + + - name: Composer Global Packages + run: | + composer self-update + COMPOSER_MEMORY_LIMIT=-1 composer global require "codeception/module-asserts" + COMPOSER_MEMORY_LIMIT=-1 composer global require "codeception/codeception" + + - name: Configure PHP and Apache + run: | + echo "cgi.fix_pathinfo = 1" | sudo tee -a /etc/php/7.2/fpm/php.ini + # Apache configuration steps + cd .. + echo "$(curl -fsSL https://gist.github.com/matthewjackowski/b772ab278efb0e6f30ad/raw/travisci-apache)" | sed -e "s,%TRAVIS_BUILD_DIR%,`pwd`/wordpress,g" | sudo tee /etc/apache2/sites-available/default > /dev/null + cat /etc/apache2/sites-available/default + cd transifex-live-wordpress + git clone https://github.com/Seravo/wordpress-test-template wordpress-test-template + echo "$(curl -fsSL https://gist.githubusercontent.com/matthewjackowski/3b26061241545564ae8d/raw/install-wp-tests.sh)" | sudo tee ./install-wp-tests.sh > /dev/null + bash ./install-wp-tests.sh test root '' localhost $WP_VERSION + sudo service apache2 restart + sudo service php7.2-fpm restart + + + - 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