Skip to content

Commit

Permalink
Merge branch 'master' into chore--update-merod-command-instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
fbozic authored and MatejVukosav committed Jan 16, 2025
2 parents 7fa4f92 + c81ca88 commit 7aca979
Show file tree
Hide file tree
Showing 69 changed files with 2,833 additions and 1,147 deletions.
107 changes: 84 additions & 23 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true # due to candid-extractor

- name: Install dfx
uses: dfinity/setup-dfx@main

- name: Build apps
run: |
Expand All @@ -42,38 +46,95 @@ jobs:
run: |
cargo build -p meroctl -p merod -p e2e-tests
- name: Prepare e2e-tests config
id: prepare_e2e_tests_config
run: |
# Generate 4 unique random numbers
random_numbers=()
while [ ${#random_numbers[@]} -lt 3 ]; do
num=$((RANDOM%37001 + 3000))
if [[ ! " ${random_numbers[@]} " =~ " ${num} " ]]; then
random_numbers+=($num)
fi
done
# Export random numbers to environment variables
SWARM_PORT="${random_numbers[0]}"
SERVER_PORT="${random_numbers[1]}"
ICP_PORT="${random_numbers[2]}"
SWARM_HOST=$(ifconfig | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | head -n 1)
echo "SWARM_PORT=$SWARM_PORT" >> $GITHUB_OUTPUT
echo "SERVER_PORT=$SERVER_PORT" >> $GITHUB_OUTPUT
echo "ICP_PORT=$ICP_PORT" >> $GITHUB_OUTPUT
echo "SWARM_HOST=$SWARM_HOST" >> $GITHUB_OUTPUT
# Update JSON file with jq
jq --arg swarmPort "$SWARM_PORT" \
--arg serverPort "$SERVER_PORT" \
--arg icpPort "$ICP_PORT" \
--arg swarmHost "$SWARM_HOST" \
'.network.swarmHost = ($swarmHost) |
.network.startSwarmPort = ($swarmPort | tonumber) |
.network.startServerPort = ($serverPort | tonumber) |
.protocolSandboxes[1].config.rpcUrl = "http://127.0.0.1:\($icpPort)"
' e2e-tests/config/config.json > updated_config.json
mv updated_config.json e2e-tests/config/config.json
- name: Deploy ICP local devnet
env:
ICP_PORT: ${{ steps.prepare_e2e_tests_config.outputs.ICP_PORT }}
run: |
echo "ICP_PORT=$ICP_PORT"
cargo install candid-extractor
cd ./contracts/icp/context-config
./deploy_devnet.sh
cd ../../..
- name: Run e2e tests
env:
NO_COLOR: '1'
# RUST_LOG: calimero_node=debug,calimero_network=debug
run: |
export NO_COLOR=1
export SWARM_HOST=$(ifconfig | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | head -n 1)
echo "Running e2e tests, check job summary for details"
echo "# E2E tests 🏗️" >> $GITHUB_STEP_SUMMARY
./target/debug/e2e-tests \
--input-dir ./e2e-tests/config \
--output-dir ./e2e-tests/corpus \
--merod-binary ./target/debug/merod \
--meroctl-binary ./target/debug/meroctl \
--output-format markdown >> $GITHUB_STEP_SUMMARY
--meroctl-binary ./target/debug/meroctl
- name: Run e2e tests
- name: Get PR number
id: pr_number
if: success() || failure()
env:
GH_TOKEN: ${{ github.token }}
GH_REF: ${{ github.ref }}
shell: bash
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
echo "PR_NUMBER=$(gh pr list \
--repo ${{ github.repository }} \
--state open \
--head "${GH_REF#refs/heads/}" \
--base master \
--json number \
-q '.[0].number')" >> $GITHUB_OUTPUT
for FOLDER in "$LOGS_DIR"/*; do
if [ -d "$FOLDER" ]; then
- name: Update pull request comment
if: (success() || failure()) && steps.pr_number.outputs.PR_NUMBER != ''
uses: thollander/actions-comment-pull-request@v3
with:
file-path: ./e2e-tests/corpus/report.md
pr-number: ${{ steps.pr_number.outputs.PR_NUMBER }}
comment-tag: e2e-tests-report
mode: recreate

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
- name: Upload artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: e2e-tests-corpus
path: e2e-tests/corpus/
retention-days: 2
Loading

0 comments on commit 7aca979

Please sign in to comment.