-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: setup e2e-tests in github workflow
- Loading branch information
Showing
11 changed files
with
173 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: End-to-end tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
paths: | ||
- Cargo.toml | ||
- Cargo.lock | ||
- 'contracts/**' | ||
- 'crates/**' | ||
- 'e2e-tests/**' | ||
- '.github/workflows/e2e_tests.yml' | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup rust toolchain | ||
run: rustup toolchain install stable --profile minimal | ||
|
||
- name: Setup rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build apps | ||
run: | | ||
./apps/kv-store/build.sh | ||
- name: Build contracts | ||
run: | | ||
./contracts/context-config/build.sh | ||
./contracts/proxy-lib/build.sh | ||
- name: Build binaries | ||
run: | | ||
cargo build -p meroctl -p merod -p e2e-tests | ||
- name: Run e2e tests | ||
run: | | ||
export NO_COLOR=1 | ||
echo "# E2E tests 🏗️" >> $GITHUB_STEP_SUMMARY | ||
TEST_REPORT=$(./target/debug/e2e-tests \ | ||
--input-dir ./e2e-tests/config \ | ||
--output-dir ./e2e-tests/corpus \ | ||
--merod-binary ./target/debug/merod \ | ||
--meroctl-binary ./target/debug/meroctl) | ||
echo "$TEST_REPORT" >> $GITHUB_STEP_SUMMARY | ||
- name: Run e2e tests | ||
if: success() || failure() | ||
run: | | ||
LOGS_DIR=./e2e-tests/corpus/logs | ||
if [ ! -d "$LOGS_DIR" ]; then | ||
echo "Directory $LOGS_DIR does not exist." | ||
exit 1 | ||
fi | ||
echo "# Node logs 📋" >> $GITHUB_STEP_SUMMARY | ||
for FOLDER in "$LOGS_DIR"/*; do | ||
if [ -d "$FOLDER" ]; then | ||
RUN_LOG="$FOLDER/run.log" | ||
if [ -f "$RUN_LOG" ]; then | ||
echo "## Node logs: $(basename $FOLDER) 📋" >> $GITHUB_STEP_SUMMARY | ||
cat "$RUN_LOG" >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo "## No run.log found in $FOLDER ⚠️" >> $GITHUB_STEP_SUMMARY | ||
fi | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use eyre::Result as EyreResult; | ||
use serde::Serialize; | ||
|
||
#[derive(Clone, Copy, Debug)] | ||
pub struct OutputWriter {} | ||
|
||
impl OutputWriter { | ||
pub fn write_str(&self, line: &str) { | ||
println!("{} ", line); | ||
} | ||
|
||
pub fn write_string(&self, line: String) { | ||
println!("{} ", line); | ||
} | ||
|
||
pub fn write_header(&self, header: &str, level: usize) { | ||
let header_prefix = "#".repeat(level); | ||
println!("{} {} ", header_prefix, header); | ||
} | ||
|
||
pub fn write_json<T>(&self, json: &T) -> EyreResult<()> | ||
where | ||
T: ?Sized + Serialize, | ||
{ | ||
let json = serde_json::to_string_pretty(json)?; | ||
println!("```json\n{}\n```", json); | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters