mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-23 02:01:54 +03:00
commit run scripts, bump rust ci img versions (#2526)
This commit is contained in:
parent
12570e4602
commit
92386438fc
@ -50,7 +50,7 @@ commands:
|
|||||||
jobs:
|
jobs:
|
||||||
check-style:
|
check-style:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.70
|
- image: cimg/rust:1.71
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
@ -66,7 +66,7 @@ jobs:
|
|||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.70
|
- image: cimg/rust:1.71
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
@ -83,7 +83,7 @@ jobs:
|
|||||||
|
|
||||||
leo-executable:
|
leo-executable:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.70
|
- image: cimg/rust:1.71
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
@ -102,7 +102,7 @@ jobs:
|
|||||||
|
|
||||||
leo-new:
|
leo-new:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.70
|
- image: cimg/rust:1.71
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
@ -115,7 +115,7 @@ jobs:
|
|||||||
|
|
||||||
leo-clean:
|
leo-clean:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.70
|
- image: cimg/rust:1.71
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
@ -128,7 +128,7 @@ jobs:
|
|||||||
|
|
||||||
test-examples:
|
test-examples:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/rust:1.70
|
- image: cimg/rust:1.71
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
|
@ -342,9 +342,18 @@ if [ $EXITCODE -ne 0 ]; then
|
|||||||
exit $EXITCODE
|
exit $EXITCODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the lottery example Leo program.
|
# Build and run the lottery Leo program.
|
||||||
echo "Building the \`lottery\` program..."
|
echo "Building and running the \`lottery\` program..."
|
||||||
(
|
(
|
||||||
cd $EXAMPLES/lottery || exit
|
cd $EXAMPLES/lottery || exit
|
||||||
$LEO build || exit
|
|
||||||
|
chmod +x $EXAMPLES/lottery/run.sh || exit
|
||||||
|
export -f leo
|
||||||
|
$EXAMPLES/lottery/run.sh || exit
|
||||||
)
|
)
|
||||||
|
# Check that the lottery program ran successfully.
|
||||||
|
EXITCODE=$?
|
||||||
|
if [ $EXITCODE -ne 0 ]; then
|
||||||
|
echo "The \`lottery\` program failed to run successfully."
|
||||||
|
exit $EXITCODE
|
||||||
|
fi
|
@ -5,6 +5,10 @@
|
|||||||
To run this program, run:
|
To run this program, run:
|
||||||
```bash
|
```bash
|
||||||
leo run play
|
leo run play
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
./run.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
## Execute Guide
|
## Execute Guide
|
||||||
|
10
examples/lottery/run.sh
Executable file
10
examples/lottery/run.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# First check that Leo is installed.
|
||||||
|
if ! command -v leo &> /dev/null
|
||||||
|
then
|
||||||
|
echo "leo is not installed."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the lottery example
|
||||||
|
leo run play || exit
|
@ -57,6 +57,10 @@ impl Command for Example {
|
|||||||
let readme_file_path_string = readme_file_path.display().to_string();
|
let readme_file_path_string = readme_file_path.display().to_string();
|
||||||
fs::write(readme_file_path, self.readme_file_string()).map_err(CliError::failed_to_write_file)?;
|
fs::write(readme_file_path, self.readme_file_string()).map_err(CliError::failed_to_write_file)?;
|
||||||
|
|
||||||
|
// Write the run.sh file.
|
||||||
|
let run_file_path = package_dir.join("run.sh");
|
||||||
|
fs::write(run_file_path, self.run_file_string()).map_err(CliError::failed_to_write_file)?;
|
||||||
|
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
"🚀 To run the '{}' program follow the instructions at {}",
|
"🚀 To run the '{}' program follow the instructions at {}",
|
||||||
self.name().bold(),
|
self.name().bold(),
|
||||||
@ -98,7 +102,9 @@ impl Example {
|
|||||||
Self::TicTacToe => {
|
Self::TicTacToe => {
|
||||||
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/tictactoe/inputs/tictactoe.in")).to_string()
|
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/tictactoe/inputs/tictactoe.in")).to_string()
|
||||||
}
|
}
|
||||||
Self::Token => include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/token/run.sh")).to_string(),
|
Self::Token => {
|
||||||
|
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/token/inputs/token.in")).to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,4 +119,14 @@ impl Example {
|
|||||||
Self::Token => include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/token/README.md")).to_string(),
|
Self::Token => include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/token/README.md")).to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn run_file_string(&self) -> String {
|
||||||
|
match self {
|
||||||
|
Self::Lottery => include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/lottery/run.sh")).to_string(),
|
||||||
|
Self::TicTacToe => {
|
||||||
|
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/tictactoe/run.sh")).to_string()
|
||||||
|
}
|
||||||
|
Self::Token => include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/token/run.sh")).to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user