From 9a2f2bb27c934fca009095830e909dd06b4b59af Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Tue, 31 Dec 2019 12:51:14 -0700 Subject: [PATCH 1/5] WIP to convert run-all-examples.sh to Python (did not work) --- run-all-examples.py | 46 +++++++++++++++++++++++++++++++++++++++++++++ run-all-examples.sh | 12 ------------ 2 files changed, 46 insertions(+), 12 deletions(-) create mode 100755 run-all-examples.py delete mode 100755 run-all-examples.sh diff --git a/run-all-examples.py b/run-all-examples.py new file mode 100755 index 0000000..ff749e4 --- /dev/null +++ b/run-all-examples.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 + +import sys +import subprocess + +from glob import glob +from os.path import basename, splitext +from subprocess import CalledProcessError +from shlex import quote + +def main(): + for path in glob("examples/*.rs"): + print("=============================================") + print() + + example_name = splitext(basename(path))[0] + print("Running example:", example_name) + + env = {"RUST_BACKTRACE": "1"} + command = [ + "time", + "cargo", + "run", + "--release", + "--example", + example_name, + *sys.argv[1:], + ] + print(" ", " ".join(map(quote, command))) + subprocess.run(command, shell=True, check=True, env=env) + + print() + print("=============================================") + +if __name__ == "__main__": + try: + main() + except CalledProcessError as err: + if err.stdout: + print("===== STDOUT =====") + print(err.stdout) + if err.stderr: + print("===== STDERR =====") + print(err.stderr) + + print("\nProcess returned non-zero exit status", err.returncode) diff --git a/run-all-examples.sh b/run-all-examples.sh deleted file mode 100755 index f2aa8bc..0000000 --- a/run-all-examples.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e - -for file in $(ls examples/*.rs); do - echo "=============================================" - echo - echo "Running example: $(basename ${file%.*})" - time RUST_BACKTRACE=1 cargo run --release --example "$(basename ${file%.*})" "$@" - echo - echo "=============================================" -done From 7fa5c25a50c2123aafb27254da7f5c8c9ab78b63 Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Tue, 31 Dec 2019 12:51:20 -0700 Subject: [PATCH 2/5] Revert "WIP to convert run-all-examples.sh to Python (did not work)" This reverts commit 9a2f2bb27c934fca009095830e909dd06b4b59af. --- run-all-examples.py | 46 --------------------------------------------- run-all-examples.sh | 12 ++++++++++++ 2 files changed, 12 insertions(+), 46 deletions(-) delete mode 100755 run-all-examples.py create mode 100755 run-all-examples.sh diff --git a/run-all-examples.py b/run-all-examples.py deleted file mode 100755 index ff749e4..0000000 --- a/run-all-examples.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import subprocess - -from glob import glob -from os.path import basename, splitext -from subprocess import CalledProcessError -from shlex import quote - -def main(): - for path in glob("examples/*.rs"): - print("=============================================") - print() - - example_name = splitext(basename(path))[0] - print("Running example:", example_name) - - env = {"RUST_BACKTRACE": "1"} - command = [ - "time", - "cargo", - "run", - "--release", - "--example", - example_name, - *sys.argv[1:], - ] - print(" ", " ".join(map(quote, command))) - subprocess.run(command, shell=True, check=True, env=env) - - print() - print("=============================================") - -if __name__ == "__main__": - try: - main() - except CalledProcessError as err: - if err.stdout: - print("===== STDOUT =====") - print(err.stdout) - if err.stderr: - print("===== STDERR =====") - print(err.stderr) - - print("\nProcess returned non-zero exit status", err.returncode) diff --git a/run-all-examples.sh b/run-all-examples.sh new file mode 100755 index 0000000..f2aa8bc --- /dev/null +++ b/run-all-examples.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +for file in $(ls examples/*.rs); do + echo "=============================================" + echo + echo "Running example: $(basename ${file%.*})" + time RUST_BACKTRACE=1 cargo run --release --example "$(basename ${file%.*})" "$@" + echo + echo "=============================================" +done From f16976f01cdf7950ab704646fbe0e5de685f86e0 Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Tue, 31 Dec 2019 12:58:13 -0700 Subject: [PATCH 3/5] Setup azure pipelines for Linux and Mac builds --- .travis.yml | 21 ---------------- azure-pipelines.yml | 60 +++++++++++++++++++++++++++++++++++++++++++++ rust-toolchain | 1 + 3 files changed, 61 insertions(+), 21 deletions(-) delete mode 100644 .travis.yml create mode 100644 azure-pipelines.yml create mode 100644 rust-toolchain diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index df8a3b9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: rust -rust: - - stable -cache: cargo -env: - # Limit number of samples so build doesn't take forever - - SAMPLES=2 -jobs: - include: - - stage: build - script: - - cargo build --verbose --release --all --examples - - cargo test --verbose --release --all - - cargo build --verbose --release --all --examples --features render_bounding_volumes - - cargo build --verbose --release --all --examples --features flat_scene - - cargo build --verbose --release --all --examples --features kdtree - - stage: run all examples - script: source ./run-all-examples.sh --verbose - - script: source ./run-all-examples.sh --verbose --features render_bounding_volumes - - script: source ./run-all-examples.sh --verbose --features flat_scene - - script: source ./run-all-examples.sh --verbose --features kdtree diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..1d8a8cc --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,60 @@ +# https://aka.ms/yaml + +strategy: + matrix: + mac-stable: + imageName: 'macos-latest' + rustup_toolchain: stable + mac-beta: + imageName: 'macos-latest' + rustup_toolchain: beta + mac-nightly: + imageName: 'macos-latest' + rustup_toolchain: nightly + + linux-stable: + imageName: 'ubuntu-latest' + rustup_toolchain: stable + linux-beta: + imageName: 'ubuntu-latest' + rustup_toolchain: beta + linux-nightly: + imageName: 'ubuntu-latest' + rustup_toolchain: nightly + +pool: + vmImage: $(imageName) + +steps: +# Need to remove rust-toolchain or we will always use the version specified +# there regardless of what version is installed +# Also need to set the PATH environment variable to include the rust executables +- script: | + rm rust-toolchain + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN + echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" + source $HOME/.cargo/env + rustc --version --verbose + displayName: install + +- script: | + rustc --version --verbose + cargo build --verbose --release --all --examples + cargo test --verbose --release --all --no-run + cargo build --verbose --release --all --examples --features render_bounding_volumes + cargo build --verbose --release --all --examples --features flat_scene + cargo build --verbose --release --all --examples --features kdtree + displayName: build + +- script: | + cargo test --verbose --release --all + displayName: test + +# Need to limit the number of samples so build doesn't take forever +- script: | + source ./run-all-examples.sh --verbose + source ./run-all-examples.sh --verbose --features render_bounding_volumes + source ./run-all-examples.sh --verbose --features flat_scene + source ./run-all-examples.sh --verbose --features kdtree + env: { SAMPLES: "2" } + displayName: run all examples diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..2bf5ad0 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +stable From 41390d18016347fe77f6034deeeca6de4904b4f0 Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Tue, 31 Dec 2019 13:21:31 -0700 Subject: [PATCH 4/5] Need the CI variable to get progress reporting --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1d8a8cc..31fddfd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -56,5 +56,5 @@ steps: source ./run-all-examples.sh --verbose --features render_bounding_volumes source ./run-all-examples.sh --verbose --features flat_scene source ./run-all-examples.sh --verbose --features kdtree - env: { SAMPLES: "2" } + env: { CI: "true", SAMPLES: "2" } displayName: run all examples From e68ad6433d1d458a1700f19b0b75a08f5c9e1e05 Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Tue, 31 Dec 2019 13:26:42 -0700 Subject: [PATCH 5/5] Printing out the number of samples --- run-all-examples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-all-examples.sh b/run-all-examples.sh index f2aa8bc..ff5add1 100755 --- a/run-all-examples.sh +++ b/run-all-examples.sh @@ -5,7 +5,7 @@ set -e for file in $(ls examples/*.rs); do echo "=============================================" echo - echo "Running example: $(basename ${file%.*})" + echo "Running example: $(basename ${file%.*}) with ${SAMPLES:-100} samples" time RUST_BACKTRACE=1 cargo run --release --example "$(basename ${file%.*})" "$@" echo echo "============================================="