fix(e2e-tests): fix merod port issue, pass PR number to update PR com… #378
Workflow file for this run
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
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 | |
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: | | |
./apps/kv-store/build.sh | |
- name: Build contracts | |
run: | | |
./contracts/near/context-config/build.sh | |
./contracts/near/context-proxy/build.sh | |
- name: Build binaries | |
run: | | |
cargo build -p meroctl -p merod -p e2e-tests | |
- name: Deploy ICP local devnet | |
run: | | |
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 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 | |
- name: Get PR number | |
id: pr_number | |
run: | | |
echo "PR_NUMBER=$(gh pr list \ | |
--repo ${{ github.repository }} \ | |
--state open \ | |
--head ${{ github.ref }} \ | |
--base master \ | |
--json number \ | |
-q '.[0].number')" >> $GITHUB_ENV | |
- 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 }} | |
- name: Show node logs | |
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 |