diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b26e06..b838571 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ stages: - validate - build - deploy + - benchmark - post_deploy - scripts @@ -86,6 +87,45 @@ 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: manual + except: + - main + - tags + before_script: + - npm install @unlighthouse/cli puppeteer + - mkdir unlighthouse-reports + script: + - node_modules/.bin/unlighthouse-ci + - cp public/serve.json unlighthouse-reports + artifacts: + paths: + - unlighthouse-reports + expire_in: 1 day + +unlighthouse-publish: + stage: benchmark + when: on_success + needs: + - unlighthouse + 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 "Unlighthouse results are up!" + success_notification: stage: post_deploy before_script: @@ -159,6 +199,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 diff --git a/src/pages/blog/deploying-this.md b/src/pages/blog/deploying-this.md index c636c1a..55c5458 100644 --- a/src/pages/blog/deploying-this.md +++ b/src/pages/blog/deploying-this.md @@ -209,7 +209,6 @@ Funnily enough, this also taught me how to squash commits on main, as I had like ```shell git rebase -i origin/main~30 main -# do the rebase here git push origin +main ``` diff --git a/unlighthouse.config.ts b/unlighthouse.config.ts new file mode 100644 index 0000000..fbd6208 --- /dev/null +++ b/unlighthouse.config.ts @@ -0,0 +1,12 @@ +export default { + site: 'staging.firq.dev', + puppeteerOptions: { + args: ["--no-sandbox", "--disable-setuid-sandbox"], + }, + ci: { + budget: 90, + buildStatic: true + }, + auth: { username: "staging", password: "staging" }, + outputPath: "unlighthouse-reports", +}