trying unlighthouse with staging

This commit is contained in:
Firq 2023-07-08 23:07:13 +02:00
parent 9256f1717c
commit 6f9d4c71bb
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20

View file

@ -1,8 +1,8 @@
stages:
- validate
- build
- benchmark
- deploy
- benchmark
- post_deploy
- scripts
@ -48,24 +48,6 @@ build-site:
- public
expire_in: 1 day
unlighthouse:
image: registry.gitlab.com/gitlab-ci-utils/lighthouse:latest
stage: benchmark
when: on_success
except:
- main
- tags
before_script:
- npm install @unlighthouse/cli puppeteer
- mkdir unlighthouse-reports
script:
- serve ./public/ > /dev/null 2>&1 & wait-on http://localhost:9101/
- unlighthouse-ci http://localhost:3000 --site localhost:9101 --budget 75 --build-static --output-path ./unlighthouse-reports
artifacts:
paths:
- unlighthouse-reports
expire_in: 1 day
deploy-site:
stage: deploy
when: on_success
@ -105,6 +87,43 @@ deploy-testing:
- ssh $DEPLOY_USER@$DEPLOY_HOST "find staging -maxdepth 1 -printf '%p\n'; screen -S staging-firq-npx -dm npx serve staging/ -p 9100 -c serve.json"
- echo "Staging environment is up!"
unlighthouse:
image: registry.gitlab.com/gitlab-ci-utils/lighthouse:latest
stage: benchmark
when: on_success
except:
- main
- tags
before_script:
- npm install @unlighthouse/cli puppeteer
- mkdir unlighthouse-reports
script:
- unlighthouse-ci --site staging.firq.dev --budget 75 --build-static --output-path ./unlighthouse-reports
- cp public/serve.json unlighthouse-reports
artifacts:
paths:
- unlighthouse-reports
expire_in: 1 day
unlighthouse-output:
stage: post_deploy
when: on_success
except:
- tags
- main
before_script:
- *ssh_default
script:
- echo "Getting artifacts"
- ls unlighthouse-reports
- echo "Stopping screen session, cleaning"
- ssh $DEPLOY_USER@$DEPLOY_HOST "screen -X -S unlighthouse-results kill; rm -r -f unlighthouse/*;"
- echo "Copying to proxmox machine"
- rsync -az --stats unlighthouse-reports/* $DEPLOY_USER@$DEPLOY_HOST:~/unlighthouse
- echo "Restarting screen session"
- ssh $DEPLOY_USER@$DEPLOY_HOST "find unlighthouse -maxdepth 1 -printf '%p\n'; screen -S unlighthouse -dm npx serve unlighthouse/ -p 9101 -c serve.json"
- echo "Website is up on https://firq.dev/"
success_notification:
stage: post_deploy
before_script:
@ -178,6 +197,21 @@ redeploy-staging:
- ssh $DEPLOY_USER@$DEPLOY_HOST "screen -S staging-firq-npx -dm npx serve staging/ -p 9100 -c serve.json"
- echo "Staging environment is up!"
redeploy-unlighthouse:
stage: scripts
when: manual
except:
- main
- tags
before_script:
- *ssh_default
script:
- echo "Stopping screen session"
- ssh $DEPLOY_USER@$DEPLOY_HOST "screen -X -S unlighthouse-results kill" || true
- echo "Restarting screen session"
- ssh $DEPLOY_USER@$DEPLOY_HOST "screen -S unlighthouse-results -dm npx serve unlighthouse/ -p 9101 -c serve.json"
- echo "Staging environment is up!"
maintenance-deploy:
stage: scripts
when: manual