diff --git a/.github/workflows/ci-and-dev-build.yml b/.github/workflows/build-dev-and-ci.yml similarity index 99% rename from .github/workflows/ci-and-dev-build.yml rename to .github/workflows/build-dev-and-ci.yml index e884e13bc9..0f74fae924 100644 --- a/.github/workflows/ci-and-dev-build.yml +++ b/.github/workflows/build-dev-and-ci.yml @@ -1,4 +1,4 @@ -name: "Editor: CI & Dev" +name: "Editor: Dev & CI" on: push: diff --git a/.github/workflows/production-build.yml b/.github/workflows/build-production.yml similarity index 100% rename from .github/workflows/production-build.yml rename to .github/workflows/build-production.yml diff --git a/.github/workflows/!build-comment-commands.yml b/.github/workflows/comment-!build-commands.yml similarity index 100% rename from .github/workflows/!build-comment-commands.yml rename to .github/workflows/comment-!build-commands.yml diff --git a/.github/workflows/clippy-warnings-comment.yaml b/.github/workflows/comment-clippy-warnings.yaml similarity index 97% rename from .github/workflows/clippy-warnings-comment.yaml rename to .github/workflows/comment-clippy-warnings.yaml index 2abc0b0655..acfa37ff1d 100644 --- a/.github/workflows/clippy-warnings-comment.yaml +++ b/.github/workflows/comment-clippy-warnings.yaml @@ -54,7 +54,7 @@ jobs: repo: context.repo.repo, }); - const botComments = comments.filter(comment => + const botComments = comments.filter((comment) => comment.user.type === 'Bot' && comment.body.includes('Clippy Warnings/Errors') ); diff --git a/.github/workflows/profiling.yaml b/.github/workflows/comment-profiling-changes.yaml similarity index 75% rename from .github/workflows/profiling.yaml rename to .github/workflows/comment-profiling-changes.yaml index 5fc317c809..8ff65294af 100644 --- a/.github/workflows/profiling.yaml +++ b/.github/workflows/comment-profiling-changes.yaml @@ -1,4 +1,4 @@ -name: Profiling +name: Profiling Changes on: pull_request: @@ -23,8 +23,8 @@ jobs: - name: Install Valgrind run: | - sudo apt-get update - sudo apt-get install -y valgrind + sudo apt update + sudo apt install -y valgrind - name: Cache dependencies uses: actions/cache@v3 @@ -60,6 +60,31 @@ jobs: echo "$BENCH_OUTPUT" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + - name: Make old comments collapsed by default + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const { data: comments } = await github.rest.issues.listComments({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + }); + + const botComments = comments.filter((comment) => + comment.user.type === 'Bot' && comment.body.includes('Performance Benchmark Results') && comment.body.includes('
') + ); + + for (const comment of botComments) { + // Edit the comment to remove the "open" attribute from the
tag + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id, + body: comment.body.replace('
', '
') + }); + } + - name: Comment PR uses: actions/github-script@v6 with: @@ -67,25 +92,25 @@ jobs: script: | const benchmarkOutput = JSON.parse(`${{ steps.benchmark.outputs.BENCHMARK_OUTPUT }}`); let significantChanges = false; - let commentBody = "#### Performance Benchmark Results\n\n"; - + let commentBody = ""; + function formatNumber(num) { return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } - + function formatPercentage(pct) { const sign = pct >= 0 ? '+' : ''; return `${sign}${pct.toFixed(2)}%`; } - + function padRight(str, len) { return str.padEnd(len); } - + function padLeft(str, len) { return str.padStart(len); } - + for (const benchmark of benchmarkOutput) { if (benchmark.callgrind_summary && benchmark.callgrind_summary.summaries) { const summary = benchmark.callgrind_summary.summaries[0]; @@ -119,15 +144,25 @@ jobs: } } } - + + const output = ` +
+ + Performance Benchmark Results + + ${commentBody} + +
+ `; + if (significantChanges) { github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: commentBody + body: output }); } else { console.log("No significant performance changes detected. Skipping comment."); - console.log(commentBody); + console.log(output); }