33# 2. Runs Playwright E2E tests on those plugins using the custom action
44# 3. Creates a matrix job for each plugin that has a quality configuration
55# Bonus: This means you can have plugin specific badges e.g.
6- # [](https://github.com/wpengine/hwptoolkit/actions)
6+ # [](https://github.com/wpengine/hwptoolkit/actions)
77
88
99name : End-to-End Tests
2424 - " plugins/**"
2525
2626jobs :
27- detect-plugins :
27+ detect-plugin :
2828 runs-on : ubuntu-latest
29- name : Detect plugins with E2E tests
29+ name : Detect plugin with E2E tests
3030 outputs :
31- plugins : ${{ steps.detect.outputs.plugins }}
32- has-plugins : ${{ steps.detect.outputs.has-plugins }}
31+ plugin : ${{ steps.detect.outputs.plugin }}
32+ has-plugin : ${{ steps.detect.outputs.has-plugin }}
3333 steps :
3434 - name : Checkout
3535 uses : actions/checkout@v4
@@ -39,38 +39,36 @@ jobs:
3939 run : |
4040 bash .github/scripts/get-plugin-slug.sh ${{ github.event.pull_request.base.sha }} ${{ github.sha }}
4141
42- - name : Detect changed plugins with E2E config
42+ - name : Detect changed plugin with E2E config
4343 id : detect
4444 run : |
4545 if [ -z "${{ steps.plugin.outputs.slug }}" ]; then
4646 echo "No plugin slug detected"
47- echo "plugins=[] " >> $GITHUB_OUTPUT
48- echo "has-plugins =false" >> $GITHUB_OUTPUT
47+ echo "plugin= " >> $GITHUB_OUTPUT
48+ echo "has-plugin =false" >> $GITHUB_OUTPUT
4949 exit 0
5050 fi
5151
5252 PLUGIN="${{ steps.plugin.outputs.slug }}"
5353
5454 # Check for .wp-env.json file in the plugin directory
5555 if [ -f "plugins/$PLUGIN/.wp-env.json" ]; then
56- echo "plugins=[\" $PLUGIN\"] " >> $GITHUB_OUTPUT
57- echo "has-plugins =true" >> $GITHUB_OUTPUT
56+ echo "plugin= $PLUGIN" >> $GITHUB_OUTPUT
57+ echo "has-plugin =true" >> $GITHUB_OUTPUT
5858 echo "✅ Found .wp-env.json for plugin: $PLUGIN"
5959 else
60- echo "plugins=[] " >> $GITHUB_OUTPUT
61- echo "has-plugins =false" >> $GITHUB_OUTPUT
60+ echo "plugin= " >> $GITHUB_OUTPUT
61+ echo "has-plugin =false" >> $GITHUB_OUTPUT
6262 echo "ℹ️ No .wp-env.json found for plugin: $PLUGIN, skipping E2E tests"
6363 fi
6464
6565 playwright-e2e-tests :
66- needs : detect-plugins
67- if : needs.detect-plugins .outputs.has-plugins == 'true'
66+ needs : detect-plugin
67+ if : needs.detect-plugin .outputs.has-plugin == 'true'
6868 runs-on : ubuntu-24.04
69- strategy :
70- matrix :
71- plugin : ${{ fromJson(needs.detect-plugins.outputs.plugins) }}
72- fail-fast : false
73- name : ${{ matrix.plugin }} Playwright E2E Tests
69+ name : ${{ needs.detect-plugin.outputs.plugin }} Playwright E2E Tests
70+ env :
71+ PLUGIN : ${{ needs.detect-plugin.outputs.plugin }}
7472 steps :
7573 - name : Checkout code
7674 uses : actions/checkout@v4
@@ -83,27 +81,27 @@ jobs:
8381
8482 - name : Install dependencies
8583 run : npm ci
86- working-directory : plugins/${{ matrix.plugin }}
84+ working-directory : plugins/${{ env.PLUGIN }}
8785
8886 - name : Setup PHP with Cached Composer
8987 uses : ./.github/actions/setup-php-composer
9088 with :
9189 php-version : 8.2
92- working-directory : plugins/${{ matrix.plugin }}
90+ working-directory : plugins/${{ env.PLUGIN }}
9391 composer-options : ' --no-progress --optimize-autoloader --no-dev'
9492
95- - name : Install playwright browsers
93+ - name : Install playwright browsers (${{ env.PLUGIN }})
9694 run : npx playwright install --with-deps
97- working-directory : plugins/${{ matrix.plugin }}
95+ working-directory : plugins/${{ env.PLUGIN }}
9896
99- - name : Start wp-env
97+ - name : Start wp-env (${{ env.PLUGIN }})
10098 run : npm run wp-env start
101- working-directory : plugins/${{ matrix.plugin }}
99+ working-directory : plugins/${{ env.PLUGIN }}
102100
103- - name : Run Playwright tests
101+ - name : Run Playwright tests (${{ env.PLUGIN }})
104102 run : npm run test:e2e
105- working-directory : plugins/${{ matrix.plugin }}
103+ working-directory : plugins/${{ env.PLUGIN }}
106104
107- - name : Stop wp-env
105+ - name : Stop wp-env (${{ env.PLUGIN }})
108106 run : npm run wp-env stop
109- working-directory : plugins/${{ matrix.plugin }}
107+ working-directory : plugins/${{ env.PLUGIN }}
0 commit comments