Skip to content

Commit 13ec89b

Browse files
authored
Merge branch 'staging' into master
2 parents 8909c5c + 9297101 commit 13ec89b

File tree

102 files changed

+5953
-2484
lines changed

Some content is hidden

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

102 files changed

+5953
-2484
lines changed

.github/PULL_REQUEST_TEMPLATE/bug_fix.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ Examples:
5656
- Fixed an issue where multiple cursors did not work in a file with a single line.
5757
- Increased the performance of searching and replacing across a whole project.
5858
59-
-->
59+
-->
60+
61+
62+
### Branch Acknowledgement
63+
[ ] I am acknowledging that I am opening this branch against `staging`

.github/PULL_REQUEST_TEMPLATE/feature_change.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,8 @@ Examples:
5151
- Fixed an issue where multiple cursors did not work in a file with a single line.
5252
- Increased the performance of searching and replacing across a whole project.
5353
54-
-->
54+
-->
55+
56+
57+
### Branch Acknowledgement
58+
[ ] I am acknowledging that I am opening this branch against `staging`

.github/PULL_REQUEST_TEMPLATE/performance_improvement.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@ Examples:
5252
- Fixed an issue where multiple cursors did not work in a file with a single line.
5353
- Increased the performance of searching and replacing across a whole project.
5454
55-
-->
55+
-->
56+
57+
58+
### Branch Acknowledgement
59+
[ ] I am acknowledging that I am opening this branch against `staging`

.github/pull_request_template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ please switch to **Preview** for links to render properly.
55

66
Please choose the right template for your pull request:
77

8-
- 🐛 Are you fixing a bug? [Bug fix](?template=bug_fix.md)
9-
- 📈 Are you improving performance? [Performance improvement](?template=performance_improvement.md)
10-
- 💻 Are you changing functionality? [Feature change](?template=feature_change.md)
8+
- 🐛 Are you fixing a bug? [Bug fix](?expand=1&template=bug_fix.md)
9+
- 📈 Are you improving performance? [Performance improvement](?expand=1&template=performance_improvement.md)
10+
- 💻 Are you changing functionality? [Feature change](?expand=1&template=feature_change.md)

.github/workflows/docker_release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ jobs:
1818

1919
steps:
2020
- name: Check out code
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222

2323
- name: Install cosign
2424
uses: sigstore/cosign-installer@v3
2525

2626
- name: Log in to Docker Hub
27-
uses: docker/login-action@v2
27+
uses: docker/login-action@v3
2828
with:
2929
registry: docker.io
3030
username: ${{ secrets.DOCKERHUB_USERNAME }}
3131
password: ${{ secrets.DOCKERHUB_TOKEN }}
3232

3333
- name: Set up Docker Buildx
34-
uses: docker/setup-buildx-action@v2
34+
uses: docker/setup-buildx-action@v3
3535

3636
- name: Build and push Docker image
37-
uses: docker/build-push-action@v4
37+
uses: docker/build-push-action@v6
3838
with:
3939
context: .
4040
push: true
@@ -48,4 +48,4 @@ jobs:
4848
DIGEST: ${{ steps.build.outputs.digest }}
4949
TAGS: ${{ steps.build.outputs.tags }}
5050
run: |
51-
echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
51+
echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.github/workflows/e2e-subtensor-tests.yaml

Lines changed: 94 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
branches: [master, development, staging]
1313
types: [ opened, synchronize, reopened, ready_for_review ]
1414

15+
schedule:
16+
- cron: '0 9 * * *' # Run every night at 2:00 PST
17+
1518
workflow_dispatch:
1619
inputs:
1720
verbose:
@@ -40,7 +43,7 @@ jobs:
4043
run: |
4144
test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
4245
# keep it here for future debug
43-
# test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(incentive|commit_weights|set_weights)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
46+
# test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(hotkeys|staking)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
4447
echo "test-files=$test_files" >> "$GITHUB_OUTPUT"
4548
shell: bash
4649

@@ -63,8 +66,8 @@ jobs:
6366
path: subtensor-localnet.tar
6467

6568
# Job to run tests in parallel
66-
run-e2e-test:
67-
name: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}
69+
run-fast-blocks-e2e-test:
70+
name: "FB: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}"
6871
needs:
6972
- find-tests
7073
- pull-docker-image
@@ -107,7 +110,92 @@ jobs:
107110
- name: Run tests with retry
108111
run: |
109112
set +e
110-
for i in 1 2; do
113+
for i in 1 2 3; do
114+
echo "🔁 Attempt $i: Running tests"
115+
uv run pytest ${{ matrix.test-file }} -s
116+
status=$?
117+
if [ $status -eq 0 ]; then
118+
echo "✅ Tests passed on attempt $i"
119+
break
120+
else
121+
echo "❌ Tests failed on attempt $i"
122+
if [ $i -eq 3 ]; then
123+
echo "Tests failed after 3 attempts"
124+
exit 1
125+
fi
126+
echo "Retrying..."
127+
sleep 5
128+
fi
129+
done
130+
131+
# run non-fast-blocks only on Saturday and by cron schedule
132+
check-if-saturday:
133+
if: github.event_name == 'schedule'
134+
runs-on: ubuntu-latest
135+
outputs:
136+
is-saturday: ${{ steps.check.outputs.is-saturday }}
137+
steps:
138+
- id: check
139+
run: |
140+
day=$(date -u +%u)
141+
echo "Today is weekday $day"
142+
if [ "$day" -ne 6 ]; then
143+
echo "⏭️ Skipping: not Saturday"
144+
echo "is-saturday=false" >> "$GITHUB_OUTPUT"
145+
exit 0
146+
fi
147+
echo "is-saturday=true"
148+
echo "is-saturday=true" >> "$GITHUB_OUTPUT"
149+
150+
151+
cron-run-non-fast-blocks-e2e-test:
152+
if: github.event_name == 'schedule' && needs.check-if-saturday.outputs.is-saturday == 'true'
153+
name: "NFB: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}"
154+
needs:
155+
- check-if-saturday
156+
- find-tests
157+
- pull-docker-image
158+
runs-on: ubuntu-latest
159+
timeout-minutes: 1440
160+
161+
strategy:
162+
fail-fast: false # Allow other matrix jobs to run even if this job fails
163+
max-parallel: 32 # Set the maximum number of parallel jobs (same as we have cores in ubuntu-latest runner)
164+
matrix:
165+
os:
166+
- ubuntu-latest
167+
test-file: ${{ fromJson(needs.find-tests.outputs.test-files) }}
168+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
169+
170+
steps:
171+
- name: Check-out repository
172+
uses: actions/checkout@v4
173+
174+
- name: Set up Python ${{ matrix.python-version }}
175+
uses: actions/setup-python@v5
176+
with:
177+
python-version: ${{ matrix.python-version }}
178+
179+
- name: Install uv
180+
uses: astral-sh/setup-uv@v4
181+
182+
- name: install dependencies
183+
run: uv sync --extra dev --dev
184+
185+
- name: Download Cached Docker Image
186+
uses: actions/download-artifact@v4
187+
with:
188+
name: subtensor-localnet
189+
190+
- name: Load Docker Image
191+
run: docker load -i subtensor-localnet.tar
192+
193+
- name: Run patched E2E tests
194+
env:
195+
FAST_BLOCKS: "0"
196+
run: |
197+
set +e
198+
for i in 1 2 3; do
111199
echo "🔁 Attempt $i: Running tests"
112200
uv run pytest ${{ matrix.test-file }} -s
113201
status=$?
@@ -116,8 +204,8 @@ jobs:
116204
break
117205
else
118206
echo "❌ Tests failed on attempt $i"
119-
if [ $i -eq 2 ]; then
120-
echo "Tests failed after 2 attempts"
207+
if [ $i -eq 3 ]; then
208+
echo "Tests failed after 3 attempts"
121209
exit 1
122210
fi
123211
echo "Retrying..."
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# This workflow measures the disk size of a virtual environment
2+
# after installing the Bittensor SDK across multiple Python versions.
3+
# It runs only when a new pull request targets the master branch,
4+
# and posts a comment with the results.
5+
name: Monitor SDK Requirements Size
6+
7+
on:
8+
pull_request:
9+
types: [opened, labeled]
10+
branches: [master, staging]
11+
12+
permissions:
13+
pull-requests: write
14+
contents: read
15+
16+
jobs:
17+
measure-venv:
18+
if: github.event_name == 'pull_request' && github.base_ref == 'master' || contains( github.event.pull_request.labels.*.name, 'show-venv-size')
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
23+
outputs:
24+
py39: ${{ steps.set-output.outputs.py39 }}
25+
py310: ${{ steps.set-output.outputs.py310 }}
26+
py311: ${{ steps.set-output.outputs.py311 }}
27+
py312: ${{ steps.set-output.outputs.py312 }}
28+
py313: ${{ steps.set-output.outputs.py313 }}
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Create virtualenv and install
37+
run: |
38+
python -m venv venv
39+
source venv/bin/activate
40+
pip install --upgrade pip
41+
pip install .
42+
43+
- name: Measure venv size
44+
id: set-output
45+
run: |
46+
SIZE=$(du -sm venv | cut -f1)
47+
VERSION=${{ matrix.python-version }}
48+
echo "Detected size: $SIZE MB for Python $VERSION"
49+
case "$VERSION" in
50+
3.9) echo "py39=$SIZE" >> $GITHUB_OUTPUT ;;
51+
3.10) echo "py310=$SIZE" >> $GITHUB_OUTPUT ;;
52+
3.11) echo "py311=$SIZE" >> $GITHUB_OUTPUT ;;
53+
3.12) echo "py312=$SIZE" >> $GITHUB_OUTPUT ;;
54+
3.13) echo "py313=$SIZE" >> $GITHUB_OUTPUT ;;
55+
esac
56+
57+
comment-on-pr:
58+
needs: measure-venv
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Post venv size summary to PR
62+
uses: actions/github-script@v7
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
script: |
66+
const sizes = {
67+
"3.9": "${{ needs.measure-venv.outputs.py39 || 'N/A' }}",
68+
"3.10": "${{ needs.measure-venv.outputs.py310 || 'N/A' }}",
69+
"3.11": "${{ needs.measure-venv.outputs.py311 || 'N/A' }}",
70+
"3.12": "${{ needs.measure-venv.outputs.py312 || 'N/A' }}",
71+
"3.13": "${{ needs.measure-venv.outputs.py313 || 'N/A' }}",
72+
};
73+
74+
const body = [
75+
'**Bittensor SDK virtual environment sizes by Python version:**',
76+
'',
77+
'```'
78+
]
79+
.concat(Object.entries(sizes).map(([v, s]) => `Python ${v}: ${s} MB`))
80+
.concat(['```'])
81+
.join('\n');
82+
83+
github.rest.issues.createComment({
84+
issue_number: context.issue.number,
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
body
88+
});

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Build Python distribution
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717

1818
- name: Set up Python
1919
uses: actions/setup-python@v4
@@ -69,4 +69,4 @@ jobs:
6969
uses: pypa/gh-action-pypi-publish@release/v1
7070
with:
7171
verbose: true
72-
print-hash: true
72+
print-hash: true

0 commit comments

Comments
 (0)