From d1276042d923e895de2ce35f4f588357b41fc266 Mon Sep 17 00:00:00 2001 From: Itoh Shimon Date: Wed, 2 Feb 2022 20:26:40 +0900 Subject: [PATCH] dump. --- .gitignore | 2 ++ LICENSE.txt | 21 +++++++++++++++++++++ README.md | 10 ++++++++++ Vagrantfile | 24 ++++++++++++++++++++++++ start-forgeperf | 29 +++++++++++++++++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 Vagrantfile create mode 100755 start-forgeperf diff --git a/.gitignore b/.gitignore index e69de29..2e26538 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +/.vagrant +/vagrant_data diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..b26989b --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Itoh Shimon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..29d8334 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# forgeperf CI + +## Build + +``` +vagrant up +vagrant ssh -c start-forgeperf +vagrant halt +vagrant destroy +``` diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..d6d658d --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,24 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "bento/ubuntu-20.04" + + config.vm.synced_folder "vagrant_data", "/vagrant_data", create: true + + config.vm.provider "virtualbox" do |vb| + vb.cpus = 4 + vb.memory = "8192" + end + + config.vm.provision "file", + source: "start-forgeperf", + destination: "/home/vagrant/bin/start-forgeperf" + + config.vm.provision "shell", inline: <<-SHELL + set -eu + apt-get update + apt-get install -y chromium-browser golang xvfb x11-xserver-utils npm git + npm install -g lighthouse@6.3.0 + SHELL +end diff --git a/start-forgeperf b/start-forgeperf new file mode 100755 index 0000000..ad23206 --- /dev/null +++ b/start-forgeperf @@ -0,0 +1,29 @@ +#! /bin/bash + +set -eux + +cd ~ + +git clone --depth 1 https://git.sr.ht/~shimon/forgeperf +mkdir -p .config/configstore +echo '{"isErrorReportingEnabled": false}' > .config/configstore/lighthouse.json + +cd ~/forgeperf + +go build -o forgeperf main.go +export DISPLAY=:0 +Xvfb :0 & +count=5 +for i in $(seq $count); do + if xset q > /dev/null; then + echo "xvfb is alive." + break + fi + if [ $i -eq $count ]; then + echo "xvfb has timed out." + exit 1 + fi + sleep 1 +done +./forgeperf +tar cvzf /vagrant_data/report.tar.gz report/* -- 2.45.2