From 251d6f06273efe0b9260643e3fb75829c15e60be Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 16 Jun 2023 14:33:14 +0100 Subject: [PATCH] DEV: Introduce Zeitwerk reloading check in CI (#22151) This should help us to catch the most catastrophic cases where plugins fail to auto-reload in development mode. --- .github/workflows/tests.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b6cbd383a15..b96dcd6b171 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -156,7 +156,7 @@ jobs: key: rspec-runtime-${{ matrix.build_type }}-${{ matrix.target }}-${{ github.run_id }} restore-keys: rspec-runtime-${{ matrix.build_type }}-${{ matrix.target }}- - - name: Run Zeitwerk check + - name: Check Zeitwerk eager_load if: matrix.build_type == 'backend' env: LOAD_PLUGINS: ${{ (matrix.target == 'plugins') && '1' || '0' }} @@ -172,6 +172,21 @@ jobs: exit 1 fi + - name: Check Zeitwerk reloading + if: matrix.build_type == 'backend' + env: + LOAD_PLUGINS: ${{ (matrix.target == 'plugins') && '1' || '0' }} + run: | + if ! bin/rails runner 'Rails.application.reloader.reload!'; then + echo + echo "---------------------------------------------" + echo + echo "::error::Zeitwerk reload failed - the app will not be able to reload properly in development." + echo "To reproduce locally, run \`bin/rails runner 'Rails.application.reloader.reload!'\`." + echo + exit 1 + fi + - name: Core RSpec if: matrix.build_type == 'backend' && matrix.target == 'core' run: bin/turbo_rspec --use-runtime-info --verbose