Fix workflow errors #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| push: | |
| branches: | |
| - main | |
| name: PHPUnit | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-20.04 | |
| env: | |
| WP_MULTISITE: ${{ matrix.multisite }} | |
| strategy: | |
| matrix: | |
| include: | |
| - php: 7.4 | |
| wordpress: trunk | |
| multisite: 0 | |
| - php: 8.0 | |
| wordpress: trunk | |
| multisite: 0 | |
| name: PHP ${{ matrix.php }} tests in WP ${{ matrix.wordpress }} | |
| steps: | |
| - uses: actions/checkout@v3.5.0 | |
| # get the PHP version | |
| - uses: shivammathur/setup-php@2.24.0 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| tools: phpunit-polyfills | |
| - name: Installing WordPress | |
| run: | | |
| export WP_DEVELOP_DIR=/tmp/wordpress/ | |
| git clone --depth=1 --branch="${{ matrix.wordpress }}" git://develop.git.wordpress.org/ /tmp/wordpress | |
| cd .. | |
| cp -r "${GITHUB_REPOSITORY#*/}" "/tmp/wordpress/src/wp-content/plugins/cool-kids-network" | |
| cd /tmp/wordpress/ | |
| pwd | |
| cp wp-tests-config-sample.php wp-tests-config.php | |
| sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php | |
| sed -i "s/yourusernamehere/root/" wp-tests-config.php | |
| sed -i "s/yourpasswordhere/root/" wp-tests-config.php | |
| - name: Creating database | |
| run: | | |
| sudo /etc/init.d/mysql start | |
| mysql -u root -proot -e "CREATE DATABASE wordpress_tests;" | |
| - name: PhpUnit tests | |
| run: | | |
| cd "/tmp/wordpress/src/wp-content/plugins/cool-kids-network" | |
| composer install && composer dumpautoload -o | |
| phpunit --coverage-clover=coverage.xml | |
| - name: Send code coverage report to Codecov.io | |
| uses: codecov/codecov-action@v2 | |
| with: | |
| files: /tmp/wordpress/src/wp-content/plugins/cool-kids-network/coverage.xml |