diff --git a/cmd/tools/fast/.gitignore b/cmd/tools/fast/.gitignore index 93fbd4b95c..1afc939cbd 100644 --- a/cmd/tools/fast/.gitignore +++ b/cmd/tools/fast/.gitignore @@ -4,3 +4,8 @@ table.html v.c v2 fast.log + +website/ + +fast.vlang.io/ +docs.vlang.io/ diff --git a/cmd/tools/fast/fast.v b/cmd/tools/fast/fast.v index 66f6dce592..0faba1d929 100644 --- a/cmd/tools/fast/fast.v +++ b/cmd/tools/fast/fast.v @@ -4,6 +4,7 @@ import os import time import arrays +import log const warmup_samples = 2 @@ -25,7 +26,7 @@ fn elog(msg string) { f.write_string(line) or {} f.close() } - eprint(line) + log.info(msg) } fn lsystem(cmd string) int { @@ -74,8 +75,8 @@ fn main() { // fetch the last commit's hash commit := lexec('git rev-parse HEAD')[..8] - if os.exists('website/index.html') { - uploaded_index := os.read_file('website/index.html')! + if os.exists('fast.vlang.io/index.html') { + uploaded_index := os.read_file('fast.vlang.io/index.html')! if uploaded_index.contains('>${commit}<') { elog('NOTE: commit ${commit} had been benchmarked already.') if !os.args.contains('-force') { @@ -159,13 +160,28 @@ fn main() { // upload the result to github pages if os.args.contains('-upload') { - elog('uploading...') - os.chdir('website')! + os.chdir('${fast_dir}/fast.vlang.io/')! + elog('Uploading to fast.vlang.io/ ...') lexec('git checkout gh-pages') os.mv('../index.html', 'index.html')! - lsystem('git commit -am "update benchmark for commit ${commit}"') + elog(' adding changes...') + lsystem('git commit -am "update fast.vlang.io for commit ${commit}"') + elog(' pushing...') lsystem('git push origin gh-pages') - elog('uploading done') + elog('uploading to fast.vlang.io/ done') + os.chdir(fast_dir)! + + os.chdir('${fast_dir}/docs.vlang.io/')! + elog('Uploading to docs.vlang.io/ ...') + elog(' running build.vsh...') + lexec('${vdir}/vprod run build.vsh') + elog(' adding changes...') + lsystem('git add .') + lsystem('git commit -am "update docs for commit ${commit}"') + elog(' pushing...') + lsystem('git push') + elog('uploading to fast.vlang.io/ done') + os.chdir(fast_dir)! } } diff --git a/cmd/tools/fast/fast_job.v b/cmd/tools/fast/fast_job.v index f226b57ee7..0bae3f4907 100644 --- a/cmd/tools/fast/fast_job.v +++ b/cmd/tools/fast/fast_job.v @@ -34,9 +34,13 @@ fn main() { elog('fast_job end') } - if !os.exists('website') { - println('cloning the website repo...') - os.system('git clone --filter=blob:none git@github.com:/vlang/website.git') + if !os.exists('fast.vlang.io/') { + println('cloning the fast.vlang.io/ repo...') + os.system('git clone git@github.com:/vlang/website.git fast.vlang.io/') + } + if !os.exists('docs.vlang.io') { + println('cloning the docs.vlang.io/ repo...') + os.system('git clone git@github.com:/vlang/docs.git docs.vlang.io/') } for { elog('------------------- Checking for updates ... -------------------')