Advertisement
Guest User

autosetup.sh

a guest
Apr 7th, 2020
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.60 KB | None | 0 0
  1. # Install Dependencies
  2. #- apt-get update && apt-get install -y unzip zlib1g-dev libzip-dev nodejs npm git wget
  3. #- docker-php-ext-install zip
  4. # Install Composer
  5. #- curl -sS https://getcomposer.org/installer -o composer-setup.php
  6. #- php composer-setup.php --install-dir=/usr/local/bin --filename=composer
  7. # Install Composer dependencies.
  8. if [[ ( "$SNIFF" == "1" ) || ( "$UNIT" == "1" ) || ( "$INTEGRATION" == "1" ) ]]; then
  9.   composer install --no-progress;
  10. fi
  11.  
  12. # Install NPM dependencies.
  13. #- |
  14. #  if [[ ( "$SNIFF" == "1" ) || ( "$TEST_GULP" == "1" ) ]]; then
  15. #    npm install --no-progress;
  16. #  fi
  17. # Speed up build time by disabling Xdebug.
  18. #- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
  19.  
  20. # Pull in the WP Core jshint rules.
  21. if [[ "$SNIFF" == "1" ]]; then
  22.   wget https://develop.svn.wordpress.org/trunk/.jshintrc;
  23. fi
  24.  
  25. # Setup WordPress core test suite for integration.
  26. if [[ "$INTEGRATION" == "1" ]]; then
  27.   service mysql start
  28.   if [[ "$WP_VERSION" == "latest" ]]; then
  29.     curl -s http://api.wordpress.org/core/version-check/1.7/ > /tmp/wp-latest.json
  30.     WP_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
  31.   fi
  32.   THEME_SLUG=$(basename $(pwd))
  33.   export WP_DEVELOP_DIR=/tmp/wordpress/
  34.   git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
  35.   cd ..
  36.   cp -r "$THEME_SLUG" "/tmp/wordpress/src/wp-content/themes/$THEME_SLUG"
  37.   cd /tmp/wordpress/
  38.   cp wp-tests-config-sample.php wp-tests-config.php
  39.   sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
  40.   sed -i "s/yourusernamehere/travis/" wp-tests-config.php
  41.   sed -i "s/yourpasswordhere//" wp-tests-config.php
  42.   mysql -e "CREATE DATABASE wordpress_tests;" -uroot
  43.   cd "/tmp/wordpress/src/wp-content/themes/$THEME_SLUG"
  44. fi
  45.  
  46. # After setup you should refresh your path.
  47. # - phpenv rehash;
  48.  
  49. # Search for PHP syntax errors.
  50. find -L . -name '*.php' ! -path "*/vendor/*" -print0 | xargs -0 -n 1 -P 4 php -l
  51.  
  52. # Check the theme against WordPress Coding Standards.
  53. if [[ "$SNIFF" == "1" ]]; then
  54.   composer run-script phpcs-dev
  55. fi
  56.  
  57. # Run the theme through JavaScript Code Style checker.
  58. if [[ "$SNIFF" == "1" ]]; then
  59.   /usr/local/bin/eslint --resolve-plugins-relative-to=/usr/local/lib/node_modules .;
  60. fi
  61.  
  62. # Run the unit tests.
  63. if [[ "$UNIT" == "1" ]]; then
  64.   composer run-script phpunit-dev
  65. fi
  66.  
  67. # Run the integration tests.
  68. if [[ "$INTEGRATION" == "1" ]]; then
  69.   composer run-script phpunit-integration-dev
  70. fi
  71.  
  72. # Run the gulp tests.
  73. if [[ "$TEST_GULP" == "1" ]]; then
  74.   npm install --no-progress gulp
  75.   npm run lint:gulp
  76.   npm run test:gulp
  77. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement