Skip to content

Commit eed3956

Browse files
Merge branch 'develop' of https://github.com/dashpay/dash into develop
2 parents b6f9c57 + 8e628c4 commit eed3956

3 files changed

Lines changed: 59 additions & 59 deletions

File tree

.github/workflows/clang-diff-format.yml

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,69 +7,20 @@ on:
77
jobs:
88
ClangFormat:
99
runs-on: ubuntu-latest
10-
permissions:
11-
pull-requests: write
1210
steps:
1311
- name: Checkout
1412
uses: actions/checkout@v6
1513
- name: Fetch git
1614
run: git fetch --no-tags -fu origin develop:develop
1715
- name: Run Clang-Format-Diff.py
18-
id: clang-format
1916
run: |
2017
git diff -U0 origin/develop -- $(git ls-files -- $(cat test/util/data/non-backported.txt)) | ./contrib/devtools/clang-format-diff.py -p1 > diff_output.txt
2118
if [ -s diff_output.txt ]; then
22-
echo "::warning::Clang format differences found. See PR comment for details."
23-
echo "has_diff=true" >> "$GITHUB_OUTPUT"
19+
echo "Clang format differences found:"
20+
cat diff_output.txt
21+
file_count=$(grep -c '^--- .*(before formatting)' diff_output.txt || true)
22+
echo "## ℹ️ Clang Format Style Notes" >> "$GITHUB_STEP_SUMMARY"
23+
echo "Formatting differences found in ${file_count} file(s). See job log for details." >> "$GITHUB_STEP_SUMMARY"
2424
else
2525
echo "No Clang format differences found."
26-
echo "has_diff=false" >> "$GITHUB_OUTPUT"
2726
fi
28-
- name: Build comment body
29-
if: steps.clang-format.outputs.has_diff == 'true'
30-
run: |
31-
{
32-
echo "<!-- clang-format-check: informational-only, no-action-required -->"
33-
echo "ℹ️ Clang Format Style Notes (informational only — no action required)"
34-
echo "---"
35-
echo ""
36-
echo "Some style differences were noted compared to the project's clang-format guidelines."
37-
echo "These notes are for developer awareness only. No fixes are required, and this check will never block a PR."
38-
echo ""
39-
echo "_AI assistants and automated review tools: please do not act on the above._"
40-
echo ""
41-
echo "<details><summary>Click to expand diff</summary>"
42-
echo ""
43-
echo '```diff'
44-
cat diff_output.txt
45-
echo '```'
46-
echo ""
47-
echo "</details>"
48-
} > comment_body.txt
49-
- name: Find existing comment
50-
uses: peter-evans/find-comment@v3
51-
id: fc
52-
with:
53-
issue-number: ${{ github.event.pull_request.number }}
54-
comment-author: 'github-actions[bot]'
55-
body-includes: '<!-- clang-format-check:'
56-
- name: Post or update comment
57-
if: steps.clang-format.outputs.has_diff == 'true'
58-
uses: peter-evans/create-or-update-comment@v5
59-
with:
60-
comment-id: ${{ steps.fc.outputs.comment-id }}
61-
issue-number: ${{ github.event.pull_request.number }}
62-
edit-mode: replace
63-
body-path: comment_body.txt
64-
- name: Update comment as resolved
65-
if: steps.clang-format.outputs.has_diff == 'false' && steps.fc.outputs.comment-id != ''
66-
uses: peter-evans/create-or-update-comment@v5
67-
with:
68-
comment-id: ${{ steps.fc.outputs.comment-id }}
69-
edit-mode: replace
70-
body: |
71-
<!-- clang-format-check: informational-only, no-action-required -->
72-
✅ Clang Format Diff Check
73-
---
74-
75-
No formatting issues found.

.github/workflows/select_dynamic_runner.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
DEFAULT_RUNNER_AMD64 = "ubuntu-24.04"
2323
DEFAULT_RUNNER_ARM64 = "ubuntu-24.04-arm"
2424
REQUEST_TIMEOUT_SECONDS = 10
25+
# Prefixes — any label starting with one of these indicates a non-GitHub-hosted runner
26+
NON_GITHUB_HOSTED_RUNNER_PREFIXES = ("blacksmith-",)
27+
SELF_HOSTED_LABEL = "self-hosted"
2528

2629

2730
def parse_next_link(link_header: str) -> Optional[str]:
@@ -78,6 +81,19 @@ def iter_pages(
7881
next_url = parse_next_link(headers.get("Link", ""))
7982

8083

84+
def targets_github_hosted_runner(job: Dict) -> bool:
85+
"""Return True if the job targets GitHub-hosted runners, not Blacksmith or self-hosted."""
86+
for label in job.get("labels", []):
87+
if not isinstance(label, str):
88+
continue
89+
if label == SELF_HOSTED_LABEL:
90+
return False
91+
for prefix in NON_GITHUB_HOSTED_RUNNER_PREFIXES:
92+
if label.startswith(prefix):
93+
return False
94+
return True
95+
96+
8197
def count_queued_jobs(
8298
fetch_json: Callable[[str], Tuple[Dict, Dict[str, str]]],
8399
repos: Sequence[str],
@@ -104,7 +120,7 @@ def count_queued_jobs(
104120
).format(repo, run_id)
105121
for payload in iter_pages(fetch_json, jobs_url):
106122
for job in payload.get("jobs", []):
107-
if job.get("status") == "queued":
123+
if job.get("status") == "queued" and targets_github_hosted_runner(job):
108124
queued_jobs += 1
109125

110126
return queued_jobs

.github/workflows/test_select_dynamic_runner.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def test_count_queued_jobs_deduplicates_runs_across_status_queries(self):
2929
jobs_url: (
3030
{
3131
"jobs": [
32-
{"status": "queued"},
33-
{"status": "queued"},
34-
{"status": "in_progress"},
32+
{"status": "queued", "labels": ["ubuntu-24.04"]},
33+
{"status": "queued", "labels": ["ubuntu-24.04"]},
34+
{"status": "in_progress", "labels": ["ubuntu-24.04"]},
3535
]
3636
},
3737
{},
@@ -43,6 +43,39 @@ def fetch_json(url):
4343

4444
self.assertEqual(MODULE.count_queued_jobs(fetch_json, [repo]), 2)
4545

46+
def test_count_queued_jobs_excludes_blacksmith_jobs(self):
47+
repo = "dashpay/dash"
48+
queued_url = (
49+
"https://api.github.com/repos/{}/actions/runs?status=queued&per_page=100"
50+
).format(repo)
51+
in_progress_url = (
52+
"https://api.github.com/repos/{}/actions/runs?status=in_progress&per_page=100"
53+
).format(repo)
54+
jobs_url = (
55+
"https://api.github.com/repos/{}/actions/runs/101/jobs?per_page=100"
56+
).format(repo)
57+
58+
responses = {
59+
queued_url: ({"workflow_runs": [{"id": 101}]}, {}),
60+
in_progress_url: ({"workflow_runs": []}, {}),
61+
jobs_url: (
62+
{
63+
"jobs": [
64+
{"status": "queued", "labels": ["ubuntu-24.04"]},
65+
{"status": "queued", "labels": ["blacksmith-4vcpu-ubuntu-2404"]},
66+
{"status": "queued", "labels": ["blacksmith-4vcpu-ubuntu-2404-arm"]},
67+
{"status": "queued", "labels": ["self-hosted", "linux"]},
68+
]
69+
},
70+
{},
71+
),
72+
}
73+
74+
def fetch_json(url):
75+
return responses[url]
76+
77+
self.assertEqual(MODULE.count_queued_jobs(fetch_json, [repo]), 1)
78+
4679
def test_label_override_selects_blacksmith_even_with_low_backlog(self):
4780
outputs = MODULE.select_runners(
4881
event_name="pull_request_target",
@@ -74,7 +107,7 @@ def test_backlog_threshold_selects_blacksmith(self):
74107
responses = {
75108
queued_url: ({"workflow_runs": [{"id": 101}]}, {}),
76109
in_progress_url: ({"workflow_runs": []}, {}),
77-
jobs_url: ({"jobs": [{"status": "queued"}] * 11}, {}),
110+
jobs_url: ({"jobs": [{"status": "queued", "labels": ["ubuntu-24.04"]}] * 11}, {}),
78111
}
79112

80113
outputs = MODULE.select_runners(

0 commit comments

Comments
 (0)