diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2682392 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,71 @@ +name: CI + +on: + pull_request: + push: + branches: [production] + +jobs: + phpcs: + name: PHP CodeSniffer + + runs-on: ubuntu-latest + + steps: + - name: composer install + run: | + composer install + + - name: Lint PHP + run: | + touch ./tmp.php + CHANGED_FILES=$(git diff --name-only --diff-filter=AM ${{ github.base_ref }} | tr '\n' ' ') + composer run-script phpcs ./tmp.php $(echo $CHANGED_FILES) -- -n + + phpunit: + name: PHP Unit Tests + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php-version: ['7.4'] # 8.0 -- Add back to matrix when 8.0 is supported. + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: false + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: wcorg_test + ports: + - 3306/tcp + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - uses: actions/checkout@v2 + + - name: Set PHP version + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: none + tools: composer:v1 + + - name: Start mysql service + run: sudo /etc/init.d/mysql start + + - name: Install dependencies + run: composer install + + - name: Install WordPress + run: | + bash .docker/bin/install-wp-tests.sh wporg_5ftf_test root root 127.0.0.1 trunk + + - name: Install required plugins + run: | + svn export https://plugins.svn.wordpress.org/jetpack/trunk public_html/wp-content/plugins/jetpack + + - name: Running unit tests + run: composer run-script test -- -c phpunit.xml.dist diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5dcc85c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -sudo: required -dist: trusty -language: php -php: 7.2 -env: WP_VERSION=latest WP_MULTISITE=1 WP_CORE_DIR=/tmp/wordpress - -install: - - bash bin/install-wp-tests.sh wporg_5ftf_test root '' localhost $WP_VERSION - - composer install - -script: - - composer run-script test -- --version - - composer run-script test -- -c phpunit.xml.dist - - touch $TRAVIS_BUILD_DIR/tmp.php - - export CHANGED_FILES=$(git diff --name-only --diff-filter=AM $TRAVIS_BRANCH...HEAD | tr '\n' ' ') - - composer run-script phpcs $TRAVIS_BUILD_DIR/tmp.php $(echo $CHANGED_FILES) -- -n