2021-02-07 00:28:42 +03:00
|
|
|
// 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 {
|
|
|
|
os.exec('git pull --rebase') or {
|
|
|
|
println('failed to git pull. uncommitted changes?')
|
|
|
|
return
|
|
|
|
}
|
2021-02-07 06:00:58 +03:00
|
|
|
// println('running fast')
|
2021-02-07 00:28:42 +03:00
|
|
|
resp := os.exec('./fast') or {
|
|
|
|
println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if resp.exit_code != 0 {
|
|
|
|
println('resp != 0, skipping')
|
|
|
|
} else {
|
|
|
|
os.chdir('website')
|
|
|
|
os.exec('git checkout gh-pages') ?
|
|
|
|
os.cp('../index.html', 'index.html') ?
|
|
|
|
os.system('git commit -am "update benchmark"')
|
2021-02-07 05:35:22 +03:00
|
|
|
os.system('git push origin gh-pages')
|
2021-02-07 00:28:42 +03:00
|
|
|
os.chdir('..')
|
|
|
|
}
|
2021-02-27 20:41:06 +03:00
|
|
|
time.sleep(60 * time.second)
|
2021-02-07 00:28:42 +03:00
|
|
|
}
|
|
|
|
}
|