From 91bb5e2fd41f3fb0080d6b0faa9ccb026518e6f2 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Mon, 26 Jul 2021 11:34:15 -0500 Subject: [PATCH] Add a basic SSR test to GitHub CI --- .github/workflows/build.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c856e8f5fe..6f4a11acc8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,5 +117,28 @@ jobs: chromedriver --url-base='/wd/hub' --port=4444 & yarn run e2e:ci + # Start up the app with SSR enabled (run in background) + - name: Start app in SSR (server-side rendering) mode + run: | + nohup yarn run serve:ssr & + printf 'Waiting for app to start' + until curl --output /dev/null --silent --head --fail http://localhost:4000/home; do + printf '.' + sleep 2 + done + echo "App started successfully." + + # Get homepage and verify that the tag includes "DSpace". + # If it does, then SSR is working, as this tag is created by our MetadataService. + # This step also prints entire HTML of homepage for easier debugging if grep fails. + - name: Verify SSR (server-side rendering) + run: | + result=$(wget -O- -q http://localhost:4000/home) + echo "$result" + echo "$result" | grep -oE "]*>" | grep DSpace + + - name: Stop running app + run: kill -9 $(lsof -t -i:4000) + - name: Shutdown Docker containers run: docker-compose -f ./docker/docker-compose-ci.yml down