diff options
author | Indrajith K L | 2022-12-03 17:00:20 +0530 |
---|---|---|
committer | Indrajith K L | 2022-12-03 17:00:20 +0530 |
commit | f5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch) | |
tree | 2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/old/cmd/tools/fast/fast_job.v | |
download | cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.gz cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.bz2 cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.zip |
Diffstat (limited to 'v_windows/v/old/cmd/tools/fast/fast_job.v')
-rw-r--r-- | v_windows/v/old/cmd/tools/fast/fast_job.v | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/v_windows/v/old/cmd/tools/fast/fast_job.v b/v_windows/v/old/cmd/tools/fast/fast_job.v new file mode 100644 index 0000000..d4d8fc3 --- /dev/null +++ b/v_windows/v/old/cmd/tools/fast/fast_job.v @@ -0,0 +1,43 @@ +// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved. +// Use of this source code is governed by an MIT license +// that can be found in the LICENSE file. +import os +import time + +// A job that runs in the background, checks for repo updates, +// runs fast.v, pushes the HTML result to the fast.vlang.io GH pages repo. +fn main() { + println(time.now()) + if !os.exists('website') { + println('cloning the website repo...') + os.system('git clone git@github.com:/vlang/website.git') + } + if !os.exists('fast') { + println('"fast" binary (built with `v fast.v`) was not found') + return + } + for { + res_pull := os.execute('git pull --rebase') + if res_pull.exit_code != 0 { + println('failed to git pull. uncommitted changes?') + return + } + // println('running ./fast') + resp := os.execute('./fast') + if resp.exit_code < 0 { + println(resp.output) + return + } + if resp.exit_code != 0 { + println('resp != 0, skipping') + } else { + os.chdir('website') + os.execute_or_exit('git checkout gh-pages') + os.cp('../index.html', 'index.html') ? + os.system('git commit -am "update benchmark"') + os.system('git push origin gh-pages') + os.chdir('..') + } + time.sleep(180 * time.second) + } +} |