diff --git a/.github/scripts/get_plugin_slug.sh b/.github/scripts/get_plugin_slug.sh index 2035c0f1..3244bd4a 100644 --- a/.github/scripts/get_plugin_slug.sh +++ b/.github/scripts/get_plugin_slug.sh @@ -5,13 +5,14 @@ set -e BASE_SHA="$1" HEAD_SHA="$2" -git fetch --prune --unshallow 2>/dev/null || git fetch --prune +# The checkout's blobless history covers this diff, and --no-renames stops git from +# fetching blobs to detect renames. # Get changed files in plugins subdirectories if [ "$BASE_SHA" = "main" ]; then - CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep '^plugins/[^/]\+/' || true) + CHANGED_FILES=$(git diff --no-renames --name-only HEAD~1 HEAD | grep '^plugins/[^/]\+/' || true) else - CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep '^plugins/[^/]\+/' || true) + CHANGED_FILES=$(git diff --no-renames --name-only "$BASE_SHA" "$HEAD_SHA" | grep '^plugins/[^/]\+/' || true) fi if [ -z "$CHANGED_FILES" ]; then diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index ddcd46e2..98485eb5 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -28,6 +28,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # get_plugin_slug.sh diffs against history, so fetch all of it without file contents. + fetch-depth: 0 + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: Get changed plugin directory id: plugin @@ -83,6 +92,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: PHP Code Quality for ${{ matrix.plugin }} uses: ./.github/actions/code-quality diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index 4ed93c04..65a30721 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -34,6 +34,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # get_plugin_slug.sh diffs against history, so fetch all of it without file contents. + fetch-depth: 0 + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: Get changed plugin directory id: plugin @@ -88,6 +97,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: ${{ matrix.plugin }} codeception tests uses: ./.github/actions/codeception with: diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index fb25003a..3c3a689b 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -36,6 +36,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # get_plugin_slug.sh diffs against history, so fetch all of it without file contents. + fetch-depth: 0 + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: Get changed plugin directory id: plugin @@ -82,6 +91,13 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: Setup Node.js uses: actions/setup-node@v4 @@ -104,8 +120,10 @@ jobs: composer-options: '--no-progress --optimize-autoloader --no-dev' - name: Install playwright browsers - # Use the locked @playwright/test, and only Chromium since that's all the config runs - run: pnpm exec playwright install --with-deps chromium + # Use the locked @playwright/test, and only Chromium since that's all the config runs. + # Skip --with-deps because the runner image has Chromium's libraries and its apt + # step has hung for up to 40 minutes. + run: pnpm exec playwright install chromium working-directory: plugins/${{ env.PLUGIN }} - name: Start wp-env @@ -116,7 +134,3 @@ jobs: - name: Run Playwright tests run: pnpm test:e2e working-directory: plugins/${{ env.PLUGIN }} - - - name: Stop wp-env - run: pnpm wp-env stop - working-directory: plugins/${{ env.PLUGIN }} diff --git a/.github/workflows/plugin-artifact-for-pr.yml b/.github/workflows/plugin-artifact-for-pr.yml index 227fea6d..e770bbf1 100644 --- a/.github/workflows/plugin-artifact-for-pr.yml +++ b/.github/workflows/plugin-artifact-for-pr.yml @@ -18,6 +18,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # get_plugin_slug.sh diffs against history, so fetch all of it without file contents. + fetch-depth: 0 + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: Get changed plugin directories id: plugin @@ -39,6 +48,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: Create plugin artifact for ${{ matrix.plugin }} uses: ./.github/actions/create-plugin-artifact diff --git a/.github/workflows/plugin-check.yml b/.github/workflows/plugin-check.yml index ec9f00e8..94fa121a 100644 --- a/.github/workflows/plugin-check.yml +++ b/.github/workflows/plugin-check.yml @@ -32,6 +32,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # get_plugin_slug.sh diffs against history, so fetch all of it without file contents. + fetch-depth: 0 + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: Get changed plugin directories id: plugin @@ -74,6 +83,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. + filter: blob:none + sparse-checkout-cone-mode: false + sparse-checkout: | + /* + !**/wp-env/uploads.zip - name: Setup PHP and install production dependencies uses: ./.github/actions/setup-php-composer