Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve examples scripts #2397

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/run_all.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cargo build --bins
@(Get-ChildItem -Directory -Name) | %{cargo run --bin $_}
rm pipeline-caching\pipeline_cache.bin
6 changes: 3 additions & 3 deletions examples/run_all.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
set -e
#!/usr/bin/env sh
set -eu

# This script builds and runs all the examples
# It is NOT headless
# Human input is required to close all the windows
# Human monitoring is also required to check for errors in stdout

cargo build --bins
exa -F . | rg '/$' | sd '/' '' | rargs cargo run --bin {}
ls -F | grep '/$' | sed 's|/||' | xargs -E '' -I {} cargo run --bin {}
rm -f pipeline-caching/pipeline_cache.bin
13 changes: 13 additions & 0 deletions examples/run_all_headless.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
foreach ($example in Get-ChildItem -Directory -Name) {
$proc = Start-Process "cargo" "run --bin $example" -NoNewWindow -PassThru

$timeouted = $null

$proc | Wait-Process -Timeout 15 -ErrorAction SilentlyContinue -ErrorVariable timeouted

if ($timeouted) {
$proc | Stop-Process
} elseif ($proc.ExitCode -ne 0) {
Exit $proc.ExitCode
}
}
5 changes: 5 additions & 0 deletions examples/run_all_headless.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
set -eu

ls -F | grep '/$' | sed 's|/$||' | xargs -E '' -I {} timeout --preserve-status 15s cargo run --bin {}
rm -f pipeline-caching/pipeline_cache.bin