From 6f9d4c71bb880dffe5bcb0b131e010d290384c56 Mon Sep 17 00:00:00 2001 From: Firq Date: Sat, 8 Jul 2023 23:07:13 +0200 Subject: [PATCH] trying unlighthouse with staging --- .gitlab-ci.yml | 72 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbdc4a9..0f38576 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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