diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml new file mode 100644 index 000000000..7334743d2 --- /dev/null +++ b/.github/workflows/phpunit-tests.yml @@ -0,0 +1,42 @@ +name: CI - PHPUnit + +on: + push: + branches: [ develop ] + pull_request: + branches: [ master, develop ] + +jobs: + build: + + runs-on: ubuntu-latest + name: PHPUnit tests on PHP ${{ matrix.php-version }} + strategy: + matrix: + php-version: [ '7.1', '7.2', '7.3', '7.4' ] + + container: + image: junaidbhura/wp-tests:php-${{ matrix.php-version }} + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Install WordPress + run: bash bin/install-wp-tests.sh wordpress_test root 'password' mysql + + - name: Run test suite + run: composer tests