Internal: Parallel smoke testing #12332
Workflow file for this run
This file contains 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
# This workflow is especially helpful for pull requests to quickly see if the other tests will definitely fail. | |
# In order to get even quicker feedback, we also ping our Continuous Integration server to get a status check | |
# as soon as we know the outcome, as the GitHub Actions Pull Request UI takes a little bit to update. | |
name: 🔥 Parallel Smoke Tests | |
on: | |
pull_request: | |
jobs: | |
run-smoke-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
path: src | |
- name: Validate composer.json and composer.lock | |
run: | | |
cd src && composer validate --strict --no-check-all | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: src/vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install Composer Dependencies | |
run: | | |
cd src && composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Prepare test directories | |
run: | | |
cp -R src unit_tests | |
cp -R src feature_tests | |
mv src/.git . | |
- name: Execute Tests in Parallel | |
run: | | |
# Function to run tests | |
run_tests() { | |
local suite=$1 | |
local testsuite=$2 | |
cd ${suite}_tests | |
vendor/bin/pest --colors=always --stop-on-failure --testsuite="$testsuite" 2>&1 | sed -E "s/^/[${suite^^}] /" | |
} | |
# Run tests in parallel and combine output | |
(run_tests unit UnitFramework) & | |
(run_tests feature "FeatureHyde,FeatureFramework,Publications,Realtime Compiler") & | |
# Wait for all background jobs to finish | |
wait | |
- name: Create JUnit XML | |
run: | | |
echo '<?xml version="1.0" encoding="UTF-8"?> | |
<testsuites> | |
<testsuite name="All Tests" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="0"> | |
<testcase name="Smoke Tests" assertions="1" time="0"/> | |
</testsuite> | |
</testsuites>' > report.xml | |
- name: Ping statistics server with test results | |
run: | | |
curl https://raw.githubusercontent.com/hydephp/develop/6e9d17f31879f4ccda13a3fec4029c9663bccec0/monorepo/scripts/ping-openanalytics-testrunner.php -o ping.php | |
php ping.php "Monorepo Smoke Tests" ${{ secrets.OPENANALYTICS_TOKEN }} ${{ github.ref_name }} |