@@ -22,18 +22,23 @@ jobs:
2222 (github.event_name == 'issue_comment' && contains(github.event.comment.body, 'Run Tests:')) ||
2323 github.event_name == 'workflow_dispatch'
2424
25- strategy :
26- matrix :
27- # TODO Include Macos support later on
28- runs-on : [ubuntu-latest]
29- runs-on : ${{ matrix.runs-on }}
25+ runs-on : [self-hosted, Linux, X64]
3026 env :
3127 BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
3228 TARGET_BRANCH : " "
3329 MX_CHAIN_GO_TARGET_BRANCH : " "
3430 MX_CHAIN_SIMULATOR_TARGET_BRANCH : " "
3531 MX_CHAIN_TESTING_SUITE_TARGET_BRANCH : " "
3632
33+ CF_R2_ACCESS_KEY : ${{ secrets.CF_R2_ACCESS_KEY }}
34+ CF_R2_SECRET_KEY : ${{ secrets.CF_R2_SECRET_KEY }}
35+ CF_R2_ENDPOINT : ${{ secrets.CF_R2_ENDPOINT }}
36+
37+ REPORT_BUCKET : mx-chain-go-testing-reports
38+ REPORT_BASE_URL : https://mx-chain-go-testing-reports.multiversx.com
39+
40+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
41+
3742 steps :
3843 - name : Determine Target Branches
3944 id : target_branch
@@ -132,6 +137,22 @@ jobs:
132137 echo "LATEST_COMMIT_HASH=${latest_commit_hash}" >> $GITHUB_ENV
133138 echo "Latest commit hash: ${latest_commit_hash}"
134139
140+ - name : Install rclone
141+ run : |
142+ TS=$(date +'%Y_%^B_%d__%H_%M_%S');
143+ echo "TS=$TS" >> "$GITHUB_ENV"
144+ echo "TIMESTAMP=$TS" >> "$GITHUB_ENV"
145+ sudo apt-get update -y && sudo apt-get install -y rclone
146+ mkdir -p ~/.config/rclone
147+ cat > ~/.config/rclone/rclone.conf <<EOF
148+ [r2]
149+ type = s3
150+ provider = Cloudflare
151+ access_key_id = ${CF_R2_ACCESS_KEY}
152+ secret_access_key = ${CF_R2_SECRET_KEY}
153+ endpoint = ${CF_R2_ENDPOINT}
154+ EOF
155+
135156 - name : Checkout mx-chain-simulator-go
136157 uses : actions/checkout@v4
137158 with :
@@ -147,6 +168,8 @@ jobs:
147168 - name : Install Python Dependencies and Update go.mod
148169 run : |
149170 cd mx-chain-simulator-go
171+ echo "SIMULATOR_REF=$(git symbolic-ref --short HEAD || git describe --tags)" >> $GITHUB_ENV
172+ echo "SIMULATOR_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
150173 pip install -r scripts/update-go-mod/requirements.txt
151174 python scripts/update-go-mod/update-go-mod.py $LATEST_COMMIT_HASH
152175
@@ -241,10 +264,12 @@ jobs:
241264 ref : ${{ env.MX_CHAIN_TESTING_SUITE_TARGET_BRANCH || github.event.pull_request.base.ref }}
242265 token : ${{ secrets.MVX_TESTER_GH_TOKEN }}
243266
244- - name : Install Dependencies
267+ - name : Install MX-Chain-Testing-Suite Dependencies
245268 run : |
246269 pip install -r mx-chain-testing-suite/requirements.txt
247270 echo "PYTHONPATH=mx-chain-testing-suite" >> $GITHUB_ENV
271+ cd mx-chain-testing-suite
272+ echo "CURRENT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
248273
249274
250275 - name : Run tests and generate HTML report
@@ -262,6 +287,19 @@ jobs:
262287 else
263288 echo "Report not found."
264289 fi
290+
291+ - name : Stage report for R2
292+ run : |
293+ mkdir -p r2_upload
294+ cp reports/report.html r2_upload/index.html # correct source
295+
296+ - name : Upload report to Cloudflare R2
297+ if : always()
298+ run : |
299+ branch="${{ env.BRANCH_NAME }}"
300+ target="reports/chain-simulator/${branch}/${TS}"
301+ rclone copy r2_upload/ "r2:${REPORT_BUCKET}/${target}"
302+ echo "R2_REPORT_URL=${REPORT_BASE_URL}/${target}/index.html" >> $GITHUB_ENV
265303
266304 - name : Upload test report
267305 if : always()
@@ -346,42 +384,54 @@ jobs:
346384 MX_CHAIN_TESTING_SUITE_TARGET_BRANCH : ${{ env.MX_CHAIN_TESTING_SUITE_TARGET_BRANCH }}
347385 LATEST_COMMIT_HASH : ${{ env.LATEST_COMMIT_HASH }}
348386 PYTEST_EXIT_CODE : ${{ env.PYTEST_EXIT_CODE }}
349-
387+ CURRENT_COMMIT_HASH : ${{ env.CURRENT_COMMIT_HASH }}
388+ SIMULATOR_COMMIT_HASH : ${{ env.SIMULATOR_COMMIT_HASH }}
389+ SIMULATOR_REF : ${{ env.SIMULATOR_REF }}
390+ R2_REPORT_URL : ${{ env.R2_REPORT_URL }}
350391 with :
351392 github-token : ${{ secrets.GITHUB_TOKEN }}
352393 script : |
353- const timestamp = process.env.TIMESTAMP;
354- const branchName = process.env.BRANCH_NAME;
355- const currentBranch = process.env.CURRENT_BRANCH;
356- const goTargetBranch = process.env.MX_CHAIN_GO_TARGET_BRANCH;
357- const simulatorTargetBranch = process.env.MX_CHAIN_SIMULATOR_TARGET_BRANCH;
358- const testingSuiteTargetBranch = process.env.MX_CHAIN_TESTING_SUITE_TARGET_BRANCH;
359- const commitHash = process.env.LATEST_COMMIT_HASH;
360- const exitCode = process.env.PYTEST_EXIT_CODE;
394+ const timestamp = process.env.TIMESTAMP;
395+ const branchName = process.env.BRANCH_NAME;
396+ const currentBranch = process.env.CURRENT_BRANCH;
397+ const goTargetBranch = process.env.MX_CHAIN_GO_TARGET_BRANCH;
398+ const simulatorTargetBranch = process.env.MX_CHAIN_SIMULATOR_TARGET_BRANCH;
399+ const testingSuiteTargetBranch = process.env.MX_CHAIN_TESTING_SUITE_TARGET_BRANCH;
400+ const commitHash = process.env.LATEST_COMMIT_HASH;
401+ const exitCode = process.env.PYTEST_EXIT_CODE;
402+
403+ const simulatorCommitHash = process.env.SIMULATOR_COMMIT_HASH || 'N/A';
404+ const r2Url = process.env.R2_REPORT_URL || 'N/A';
405+
361406 const issue_number = context.issue.number;
362- const owner = context.repo.owner;
363- const repo = context.repo.repo;
407+ const owner = context.repo.owner;
408+ const repo = context.repo.repo;
409+ const ts = process.env.TS || process.env.TIMESTAMP;
410+ const verdict = exitCode === "0"
411+ ? "✅ **Integration Tests passed successfully!**"
412+ : "❌ **Integration Tests completed with failures or errors.**";
364413 let message;
365-
366- if (timestamp && branchName && timestamp !== "" && branchName !== "") {
367- const reportUrl = `https://multiversx.github.io/mx-chain-testing-suite/reports/${branchName}/${timestamp}/index.html`;
414+ if (timestamp && branchName) {
415+ const backupUrl = `https://multiversx.github.io/mx-chain-testing-suite/reports/${branchName}/${timestamp}/index.html`;
368416 message = `
369- 📊 **MultiversX Automated Test Report:** [View Report](${reportUrl})
417+ ${verdict}
370418
419+ 📊 **MultiversX Automated Test Report:** [View Report](${r2Url})
420+
371421 🔄 **Build Details:**
372422 - **mx-chain-go Commit Hash:** \`${commitHash}\`
373423 - **Current Branch:** \`${currentBranch}\`
374424 - **mx-chain-go Target Branch:** \`${goTargetBranch}\`
375425 - **mx-chain-simulator-go Target Branch:** \`${simulatorTargetBranch}\`
376426 - **mx-chain-testing-suite Target Branch:** \`${testingSuiteTargetBranch}\`
377-
427+ - **mx-chain-simulator-go Commit Hash:** \`${simulatorCommitHash}\`
428+
378429 🚀 **Environment Variables:**
379- - **TIMESTAMP:** \`${timestamp}\`
380- - **PYTEST_EXIT_CODE:** \`${exitCode}\`
381- 🎉 **MultiversX CI/CD Workflow Complete!**
430+ - **TIMESTAMP:** \`${ts}\`
431+ - **PYTEST_EXIT_CODE:** \`${exitCode}\`
382432 `;
383433 } else {
384- message = "⚠️ No report was generated due to an error or cancellation of the process.\nPlease checkout gh action logs for details";
434+ message = "⚠️ No report was generated due to an error or cancellation of the process.\nPlease checkout GH-Action logs for details. ";
385435 }
386436
387437 github.rest.issues.createComment({
@@ -391,6 +441,36 @@ jobs:
391441 body: message
392442 });
393443
444+ - name : Notify Slack
445+ if : always()
446+ env :
447+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
448+ R2_REPORT_URL : ${{ env.R2_REPORT_URL }}
449+ BRANCH_NAME : ${{ env.BRANCH_NAME }}
450+ CURRENT_COMMIT_HASH : ${{ env.CURRENT_COMMIT_HASH }}
451+ SIMULATOR_REF : ${{ env.SIMULATOR_REF }}
452+ SIMULATOR_COMMIT_HASH : ${{ env.SIMULATOR_COMMIT_HASH }}
453+ TS : ${{ env.TS }}
454+ PYTEST_EXIT_CODE : ${{ env.PYTEST_EXIT_CODE }}
455+ run : |
456+ status="❌ FAILED"
457+ [ "${PYTEST_EXIT_CODE}" = "0" ] && status="✅ PASSED"
458+ repo="${GITHUB_REPOSITORY##*/}"
459+ base="${{ github.base_ref }}"
460+
461+ msg="*MX-CHAIN-GO ChainSimulator CI – ${status}*\
462+ \n• *Report:* <${R2_REPORT_URL:-N/A}|HTML>\
463+ \n• *Repository:* \`${repo}\`\
464+ \n• *Branch:* \`${BRANCH_NAME}\` → \`${base:-main}\`\
465+ \n• *Testing-suite Commit:* \`${CURRENT_COMMIT_HASH}\`\
466+ \n• *Chain Simulator Branch:* \`${SIMULATOR_REF}\`\
467+ \n• *Chain Simulator Commit:* \`${SIMULATOR_COMMIT_HASH}\`\
468+ \n• *Run at:* ${TS}"
469+
470+ curl -s -X POST -H 'Content-Type: application/json' \
471+ -d "{\"text\":\"${msg}\"}" \
472+ "$SLACK_WEBHOOK_URL"
473+
394474 - name : Fail job if tests failed
395475 if : always()
396476 run : |
0 commit comments