diff --git a/.github/workflows/ci-test-a11y.yml b/.github/workflows/ci-test-a11y.yml index bec5f51..6e7af9f 100644 --- a/.github/workflows/ci-test-a11y.yml +++ b/.github/workflows/ci-test-a11y.yml @@ -78,6 +78,17 @@ jobs: BUILD_COMMAND: ${{ inputs.build-command || 'npm run build:prod' }} run: bash -eo pipefail -c "$BUILD_COMMAND" + # wp-env keeps WordPress core and the PHPUnit test library under WP_ENV_HOME + # (default ~/.wp-env) and bind-mounts them into its containers. On self-hosted + # runners whose Docker daemon runs in a separate container (ARC with dind), only + # the work directory is shared with the daemon, so mounts from ~ come up empty and + # PHPUnit fails to load /wordpress-phpunit. RUNNER_TEMP is inside the work + # directory on every runner type, and the runner sets it, so writing it to + # $GITHUB_ENV is safe. + - name: Keep wp-env files in the runner work directory + shell: bash + run: echo "WP_ENV_HOME=$RUNNER_TEMP/wp-env" >> "$GITHUB_ENV" + - name: Start wp-env run: npm run wp-env start diff --git a/.github/workflows/ci-test-build-artifact.yml b/.github/workflows/ci-test-build-artifact.yml index c4c5735..2215b5e 100644 --- a/.github/workflows/ci-test-build-artifact.yml +++ b/.github/workflows/ci-test-build-artifact.yml @@ -147,6 +147,17 @@ jobs: echo "Generated .wp-env.override.json:" cat .wp-env.override.json + # wp-env keeps WordPress core and the PHPUnit test library under WP_ENV_HOME + # (default ~/.wp-env) and bind-mounts them into its containers. On self-hosted + # runners whose Docker daemon runs in a separate container (ARC with dind), only + # the work directory is shared with the daemon, so mounts from ~ come up empty and + # PHPUnit fails to load /wordpress-phpunit. RUNNER_TEMP is inside the work + # directory on every runner type, and the runner sets it, so writing it to + # $GITHUB_ENV is safe. + - name: Keep wp-env files in the runner work directory + shell: bash + run: echo "WP_ENV_HOME=$RUNNER_TEMP/wp-env" >> "$GITHUB_ENV" + - name: Start wp-env shell: bash run: | diff --git a/.github/workflows/ci-test-php.yml b/.github/workflows/ci-test-php.yml index a460f76..28e2812 100644 --- a/.github/workflows/ci-test-php.yml +++ b/.github/workflows/ci-test-php.yml @@ -139,6 +139,18 @@ jobs: esac echo "WP_ENV_CORE=$core" | tee -a "$GITHUB_ENV" + # wp-env keeps WordPress core and the PHPUnit test library under WP_ENV_HOME + # (default ~/.wp-env) and bind-mounts them into its containers. On self-hosted + # runners whose Docker daemon runs in a separate container (ARC with dind), only + # the work directory is shared with the daemon, so mounts from ~ come up empty and + # PHPUnit fails to load /wordpress-phpunit. RUNNER_TEMP is inside the work + # directory on every runner type, and the runner sets it, so writing it to + # $GITHUB_ENV is safe. + - name: Keep wp-env files in the runner work directory + if: ${{ inputs.use-wp-env }} + shell: bash + run: echo "WP_ENV_HOME=$RUNNER_TEMP/wp-env" >> "$GITHUB_ENV" + - name: Start wp-env if: ${{ inputs.use-wp-env }} run: npm run wp-env start