diff --git a/.github/workflows/integration-and-unit-tests.yml b/.github/workflows/integration-and-unit-tests.yml new file mode 100644 index 0000000..e1bf733 --- /dev/null +++ b/.github/workflows/integration-and-unit-tests.yml @@ -0,0 +1,74 @@ +name: Integration and Unit Tests + +on: + push: + branches: master + paths: + - '**.php' + - 'phpunit.xml' + - 'composer.json' + - '**.yml' + pull_request: + branches: master + paths: + - '**.php' + - 'phpunit.xml' + - 'composer.json' + - '**.yml' + workflow_dispatch: + +jobs: + testing: + name: WP ${{ matrix.wordpress-version }} + PHP ${{ matrix.php-version }} + MS ${{ matrix.is-multisite }} + Allowed to fail ${{ matrix.allow-failure }} + + runs-on: ubuntu-latest + + services: + mysql: + image: mariadb:latest + ports: + - '3306:3306' + env: + MYSQL_ROOT_PASSWORD: wordpress + MARIADB_INITDB_SKIP_TZINFO: 1 + MYSQL_USER: wordpress + MYSQL_PASSWORD: wordpress + MYSQL_DATABASE: wordpress_test + + strategy: + fail-fast: false + matrix: + include: + - wordpress-version: '5.2.x' + php-version: '7.2' + is-multisite: 0 + allow-failure: false + - wordpress-version: 'latest' + php-version: '7.0' + is-multisite: 0 + allow-failure: false + - wordpress-version: 'latest' + php-version: '8.2' + is-multisite: 0 + allow-failure: false + - wordpress-version: 'nightly' + php-version: '7.0' + is-multisite: 0 + allow-failure: true + - wordpress-version: 'nightly' + php-version: '8.3' + is-multisite: 0 + allow-failure: true + + env: + WP_MULTISITE: ${{ matrix.is-multisite }} + + steps: + - name: Check out the source code + uses: actions/checkout@v3 + + - name: Run PHPUnit tests + uses: polylang/actions/phpunit@main + with: + php-version: ${{ matrix.php-version }} + wordpress-version: ${{ matrix.wordpress-version }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..9003d9f --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,21 @@ +name: Static Analysis + +on: + push: + branches: master + pull_request: + branches: master + workflow_dispatch: + +jobs: + testing: + name: PHPCS and PHPStan + + runs-on: ubuntu-latest + + steps: + - name: Check out the source code + uses: actions/checkout@v3 + + - name: Run PHPCS and PHPStan tests + uses: polylang/actions/static-analysis@main diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 980c534..0000000 --- a/.travis.yml +++ /dev/null @@ -1,78 +0,0 @@ -if: "branch = master" - -language: "php" -os: - - "linux" -dist: "bionic" - -jobs: - include: - - name: "PHPCS + PHPStan - PHP 7.4" - php: "7.4" - env: "WP_VERSION=latest WP_MULTISITE=0" - install: - - "composer update" - script: - - "vendor/bin/phpcs" - - "vendor/bin/phpstan analyze --memory-limit=512M" - - - name: "WP 5.2 - PHP 7.2" - php: "7.2" - env: "WP_VERSION=5.2 WP_MULTISITE=0" - - - name: "WP latest - PHP 7.0" - dist: "xenial" - php: "7.0" - env: "WP_VERSION=latest WP_MULTISITE=0" - - - name: "WP latest - PHP 8.2" - php: "8.2" - env: "WP_VERSION=latest WP_MULTISITE=0" - - - name: "WP nightly - PHP 7.0" - dist: "xenial" - php: "7.0" - env: "WP_VERSION=nightly WP_MULTISITE=0" - - - name: "WP nightly - PHP 8.2" - php: "8.2" - env: "WP_VERSION=nightly WP_MULTISITE=0" - - allow_failures: - - dist: "xenial" - php: "7.0" - env: "WP_VERSION=nightly WP_MULTISITE=0" - - - php: "8.2" - env: "WP_VERSION=nightly WP_MULTISITE=0" - -services: - - "mysql" - -cache: - directories: - - "${HOME}/.composer/cache" - -before_install: - - "phpenv config-rm xdebug.ini" - - "export PATH=\"$(composer config --absolute --global bin-dir):${PATH}\"" - -install: - - | - if [[ $WP_VERSION == "5.2" ]]; then - composer require --no-interaction --no-update --ignore-platform-reqs --dev "phpunit/phpunit ^7.5" - fi - - composer remove --no-interaction --no-update --dev "phpstan/phpstan" - - composer remove --no-interaction --no-update --dev "wpsyntex/polylang-phpstan" - - "composer update" - - "bash tests/bin/install-wp-tests.sh wordpress_test root \"\" localhost \"${WP_VERSION}\"" - -script: - - "vendor/bin/phpunit --verbose" - -notifications: - email: - on_success: "never" - on_failure: "change" - - diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 90d18d0..ac788b8 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -1,7 +1,7 @@