Skip to content

Commit 6e95bf2

Browse files
committed
Merge remote-tracking branch 'origin/v0.42-dev' into feat/blockchain-identities-account-type
2 parents 80b3bd3 + 5edf719 commit 6e95bf2

164 files changed

Lines changed: 2218 additions & 1968 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codecov.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ flags:
3535
wallet:
3636
paths:
3737
- key-wallet/src/
38-
- key-wallet-manager/src/
3938
ffi:
4039
paths:
4140
- dash-spv-ffi/src/

.coderabbit.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
22
reviews:
33
request_changes_workflow: true
4+
path_instructions:
5+
- path: "**"
6+
instructions: |
7+
Check whether the PR title prefix allowed in the pr-title.yml workflow
8+
accurately describes the changes. Flag e.g. if a PR labeled "fix" appears to add
9+
new functionality, if a "feat" PR only refactors existing code, or if a
10+
"chore" PR contains logic changes that should be a "feat" or "fix".
11+
If a PR mixes unrelated concerns (e.g., a bug fix bundled with a refactor
12+
or new feature), suggest splitting it into separate focused PRs.

.github/ci-groups.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ groups:
1212

1313
wallet:
1414
- key-wallet
15-
- key-wallet-manager
1615

1716
ffi:
1817
- dash-spv-ffi

.github/scripts/check_ci_status.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
# Evaluate CI check status for a PR, excluding the ready-for-review gate jobs.
3+
# Usage: check_ci_status.sh <pr_number> <repo>
4+
# Outputs one of: no_checks, all_passed, has_failures, pending
5+
6+
set -euo pipefail
7+
8+
PR_NUMBER="$1"
9+
REPO="$2"
10+
11+
gh pr checks "$PR_NUMBER" --repo "$REPO" --json name,bucket --jq '
12+
[.[] | select(.name | test("^(on-review|on-ci-complete)$") | not)] |
13+
if length == 0 then "no_checks"
14+
elif all(.bucket == "pass" or .bucket == "skipping") then "all_passed"
15+
elif any(.bucket == "fail") then "has_failures"
16+
else "pending"
17+
end
18+
'

.github/scripts/ci_config.py

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import argparse
1212
import json
1313
import os
14+
import re
1415
import subprocess
1516
import sys
1617
from pathlib import Path
@@ -95,9 +96,34 @@ def verify_groups(args):
9596

9697
print(f"All {len(workspace_crates)} workspace crates are assigned to test groups")
9798

98-
# Output groups for GitHub Actions matrix
99-
github_output("groups", json.dumps(list(groups.keys())))
99+
# Verify the hardcoded matrix in build-and-test.yml matches ci-groups.yml
100+
workflow_file = Path(".github/workflows/build-and-test.yml")
101+
expected = sorted(groups.keys())
100102

103+
try:
104+
with open(workflow_file) as f:
105+
content = f.read()
106+
except FileNotFoundError:
107+
github_error(f"Workflow file not found: {workflow_file}")
108+
return 1
109+
110+
match = re.search(r'group:\s*\[([^\]]+)\]', content)
111+
if not match:
112+
github_error(f"No hardcoded group matrix found in {workflow_file}")
113+
return 1
114+
115+
actual = sorted(
116+
name.strip().strip('"').strip("'") for name in match.group(1).split(",")
117+
)
118+
119+
if actual != expected:
120+
github_error(
121+
f"Hardcoded matrix {actual} does not match ci-groups.yml {expected}. "
122+
f"Update the group list in {workflow_file}."
123+
)
124+
return 1
125+
126+
print(f"Hardcoded matrix matches ci-groups.yml: {expected}")
101127
return 0
102128

103129

@@ -120,17 +146,18 @@ def run_group_tests(args):
120146
for crate in crates:
121147
github_group_start(f"Testing {crate}")
122148

123-
if coverage:
124-
cmd = ["cargo", "llvm-cov", "--no-report", "-p", crate, "--all-features"]
125-
else:
126-
cmd = ["cargo", "test", "-p", crate, "--all-features"]
127-
result = subprocess.run(cmd)
128-
129-
github_group_end()
130-
131-
if result.returncode != 0:
132-
failed.append(crate)
133-
github_error(f"Test failed for {crate} on {args.os}")
149+
try:
150+
if coverage:
151+
cmd = ["cargo", "llvm-cov", "--no-report", "-p", crate, "--all-features"]
152+
else:
153+
cmd = ["cargo", "test", "-p", crate, "--all-features"]
154+
result = subprocess.run(cmd)
155+
156+
if result.returncode != 0:
157+
failed.append(crate)
158+
github_error(f"Test failed for {crate} on {args.os}")
159+
finally:
160+
github_group_end()
134161

135162
if failed:
136163
print("\n" + "=" * 40)

.github/workflows/build-and-test.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
os:
77
required: true
88
type: string
9-
groups:
10-
required: true
11-
type: string
129
coverage:
1310
required: false
1411
type: boolean
@@ -21,7 +18,7 @@ permissions:
2118
env:
2219
DASHVERSION: "23.1.0"
2320
TEST_DATA_REPO: "dashpay/regtest-blockchain"
24-
TEST_DATA_VERSION: "v0.0.2"
21+
TEST_DATA_VERSION: "v0.0.3"
2522

2623
jobs:
2724
test:
@@ -30,7 +27,7 @@ jobs:
3027
strategy:
3128
fail-fast: false
3229
matrix:
33-
group: ${{ fromJson(inputs.groups) }}
30+
group: ["core", "spv", "wallet", "ffi", "rpc"]
3431
env:
3532
RUST_BACKTRACE: 1
3633
steps:
@@ -66,7 +63,7 @@ jobs:
6663
- name: Run tests
6764
id: tests
6865
env:
69-
DASHD_TEST_RETAIN_DIR: ${{ (matrix.group == 'spv' || matrix.group == 'ffi') && '/tmp/dashd-test-logs' || '' }}
66+
DASHD_TEST_RETAIN_DIR: ${{ (matrix.group == 'spv' || matrix.group == 'ffi') && format('{0}/dashd-test-logs', runner.temp) || '' }}
7067
run: >
7168
python .github/scripts/ci_config.py run-group ${{ matrix.group }}
7269
--os ${{ inputs.os }}
@@ -90,6 +87,6 @@ jobs:
9087
uses: actions/upload-artifact@v4
9188
with:
9289
name: ${{ matrix.group }}-test-logs-${{ inputs.os }}
93-
path: /tmp/dashd-test-logs/
90+
path: ${{ runner.temp }}/dashd-test-logs/
9491
retention-days: 7
9592
if-no-files-found: ignore

.github/workflows/pr-title.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: PR Title Check
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, edited, synchronize]
6+
7+
permissions:
8+
pull-requests: read
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
check-title:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v6
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
types: |
23+
build
24+
chore
25+
ci
26+
docs
27+
feat
28+
fix
29+
refactor
30+
test
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: Ready for Review Label
2+
3+
on:
4+
pull_request_review:
5+
types: [submitted, dismissed]
6+
workflow_run:
7+
workflows: ["Continuous integration", "Pre-commit Checks", "Sanitizer"]
8+
types: [completed]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
pull-requests: write
16+
checks: read
17+
18+
jobs:
19+
# Handle CodeRabbit review events
20+
on-review:
21+
runs-on: ubuntu-latest
22+
if: >-
23+
github.event_name == 'pull_request_review' &&
24+
github.event.review.user.login == 'coderabbitai[bot]'
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
sparse-checkout: .github/scripts
29+
sparse-checkout-cone-mode: true
30+
- name: Evaluate label
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
PR_NUMBER: ${{ github.event.pull_request.number }}
34+
REVIEW_STATE: ${{ github.event.review.state }}
35+
EVENT_ACTION: ${{ github.event.action }}
36+
REPO: ${{ github.repository }}
37+
run: |
38+
# On dismissal or changes requested, always remove label
39+
if [ "$EVENT_ACTION" = "dismissed" ] || [ "$REVIEW_STATE" = "changes_requested" ]; then
40+
echo "CodeRabbit review dismissed or changes requested, removing label."
41+
gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "ready-for-review" || true
42+
exit 0
43+
fi
44+
45+
# On approval, check if all CI checks have also passed
46+
if [ "$EVENT_ACTION" = "submitted" ] && [ "$REVIEW_STATE" = "approved" ]; then
47+
echo "CodeRabbit approved. Checking CI status..."
48+
49+
CI_STATUS=$(.github/scripts/check_ci_status.sh "$PR_NUMBER" "$REPO")
50+
51+
echo "CI status: $CI_STATUS"
52+
if [ "$CI_STATUS" = "all_passed" ]; then
53+
echo "All conditions met. Adding ready-for-review label."
54+
gh pr edit "$PR_NUMBER" --repo "$REPO" --add-label "ready-for-review"
55+
else
56+
echo "CI checks not all passing ($CI_STATUS). Label not added."
57+
fi
58+
fi
59+
60+
# Handle CI workflow completions
61+
on-ci-complete:
62+
runs-on: ubuntu-latest
63+
if: github.event_name == 'workflow_run'
64+
steps:
65+
- uses: actions/checkout@v4
66+
with:
67+
sparse-checkout: |
68+
.github/scripts
69+
.github/workflows
70+
sparse-checkout-cone-mode: true
71+
- name: Validate workflow trigger coverage
72+
run: |
73+
SELF=".github/workflows/ready-for-review.yml"
74+
75+
# Extract workflow names from the workflow_run trigger list in this file
76+
MONITORED=$(grep -A1 'workflows:' "$SELF" \
77+
| grep '\[' \
78+
| tr ',' '\n' \
79+
| sed 's/.*"\([^"]*\)".*/\1/')
80+
81+
MISSING=""
82+
for f in .github/workflows/*.yml; do
83+
# Skip self
84+
[ "$f" = "$SELF" ] && continue
85+
86+
# Check if this workflow triggers on pull_request (not
87+
# pull_request_target which has different semantics, and not
88+
# workflow_call which is for reusable workflows).
89+
if ! grep -qE '^[[:space:]]+pull_request:' "$f"; then
90+
continue
91+
fi
92+
93+
# Extract the workflow name
94+
WF_NAME=$(grep -m1 '^name:' "$f" | sed "s/^name:\s*//; s/[\"']//g")
95+
96+
# Check if it's in the monitored list
97+
if ! echo "$MONITORED" | grep -qF "$WF_NAME"; then
98+
MISSING="$MISSING\n - $WF_NAME ($f)"
99+
fi
100+
done
101+
102+
if [ -n "$MISSING" ]; then
103+
echo ""
104+
echo "ERROR: The following workflows trigger on pull_request but are"
105+
echo "not listed in ready-for-review.yml's workflow_run trigger."
106+
echo "Please add them to keep the ready-for-review label gate working correctly."
107+
echo -e "$MISSING"
108+
exit 1
109+
fi
110+
111+
echo "All pull_request workflows are covered by workflow_run triggers."
112+
- name: Evaluate label for associated PRs
113+
env:
114+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
REPO: ${{ github.repository }}
116+
PULL_REQUESTS_JSON: ${{ toJson(github.event.workflow_run.pull_requests) }}
117+
run: |
118+
# Get PR numbers associated with this workflow run
119+
PR_NUMBERS=$(echo "$PULL_REQUESTS_JSON" | jq -r '.[].number')
120+
121+
if [ -z "$PR_NUMBERS" ]; then
122+
echo "No associated pull requests found, skipping."
123+
exit 0
124+
fi
125+
126+
for PR_NUMBER in $PR_NUMBERS; do
127+
echo "=== Checking PR #$PR_NUMBER ==="
128+
129+
# Check if CodeRabbit has approved
130+
CODERABBIT_STATE=$(gh api --paginate "repos/$REPO/pulls/$PR_NUMBER/reviews" | jq -rs '
131+
add
132+
| map(select(.user.login == "coderabbitai[bot]"))
133+
| sort_by(.submitted_at)
134+
| last
135+
| .state // "NONE"
136+
')
137+
echo "CodeRabbit review state: $CODERABBIT_STATE"
138+
139+
if [ "$CODERABBIT_STATE" != "APPROVED" ]; then
140+
echo "CodeRabbit has not approved. Skipping."
141+
continue
142+
fi
143+
144+
# Check if all CI checks have passed
145+
CI_STATUS=$(.github/scripts/check_ci_status.sh "$PR_NUMBER" "$REPO")
146+
147+
echo "CI status: $CI_STATUS"
148+
if [ "$CI_STATUS" = "all_passed" ]; then
149+
echo "Both conditions met. Adding ready-for-review label."
150+
gh pr edit "$PR_NUMBER" --repo "$REPO" --add-label "ready-for-review"
151+
else
152+
echo "CI checks not all passing ($CI_STATUS). Removing label if present."
153+
gh pr edit "$PR_NUMBER" --repo "$REPO" --remove-label "ready-for-review" || true
154+
fi
155+
done

0 commit comments

Comments
 (0)