Felipe Dalcin
4 years ago
2 changed files with 106 additions and 68 deletions
@ -0,0 +1,106 @@ |
|||||||
|
name: CI workflow |
||||||
|
on: |
||||||
|
push: |
||||||
|
branches: [ dev, main, pba-751-jQueryUpgrade ] |
||||||
|
tags: |
||||||
|
- '*.*.*' |
||||||
|
pull_request: |
||||||
|
branches: [ dev ] |
||||||
|
jobs: |
||||||
|
tests: |
||||||
|
runs-on: ${{ matrix.os }} |
||||||
|
strategy: |
||||||
|
matrix: |
||||||
|
php: [ 7.3 ] |
||||||
|
os: [ ubuntu-18.04 ] |
||||||
|
wordpress: [ 5.6.2, 5.7.2 ] |
||||||
|
|
||||||
|
name: Test - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }} |
||||||
|
|
||||||
|
env: |
||||||
|
WP_VERSION: ${{ matrix.wordpress }} |
||||||
|
WP_MULTISITE: 1 |
||||||
|
|
||||||
|
steps: |
||||||
|
- name: Checkout code |
||||||
|
uses: actions/checkout@v2 |
||||||
|
|
||||||
|
- name: Install Node |
||||||
|
uses: actions/setup-node@v2 |
||||||
|
with: |
||||||
|
node-version: '10' |
||||||
|
|
||||||
|
- name: Install OS dependencies |
||||||
|
run: sudo apt-get install libxml2-utils ghostscript poppler-utils |
||||||
|
|
||||||
|
- name: Start required services |
||||||
|
run: sudo systemctl start mysql.service |
||||||
|
|
||||||
|
- name: Cache PHP dependencies |
||||||
|
uses: actions/cache@v1 |
||||||
|
with: |
||||||
|
path: vendor |
||||||
|
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} |
||||||
|
|
||||||
|
- name: Setup PHP |
||||||
|
uses: shivammathur/setup-php@v2 |
||||||
|
with: |
||||||
|
php-version: ${{ matrix.php }} |
||||||
|
tools: phpcs, composer:v1 |
||||||
|
coverage: pcov |
||||||
|
|
||||||
|
- name: Install dependencies |
||||||
|
run: | |
||||||
|
node -v |
||||||
|
npm install -g lerna |
||||||
|
npm install |
||||||
|
npm run bootstrap |
||||||
|
npm run install-build-tools |
||||||
|
lerna run install-build-tools |
||||||
|
export PATH="$HOME/.composer/vendor/bin:$PATH" |
||||||
|
composer install --no-interaction |
||||||
|
composer global require "phpunit/phpunit:7.5.20" |
||||||
|
- name: Run Lint |
||||||
|
run: composer standards |
||||||
|
|
||||||
|
- name: Install WP tests |
||||||
|
run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }} |
||||||
|
|
||||||
|
- name: Run Coverage |
||||||
|
run: composer require pcov/clobber; vendor/bin/pcov clobber; vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml |
||||||
|
|
||||||
|
- name: Run Frontend Tests |
||||||
|
run: | |
||||||
|
npm run test |
||||||
|
lerna run test |
||||||
|
- name: Run PHP Tests |
||||||
|
run: vendor/bin/phpunit |
||||||
|
|
||||||
|
- name: Upload Coverage to Codecov |
||||||
|
run: bash <(curl -s https://codecov.io/bash) |
||||||
|
|
||||||
|
- name: Prepare Build |
||||||
|
if: startsWith(github.ref, 'refs/tags/') |
||||||
|
run: | |
||||||
|
export GITHUB_BUILD_PATH=${{github.workspace}} |
||||||
|
export GITHUB_REPO_SLUG="$(basename ${{github.workspace}})" |
||||||
|
export GITHUB_TAG="$(basename ${{github.ref}})" |
||||||
|
echo "File to be created : $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip" |
||||||
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar |
||||||
|
chmod +x wp-cli.phar |
||||||
|
mv wp-cli.phar /usr/local/bin/wp |
||||||
|
wp package install wp-cli/dist-archive-command |
||||||
|
npm run build:production |
||||||
|
composer install --no-dev --optimize-autoloader |
||||||
|
cd .. |
||||||
|
wp dist-archive $GITHUB_REPO_SLUG $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip |
||||||
|
cd $GITHUB_BUILD_PATH |
||||||
|
ls $GITHUB_BUILD_PATH |
||||||
|
- name: Deploy |
||||||
|
if: startsWith(github.ref, 'refs/tags/') |
||||||
|
uses: softprops/action-gh-release@v1 |
||||||
|
env: |
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
||||||
|
with: |
||||||
|
files: |
||||||
|
${{github.workspace}}/*.zip |
@ -1,68 +0,0 @@ |
|||||||
dist: bionic |
|
||||||
services: |
|
||||||
- mysql |
|
||||||
language: php |
|
||||||
sudo: required |
|
||||||
|
|
||||||
notifications: |
|
||||||
email: |
|
||||||
on_success: never |
|
||||||
on_failure: change |
|
||||||
slack: |
|
||||||
secure: EN5LZc4Ba3w48Nb9Xdh6WITgUf0qphkb3ZEDxTrBSfaSZuHAOqhQ2dDdfT8ds1vBkGTE80JVGXa2YDNDIyqK8JY1mR3V3MzeZMWLwfspPQj0/t8g/GFzc99M87dIEPZofCvj/CoRVGNG3rghe8TftAcf233rKvTSWtbADOvmfq6v/cedeh4/W1DgkrA5dcmTwpqyoOLzWbSXEMpwUxHfX88UHxNO2+IS9nvVXNf2CJ8C2dltEbRwFfKB20b/jIXvjgrmR9T2Al9M5qWXjpewssEU4hcEP8gPETx1l0VbIqq182ar9I2OKjmIYLuaVvgSp56TnPs+DBPnUOVDQZ3ykdXH8mzzPT9IhChZJEYMz+D0l9Jb6saWhqxzDMJ30fXt67HYgCO6kWfCZOpefwukoOZC7bZtnL98s0qTYHL5nt+h7+522XDAm8B5a0sKzvnV7IF30YlPdt/eHkEQF14954x4yGZO2Q3M0kR6I/roaJ4HQh1P2h0yswyRucIHFgGd4f1QQ64VOpUyJ4rNybVfcAn/zPuXjcjucxmNbyrf7vk8kCgCfF11ejO0aSYzjVjO+jE5Edkur9kmRbwMcc+HOb79eZhPT9ISMo8Bz/QhbbvCOlSDgagGrP3h+Zy17JIYmHJJJojdANjMtu9tf7sUrfTza6+r46Thnuwpxf+kdbM= |
|
||||||
branches: |
|
||||||
only: |
|
||||||
- dev |
|
||||||
- hotfix |
|
||||||
- "/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$/" |
|
||||||
php: |
|
||||||
- 7.3 |
|
||||||
env: |
|
||||||
- TRAVIS_NODE_VERSION="10" |
|
||||||
matrix: |
|
||||||
allow_failures: |
|
||||||
- php: nightly |
|
||||||
cache: |
|
||||||
apt: true |
|
||||||
directories: |
|
||||||
- "$HOME/.composer/cache" |
|
||||||
- node_modules |
|
||||||
- vendor |
|
||||||
before_install: |
|
||||||
- composer self-update 1.10.17 |
|
||||||
- source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION && nvm use $TRAVIS_NODE_VERSION |
|
||||||
install: |
|
||||||
- node -v |
|
||||||
- npm install |
|
||||||
- composer install -o --prefer-dist --no-interaction |
|
||||||
before_script: |
|
||||||
- if php -v | grep -q 'Xdebug'; then phpenv config-rm xdebug.ini; fi |
|
||||||
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.3" ]]; then pecl install pcov; fi |
|
||||||
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION |
|
||||||
script: |
|
||||||
- npm run install-build-tools |
|
||||||
- npm run test |
|
||||||
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.3" ]]; then composer require pcov/clobber; vendor/bin/pcov clobber; vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml; fi |
|
||||||
- if [[ ${TRAVIS_PHP_VERSION:0:3} != "7.3" ]]; then vendor/bin/phpunit --configuration phpunit.xml; fi |
|
||||||
- composer standards |
|
||||||
after_success: |
|
||||||
- bash <(curl -s https://codecov.io/bash) |
|
||||||
before_deploy: |
|
||||||
- export TRAVIS_PROJECT_SLUG="$(basename $TRAVIS_BUILD_DIR)" |
|
||||||
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar |
|
||||||
- chmod +x wp-cli.phar |
|
||||||
- sudo mv wp-cli.phar /usr/local/bin/wp |
|
||||||
- wp package install wp-cli/dist-archive-command |
|
||||||
- npm run build:production |
|
||||||
- composer install --no-dev --optimize-autoloader |
|
||||||
- cd ../ |
|
||||||
- wp dist-archive $TRAVIS_PROJECT_SLUG $TRAVIS_BUILD_DIR/$TRAVIS_PROJECT_SLUG-$TRAVIS_TAG.zip |
|
||||||
- cd $TRAVIS_BUILD_DIR |
|
||||||
deploy: |
|
||||||
provider: releases |
|
||||||
skip_cleanup: true |
|
||||||
api_key: $GITHUB_ACCESS_TOKEN |
|
||||||
file: pressbooks-aldine-$TRAVIS_TAG.zip |
|
||||||
on: |
|
||||||
tags: true |
|
||||||
repo: pressbooks/pressbooks-aldine |
|
Loading…
Reference in new issue