mirror of
https://github.com/louis-e/arnis.git
synced 2025-12-23 22:37:56 -05:00
Merge branch 'main' into dependabot/cargo/clap-4.5.53
This commit is contained in:
44
.github/workflows/pr-benchmark.yml
vendored
44
.github/workflows/pr-benchmark.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Rust
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
- name: Run benchmark command with memory tracking
|
||||
id: benchmark
|
||||
run: |
|
||||
/usr/bin/time -v ./target/release/arnis --path="./world" --terrain --generate-map --bbox="48.125768 11.552296 48.148565 11.593838" 2> benchmark_log.txt
|
||||
/usr/bin/time -v ./target/release/arnis --path="./world" --terrain --bbox="48.125768 11.552296 48.148565 11.593838" 2> benchmark_log.txt
|
||||
grep "Maximum resident set size" benchmark_log.txt | awk '{print $6}' > peak_mem_kb.txt
|
||||
peak_kb=$(cat peak_mem_kb.txt)
|
||||
peak_mb=$((peak_kb / 1024))
|
||||
@@ -57,25 +57,6 @@ jobs:
|
||||
duration=$((end_time - start_time))
|
||||
echo "duration=$duration" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Check for map preview
|
||||
id: map_check
|
||||
run: |
|
||||
if [ -f "./world/arnis_world_map.png" ]; then
|
||||
echo "Map preview generated successfully"
|
||||
echo "map_exists=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Map preview not found"
|
||||
echo "map_exists=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Upload map preview as artifact
|
||||
if: steps.map_check.outputs.map_exists == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: world-map-preview
|
||||
path: ./world/arnis_world_map.png
|
||||
retention-days: 60
|
||||
|
||||
- name: Format duration and generate summary
|
||||
id: comment_body
|
||||
run: |
|
||||
@@ -106,27 +87,20 @@ jobs:
|
||||
mem_annotation=" (↗ ${mem_percent}% more)"
|
||||
fi
|
||||
|
||||
# Get current timestamp
|
||||
benchmark_time=$(date -u "+%Y-%m-%d %H:%M:%S UTC")
|
||||
run_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|
||||
|
||||
{
|
||||
echo "summary<<EOF"
|
||||
echo "## ⏱️ Benchmark Results"
|
||||
echo "⏱️ Benchmark run finished in **${minutes}m ${seconds}s**"
|
||||
echo "🧠 Peak memory usage: **${peak_mem} MB**${mem_annotation}"
|
||||
echo ""
|
||||
echo "| Metric | Value |"
|
||||
echo "|--------|-------|"
|
||||
echo "| Duration | **${minutes}m ${seconds}s** |"
|
||||
echo "| Peak Memory | **${peak_mem} MB**${mem_annotation} |"
|
||||
echo "| Baseline | **${baseline_time}s** |"
|
||||
echo "| Delta | **${diff}s** |"
|
||||
echo "| Commit | [\`${GITHUB_SHA:0:7}\`](https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}) |"
|
||||
echo "📈 Compared against baseline: **${baseline_time}s**"
|
||||
echo "🧮 Delta: **${diff}s**"
|
||||
echo "🔢 Commit: [\`${GITHUB_SHA:0:7}\`](https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA})"
|
||||
echo ""
|
||||
echo "${verdict}"
|
||||
echo ""
|
||||
echo "---"
|
||||
echo ""
|
||||
echo "📅 **Last benchmark:** ${benchmark_time} | 📥 [Download generated world map](${run_url}#artifacts)"
|
||||
echo "📅 **Last benchmark:** ${benchmark_time}"
|
||||
echo ""
|
||||
echo "_You can retrigger the benchmark by commenting \`retrigger-benchmark\`._"
|
||||
echo "EOF"
|
||||
@@ -138,4 +112,4 @@ jobs:
|
||||
message: ${{ steps.comment_body.outputs.summary }}
|
||||
comment-tag: benchmark-report
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BENCHMARK_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.BENCHMARK_TOKEN }}
|
||||
@@ -6,7 +6,7 @@ use crate::element_processing::*;
|
||||
use crate::ground::Ground;
|
||||
use crate::map_renderer;
|
||||
use crate::osm_parser::ProcessedElement;
|
||||
use crate::progress::emit_gui_progress_update;
|
||||
use crate::progress::{emit_gui_progress_update, emit_map_preview_ready};
|
||||
#[cfg(feature = "gui")]
|
||||
use crate::telemetry::{send_log, LogLevel};
|
||||
use crate::world_editor::WorldEditor;
|
||||
@@ -283,7 +283,7 @@ pub fn generate_world(
|
||||
match result {
|
||||
Ok(Ok(_path)) => {
|
||||
// Notify the GUI that the map preview is ready
|
||||
crate::progress::emit_map_preview_ready();
|
||||
emit_map_preview_ready();
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
eprintln!("Warning: Failed to generate map preview: {}", e);
|
||||
|
||||
@@ -876,7 +876,6 @@ fn gui_start_generation(
|
||||
&mut xzbbox,
|
||||
&mut ground,
|
||||
);
|
||||
send_log(LogLevel::Info, "Map transformation completed.");
|
||||
|
||||
let _ = data_processing::generate_world(
|
||||
parsed_elements,
|
||||
|
||||
@@ -37,6 +37,7 @@ mod gui;
|
||||
mod progress {
|
||||
pub fn emit_gui_error(_message: &str) {}
|
||||
pub fn emit_gui_progress_update(_progress: f64, _message: &str) {}
|
||||
pub fn emit_map_preview_ready() {}
|
||||
pub fn is_running_with_gui() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user