2022-01-04 10:21:08 +01:00
|
|
|
// Copyright (c) 2019-2022 Alexander Medvednikov. All rights reserved.
|
2021-02-06 22:28:42 +01:00
|
|
|
// 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 {
|
2021-03-08 19:52:13 +01:00
|
|
|
res_pull := os.execute('git pull --rebase')
|
|
|
|
if res_pull.exit_code != 0 {
|
2021-02-06 22:28:42 +01:00
|
|
|
println('failed to git pull. uncommitted changes?')
|
|
|
|
return
|
|
|
|
}
|
2021-05-11 08:30:01 +02:00
|
|
|
// println('running ./fast')
|
2021-08-15 08:27:17 +02:00
|
|
|
resp := os.execute('./fast -upload')
|
2021-03-08 19:52:13 +01:00
|
|
|
if resp.exit_code < 0 {
|
|
|
|
println(resp.output)
|
2021-02-06 22:28:42 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
if resp.exit_code != 0 {
|
|
|
|
println('resp != 0, skipping')
|
2021-08-15 08:03:14 +02:00
|
|
|
println(resp.output)
|
2021-02-06 22:28:42 +01:00
|
|
|
}
|
2021-05-11 08:30:01 +02:00
|
|
|
time.sleep(180 * time.second)
|
2021-02-06 22:28:42 +01:00
|
|
|
}
|
|
|
|
}
|