mirror of https://gitlab.com/curben/blog
ci: Homepage should exists and non-empty
This commit is contained in:
parent
edcadaade0
commit
c0d8e6001e
|
@ -28,6 +28,7 @@ test:
|
||||||
script:
|
script:
|
||||||
- npm install snyk && npm run snyk # Refer to "scripts" in package.json
|
- npm install snyk && npm run snyk # Refer to "scripts" in package.json
|
||||||
- npm run build # Generate site
|
- npm run build # Generate site
|
||||||
|
- sh check-homepage.sh # Homepage should exists and non-empty
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- rsync -azvh --delete public/ host-1:/var/www/
|
- rsync -azvh --delete public/ host-1:/var/www/
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue