diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 27eae18..f0e673b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,6 +28,7 @@ test: script: - npm install snyk && npm run snyk # Refer to "scripts" in package.json - npm run build # Generate site + - sh check-homepage.sh # Homepage should exists and non-empty after_script: - rsync -azvh --delete public/ host-1:/var/www/ diff --git a/check-homepage.sh b/check-homepage.sh new file mode 100644 index 0000000..37e9e36 --- /dev/null +++ b/check-homepage.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +## Homepage should exists and non-empty + +HOMEPAGE="public/index.html" + +if [ ! -f "$HOMEPAGE" ]; then + echo "Error: homepage doesn't exist" + exit 1 +else + FILE_SIZE=$(ls -s "$HOMEPAGE" | cut -d" " -f1) + if [ "$FILE_SIZE" = 0 ]; then + echo "Error: homepage is empty" + exit 1 + fi +fi