Remove timeout code as there exists no general way to stop worker threads
parent
3c82188135
commit
de45635057
@ -0,0 +1,16 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[{*.json,*.yml}]
|
||||
indent_size = 2
|
@ -1,28 +0,0 @@
|
||||
use cursive::{
|
||||
views::{Dialog, TextView},
|
||||
Cursive,
|
||||
};
|
||||
use cursive_async_view::AsyncView;
|
||||
use std::time::Duration;
|
||||
|
||||
fn main() {
|
||||
cursive::logger::init();
|
||||
|
||||
let mut siv = Cursive::default();
|
||||
|
||||
// We can quit by pressing `q`
|
||||
siv.add_global_callback('q', Cursive::quit);
|
||||
|
||||
let async_view = AsyncView::new(&siv, move || {
|
||||
std::thread::sleep(std::time::Duration::from_secs(10));
|
||||
TextView::new("Yay!\n\nThe content has loaded! ")
|
||||
})
|
||||
.with_width(40)
|
||||
.with_timeout(Duration::from_secs(5))
|
||||
.with_timeout_view(TextView::new("Oh no, the content has not loaded :("));
|
||||
|
||||
let dialog = Dialog::around(async_view).button("Ok", |s| s.quit());
|
||||
|
||||
siv.add_layer(dialog);
|
||||
siv.run();
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
#! /bin/sh
|
||||
|
||||
die() {
|
||||
printf "\e[31:1mError: %s\e[0m\n" "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
(
|
||||
cd "$(git rev-parse --show-toplevel)" || die "cannot find project root"
|
||||
|
||||
# Badges!
|
||||
mkdir -p ./target/shields
|
||||
if cargo "+${RUST_CHAIN}" --color=always build --all-targets; then
|
||||
cat <<EOF > "./target/shields/$RUST_CHAIN-build.json"
|
||||
{
|
||||
"color": "brightgreen",
|
||||
"isError": true,
|
||||
"label": "$RUST_CHAIN build",
|
||||
"message": "passing",
|
||||
"schemaVersion": 1
|
||||
}
|
||||
EOF
|
||||
else
|
||||
PRV_EXIT=$?
|
||||
cat <<EOF > "./target/shields/$RUST_CHAIN-build.json"
|
||||
{
|
||||
"color": "red",
|
||||
"isError": true,
|
||||
"label": "$RUST_CHAIN build",
|
||||
"message": "failed",
|
||||
"schemaVersion": 1
|
||||
}
|
||||
EOF
|
||||
exit $PRV_EXIT
|
||||
fi
|
||||
|
||||
cargo "+${RUST_CHAIN}" --color=always test --no-fail-fast
|
||||
exitcode=$?
|
||||
|
||||
# create badge for `cargo test`
|
||||
cargo "+${RUST_CHAIN}" test --no-fail-fast -- -Z unstable-options --format json | \
|
||||
jq -s -f ./scripts/shields-from-tests.jq > ./target/shields/cargo-test.json
|
||||
|
||||
exit $exitcode
|
||||
)
|
@ -0,0 +1,50 @@
|
||||
#! /bin/sh
|
||||
|
||||
die() {
|
||||
printf "\e[31:1mError: %s\e[0m\n" "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -z "$GITHUB_USERNAME" ]
|
||||
then
|
||||
die "the GITHUB_USERNAME environment variable is not set"
|
||||
fi
|
||||
|
||||
if [ -z "$GITHUB_TOKEN" ]
|
||||
then
|
||||
die "the GITHUB_TOKEN environment variable is not set"
|
||||
fi
|
||||
|
||||
if [ -z "$GITHUB_REPO_SLUG" ]
|
||||
then
|
||||
die "the GITHUB_REPO_SLUG environment variable is not set"
|
||||
fi
|
||||
|
||||
(
|
||||
cd "$(git rev-parse --show-toplevel)/target/shields" || die "cannot find project root!"
|
||||
repo="https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${GITHUB_REPO_SLUG}.git"
|
||||
tmp_dir=$(mktemp -d -t cursive-async-view-deploy-XXXXXXXX)
|
||||
|
||||
try=0
|
||||
while :; do
|
||||
git clone --branch gh-pages "$repo" "$tmp_dir"
|
||||
cp -ar ./* "$tmp_dir"
|
||||
|
||||
(
|
||||
cd "$tmp_dir" || die "failed to enter temporary directory"
|
||||
git add -A
|
||||
git commit -m "Travis CI badge deployment"
|
||||
git push
|
||||
)
|
||||
|
||||
result=$?
|
||||
rm -rf "$tmp_dir"
|
||||
|
||||
if [ "$result" -eq 0 ] || [ "$try" -ge 5 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
try=$((try + 1))
|
||||
done
|
||||
)
|
Loading…
Reference in New Issue