Merge branch 'feature/unlighthouse' into 'main'

Unlighthouse reporting

See merge request Firq/fgosite!5
This commit is contained in:
Firq 2023-07-08 22:25:38 +00:00
commit 399ff91af4
3 changed files with 67 additions and 1 deletions

View file

@ -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

View file

@ -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
```

12
unlighthouse.config.ts Normal file
View file

@ -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",
}