Add screenshots #5
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
| name: Test Plugin | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup PHP (for composer build) | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.1' | |
| tools: composer | |
| - name: Install composer dependencies | |
| run: composer install --optimize-autoloader | |
| - name: Execute the Composer lint script | |
| run: composer run-script lint | |
| - name: Build prefixed vendor | |
| run: composer run build | |
| - name: Install wp-playground CLI | |
| run: npm install -g @wp-playground/cli | |
| - name: Start wp-playground with blueprint | |
| run: | | |
| echo "Starting wp-playground server in background..." | |
| PLUGIN_PATH=$(realpath .) | |
| echo "Plugin path: $PLUGIN_PATH" | |
| npx @wp-playground/cli server --mount="$PLUGIN_PATH:/wordpress/wp-content/plugins/post-content-to-markdown" --blueprint=blueprint.json & | |
| WP_PID=$! | |
| echo $WP_PID > wp-playground.pid | |
| echo "Started with PID: $WP_PID" | |
| # Wait for wp-playground to be ready | |
| echo "Waiting for wp-playground to start..." | |
| for i in {1..30}; do | |
| if curl -s http://localhost:9400 > /dev/null; then | |
| echo "wp-playground is ready!" | |
| break | |
| fi | |
| echo "Waiting... ($i/30)" | |
| sleep 2 | |
| done | |
| - name: Wait for WordPress | |
| run: | | |
| # Wait for WordPress to be ready | |
| sleep 10 | |
| - name: Run Pest tests | |
| run: composer run test | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| if [ -f wp-playground.pid ]; then | |
| kill $(cat wp-playground.pid) || true | |
| fi |