From 436b3bf45fedf5b8fa95e96b2ec255702b2969ac Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:22:22 -0700 Subject: [PATCH 01/11] add ruff checker --- .github/workflows/ruff.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/ruff.yml diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000000..7dfaf2eda5 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,33 @@ +name: Ruff - formatter check +permissions: + contents: read + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + ruff: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Ruff in virtual environment + run: | + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install ruff==0.11.5 + + - name: Ruff format check + run: | + source venv/bin/activate + python -m ruff format --diff bittensor From 76da2ef27ec502c1d18fbdb4cd163cb8bd3fa006 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:25:41 -0700 Subject: [PATCH 02/11] add flake8 and mypy checkers --- .github/workflows/flake8-and-mypy.yml | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/flake8-and-mypy.yml diff --git a/.github/workflows/flake8-and-mypy.yml b/.github/workflows/flake8-and-mypy.yml new file mode 100644 index 0000000000..1fbe094728 --- /dev/null +++ b/.github/workflows/flake8-and-mypy.yml @@ -0,0 +1,56 @@ +name: Flake8 and Mypy - linters check +permissions: + contents: read + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + linters: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + strategy: + fail-fast: false + max-parallel: 5 + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache venv + id: cache + uses: actions/cache@v4 + with: + path: venv + key: | + v3-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} + restore-keys: | + v3-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}- + + - name: Install deps (flake8 + mypy + project.dev) + if: ${{ steps.cache.outputs.cache-hit != 'true' }} + run: | + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install uv + python -m uv sync --extra dev --active + + - name: Flake8 + run: | + source venv/bin/activate + python -m flake8 bittensor/ --count + + - name: mypy + run: | + source venv/bin/activate + python -m mypy --ignore-missing-imports bittensor/ From 1b1301b70129fd4f523e5daaec7a216578bd9d1b Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:25:52 -0700 Subject: [PATCH 03/11] add tests checkers --- .../workflows/unit-and-integration-tests.yml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/unit-and-integration-tests.yml diff --git a/.github/workflows/unit-and-integration-tests.yml b/.github/workflows/unit-and-integration-tests.yml new file mode 100644 index 0000000000..64f9404167 --- /dev/null +++ b/.github/workflows/unit-and-integration-tests.yml @@ -0,0 +1,53 @@ +name: Unit tests checker +permissions: + contents: read + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + unit-tests: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Cache venv + id: cache + uses: actions/cache@v4 + with: + path: venv + key: v2-${{ runner.os }}-${{ hashFiles('pyproject.toml') }} + + - name: Install deps + if: ${{ steps.cache.outputs.cache-hit != 'true' }} + run: | + python -m venv venv + source venv/bin/activate + python -m pip install --upgrade pip + python -m pip install uv + python -m uv sync --extra dev --active + + - name: Unit tests + timeout-minutes: 20 + env: + PYTHONUNBUFFERED: "1" + run: | + source venv/bin/activate + python -m uv run pytest -n 2 tests/unit_tests/ --reruns 3 + + - name: Integration tests + timeout-minutes: 20 + env: + PYTHONUNBUFFERED: "1" + run: | + source venv/bin/activate + python -m uv run pytest -n 2 tests/integration_tests/ --reruns 3 From bf7caad66fa56fc4e151a8c9e86f870bc6dd11ca Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:26:00 -0700 Subject: [PATCH 04/11] add compatibility checkers --- .github/workflows/compatibility.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/compatibility.yml diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml new file mode 100644 index 0000000000..2ef9a1b95f --- /dev/null +++ b/.github/workflows/compatibility.yml @@ -0,0 +1,27 @@ +name: Requirements compatibility for supported Python versions +permissions: + contents: read + +on: + pull_request: + paths: + - "pyproject.toml" + +jobs: + compatibility: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - run: | + python -m pip install --upgrade pip + python -m pip install ".[dev,cli]" --dry-run --no-deps From 3078d1970d6b95721a21ef9b42aa9c7b71688500 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:26:17 -0700 Subject: [PATCH 05/11] add changelog checker --- .github/workflows/changelog-checker.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/changelog-checker.yml diff --git a/.github/workflows/changelog-checker.yml b/.github/workflows/changelog-checker.yml new file mode 100644 index 0000000000..9342a34344 --- /dev/null +++ b/.github/workflows/changelog-checker.yml @@ -0,0 +1,21 @@ +name: Changelog guard (for release of hotfix) +on: + pull_request: + branches: + - 'release/**' + - 'Release/**' + - 'hotfix/**' + - 'Hotfix/**' + +jobs: + changelog: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: tj-actions/changed-files@v42 + id: changed + - name: Ensure CHANGELOG.md updated + if: contains(steps.changed.outputs.all_changed_files, 'CHANGELOG.md') == false + uses: actions/github-script@v7 + with: + script: core.setFailed('CHANGELOG.md must be updated.') From 0688326b6c4a069940690419f6754e28c14a45e9 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:27:42 -0700 Subject: [PATCH 06/11] temporarily comment on the ci workflow --- .circleci/config.yml | 607 ++++++++++++++++++++++--------------------- 1 file changed, 307 insertions(+), 300 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1c14c8730a..509936a34c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,300 +1,307 @@ -version: 2.1 - -orbs: - python: circleci/python@2.1.1 - python-lib: dialogue/python-lib@0.1.55 - -jobs: - check-if-pr-is-draft: - docker: - - image: cimg/python:3.10 - steps: - - checkout - - run: - name: Install jq - command: sudo apt-get update && sudo apt-get install -y jq - - run: - name: Check if PR is a draft - command: .circleci/check_pr_status.sh - - ruff: - resource_class: small - parameters: - python-version: - type: string - docker: - - image: cimg/python:<< parameters.python-version >> - - steps: - - checkout - - - restore_cache: - name: Restore cached ruff venv - keys: - - v2-pypi-py-ruff-<< parameters.python-version >> - - - run: - name: Update & Activate ruff venv - command: | - python -m venv .venv - . .venv/bin/activate - python -m pip install --upgrade uv - uv pip install ruff==0.11.5 - - - save_cache: - name: Save cached ruff venv - paths: - - ".venv/" - key: v2-pypi-py-ruff-<< parameters.python-version >> - - - run: - name: Ruff format check - command: | - . .venv/bin/activate - ruff format --diff . - - check_compatibility: - parameters: - python_version: - type: string - docker: - - image: cimg/python:3.10 - steps: - - checkout - - run: - name: Check if requirements files have changed - command: ./scripts/check_requirements_changes.sh - - run: - name: Install dependencies and Check compatibility - command: | - if [ "$REQUIREMENTS_CHANGED" == "true" ]; then - python -m pip install ".[dev,cli]" --dry-run --python-version << parameters.python_version >> --no-deps - else - echo "Skipping compatibility checks..." - fi - - build-and-test: - resource_class: medium - parallelism: 2 - parameters: - python-version: - type: string - docker: - - image: cimg/python:<< parameters.python-version >> - - steps: - - checkout - - - run: - name: Update & Activate venv - command: | - python -m venv .venv - . .venv/bin/activate - python -m pip install --upgrade uv - uv sync --extra dev --dev - - - run: - name: Install Bittensor - command: | - . .venv/bin/activate - uv sync --extra dev --dev - - - run: - name: Instantiate Mock Wallet - command: | - . .venv/bin/activate - ./scripts/create_wallet.sh - - - run: - name: Unit Tests - no_output_timeout: 20m - command: | - . .venv/bin/activate - export PYTHONUNBUFFERED=1 - pytest -n2 --reruns 3 --durations=0 --verbose --junitxml=test-results/unit_tests.xml \ - --cov=. --cov-append --cov-config .coveragerc \ - --splits $CIRCLE_NODE_TOTAL --group $((CIRCLE_NODE_INDEX + 1)) \ - --splitting-algorithm duration_based_chunks --store-durations --durations-path .test_durations \ - tests/unit_tests/ - - - run: - name: Integration Tests - no_output_timeout: 30m - command: | - . .venv/bin/activate - export PYTHONUNBUFFERED=1 - pytest -n2 --reruns 3 --reruns-delay 15 --durations=0 --verbose --junitxml=test-results/integration_tests.xml \ - --cov=. --cov-append --cov-config .coveragerc \ - --splits $CIRCLE_NODE_TOTAL --group $((CIRCLE_NODE_INDEX + 1)) \ - --splitting-algorithm duration_based_chunks --store-durations --durations-path .test_durations \ - tests/integration_tests/ - - - store_test_results: - path: test-results - - store_artifacts: - path: test-results - - - #- when: - #condition: - #equal: ["3.10.5", << parameters.python-version >> ] - #steps: - #- run: - #name: Upload Coverage - #command: | - #. .venv/bin/activate && coveralls - #env: - #CI_NAME: circleci - #CI_BUILD_NUMBER: $CIRCLE_BUILD_NUM - #CI_BUILD_URL: $CIRCLE_BUILD_URL - #CI_BRANCH: $CIRCLE_BRANCH - #CI_JOB_ID: $CIRCLE_NODE_INDEX - #COVERALLS_PARALLEL: true - - - lint-and-type-check: - resource_class: medium - parallelism: 2 - parameters: - python-version: - type: string - docker: - - image: cimg/python:<< parameters.python-version >> - - steps: - - checkout - - - run: - name: Update & Activate venv - command: | - python -m venv .venv - . .venv/bin/activate - python -m pip install --upgrade uv - uv sync --extra dev --dev - uv pip install flake8 - - - run: - name: Install Bittensor - command: | - . .venv/bin/activate - uv sync --extra dev --dev - - - run: - name: Lint with flake8 - command: | - . .venv/bin/activate - python -m flake8 bittensor/ --count - - - run: - name: Type check with mypy - command: | - . .venv/bin/activate - python -m mypy --ignore-missing-imports bittensor/ - - unit-tests-all-python-versions: - docker: - - image: cimg/python:3.10 - steps: - - run: - name: Placeholder command - command: echo "Success, only runs if all python versions ran" - - coveralls: - docker: - - image: cimg/python:3.10 - steps: - - run: - name: Combine Coverage - command: | - uv pip install --upgrade coveralls - coveralls --finish --rcfile .coveragerc || echo "Failed to upload coverage" - - check-changelog-updated: - docker: - - image: cimg/python:3.10 - steps: - - checkout - - run: - name: File CHANGELOG.md is updated - command: | - [[ $(git diff-tree --no-commit-id --name-only -r HEAD..master | grep CHANGELOG.md | wc -l) == 1 ]] && echo "CHANGELOG.md has changed" - - check-version-not-released: - docker: - - image: cimg/python:3.10 - steps: - - checkout - - run: - name: Git tag does not exist for the current version - command: | - [[ $(git tag | grep `cat VERSION` | wc -l) == 0 ]] && echo "VERSION is not a tag" - - run: - name: Pypi package 'bittensor' does not exist for the current version - command: | - [[ $(pip index versions bittensor | grep `cat VERSION` | wc -l) == 0 ]] && echo "Pypi package 'bittensor' does not exist" - - run: - name: Docker image 'opentensorfdn/bittensor' does not exist for the current version - command: | - [[ $(docker manifest inspect opentensorfdn/bittensor:`cat VERSION` > /dev/null 2> /dev/null ; echo $?) == 1 ]] && echo "Docker image 'opentensorfdn/bittensor:`cat VERSION`' does not exist in dockerhub" - -workflows: - compatibility_checks: - jobs: - - check_compatibility: - python_version: "3.9" - name: check-compatibility-3.9 - - check_compatibility: - python_version: "3.10" - name: check-compatibility-3.10 - - check_compatibility: - python_version: "3.11" - name: check-compatibility-3.11 - - check_compatibility: - python_version: "3.12" - name: check-compatibility-3.12 - - check_compatibility: - python_version: "3.13" - name: check-compatibility-3.13 - - - pr-requirements: - jobs: - - check-if-pr-is-draft - - ruff: - python-version: "3.9.13" - requires: - - check-if-pr-is-draft - - build-and-test: - matrix: - parameters: - python-version: [ "3.9.13", "3.10.6", "3.11.4", "3.12.7", "3.13.1" ] - requires: - - check-if-pr-is-draft - - unit-tests-all-python-versions: - requires: - - build-and-test - - lint-and-type-check: - matrix: - parameters: - python-version: [ "3.9.13", "3.10.6", "3.11.4", "3.12.7", "3.13.1" ] - requires: - - check-if-pr-is-draft - #- coveralls: - #requires: - #- build-and-test - - release-branches-requirements: - jobs: - - check-changelog-updated: - filters: - branches: - only: - - /^(release|hotfix)/.*/ - - release-requirements: - jobs: - - check-version-not-released: - filters: - branches: - only: - - master +#version: 2.1 +# +#orbs: +# python: circleci/python@2.1.1 +# python-lib: dialogue/python-lib@0.1.55 +# +#jobs: +# check-if-pr-is-draft: +# docker: +# - image: cimg/python:3.10 +# steps: +# - checkout +# - run: +# name: Install jq +# command: sudo apt-get update && sudo apt-get install -y jq +# - run: +# name: Check if PR is a draft +# command: .circleci/check_pr_status.sh +# +# ruff: +# resource_class: small +# parameters: +# python-version: +# type: string +# docker: +# - image: cimg/python:<< parameters.python-version >> +# +# steps: +# - checkout +# +# - restore_cache: +# name: Restore cached ruff venv +# keys: +# - v2-pypi-py-ruff-<< parameters.python-version >> +# +# - run: +# name: Update & Activate ruff venv +# command: | +# python -m venv .venv +# . .venv/bin/activate +# python -m pip install --upgrade uv +# uv pip install ruff==0.11.5 +# +# - save_cache: +# name: Save cached ruff venv +# paths: +# - ".venv/" +# key: v2-pypi-py-ruff-<< parameters.python-version >> +# +# - run: +# name: Ruff format check +# command: | +# . .venv/bin/activate +# ruff format --diff . +# +# +# check_compatibility: +# parameters: +# python_version: +# type: string +# docker: +# - image: cimg/python:3.10 +# steps: +# - checkout +# - run: +# name: Check if requirements files have changed +# command: ./scripts/check_requirements_changes.sh +# - run: +# name: Install dependencies and Check compatibility +# command: | +# if [ "$REQUIREMENTS_CHANGED" == "true" ]; then +# python -m pip install ".[dev,cli]" --dry-run --python-version << parameters.python_version >> --no-deps +# else +# echo "Skipping compatibility checks..." +# fi +# +# +# build-and-test: +# resource_class: medium +# parallelism: 2 +# parameters: +# python-version: +# type: string +# docker: +# - image: cimg/python:<< parameters.python-version >> +# +# steps: +# - checkout +# +# - run: +# name: Update & Activate venv +# command: | +# python -m venv .venv +# . .venv/bin/activate +# python -m pip install --upgrade uv +# uv sync --extra dev --dev +# +# - run: +# name: Install Bittensor +# command: | +# . .venv/bin/activate +# uv sync --extra dev --dev +# +# - run: +# name: Instantiate Mock Wallet +# command: | +# . .venv/bin/activate +# ./scripts/create_wallet.sh +# +# - run: +# name: Unit Tests +# no_output_timeout: 20m +# command: | +# . .venv/bin/activate +# export PYTHONUNBUFFERED=1 +# pytest -n2 --reruns 3 --durations=0 --verbose --junitxml=test-results/unit_tests.xml \ +# --cov=. --cov-append --cov-config .coveragerc \ +# --splits $CIRCLE_NODE_TOTAL --group $((CIRCLE_NODE_INDEX + 1)) \ +# --splitting-algorithm duration_based_chunks --store-durations --durations-path .test_durations \ +# tests/unit_tests/ +# +# - run: +# name: Integration Tests +# no_output_timeout: 30m +# command: | +# . .venv/bin/activate +# export PYTHONUNBUFFERED=1 +# pytest -n2 --reruns 3 --reruns-delay 15 --durations=0 --verbose --junitxml=test-results/integration_tests.xml \ +# --cov=. --cov-append --cov-config .coveragerc \ +# --splits $CIRCLE_NODE_TOTAL --group $((CIRCLE_NODE_INDEX + 1)) \ +# --splitting-algorithm duration_based_chunks --store-durations --durations-path .test_durations \ +# tests/integration_tests/ +# +# - store_test_results: +# path: test-results +# - store_artifacts: +# path: test-results +# +# +# #- when: +# #condition: +# #equal: ["3.10.5", << parameters.python-version >> ] +# #steps: +# #- run: +# #name: Upload Coverage +# #command: | +# #. .venv/bin/activate && coveralls +# #env: +# #CI_NAME: circleci +# #CI_BUILD_NUMBER: $CIRCLE_BUILD_NUM +# #CI_BUILD_URL: $CIRCLE_BUILD_URL +# #CI_BRANCH: $CIRCLE_BRANCH +# #CI_JOB_ID: $CIRCLE_NODE_INDEX +# #COVERALLS_PARALLEL: true +# +# lint-and-type-check: +# resource_class: medium +# parallelism: 2 +# parameters: +# python-version: +# type: string +# docker: +# - image: cimg/python:<< parameters.python-version >> +# +# steps: +# - checkout +# +# - run: +# name: Update & Activate venv +# command: | +# python -m venv .venv +# . .venv/bin/activate +# python -m pip install --upgrade uv +# uv sync --extra dev --dev +# uv pip install flake8 +# +# - run: +# name: Install Bittensor +# command: | +# . .venv/bin/activate +# uv sync --extra dev --dev +# +# - run: +# name: Lint with flake8 +# command: | +# . .venv/bin/activate +# python -m flake8 bittensor/ --count +# +# - run: +# name: Type check with mypy +# command: | +# . .venv/bin/activate +# python -m mypy --ignore-missing-imports bittensor/ +# +# +# unit-tests-all-python-versions: +# docker: +# - image: cimg/python:3.10 +# steps: +# - run: +# name: Placeholder command +# command: echo "Success, only runs if all python versions ran" +# +# coveralls: +# docker: +# - image: cimg/python:3.10 +# steps: +# - run: +# name: Combine Coverage +# command: | +# uv pip install --upgrade coveralls +# coveralls --finish --rcfile .coveragerc || echo "Failed to upload coverage" +# +# +# +# check-changelog-updated: +# docker: +# - image: cimg/python:3.10 +# steps: +# - checkout +# - run: +# name: File CHANGELOG.md is updated +# command: | +# [[ $(git diff-tree --no-commit-id --name-only -r HEAD..master | grep CHANGELOG.md | wc -l) == 1 ]] && echo "CHANGELOG.md has changed" +# +# +# +# check-version-not-released: +# docker: +# - image: cimg/python:3.10 +# steps: +# - checkout +# - run: +# name: Git tag does not exist for the current version +# command: | +# [[ $(git tag | grep `cat VERSION` | wc -l) == 0 ]] && echo "VERSION is not a tag" +# - run: +# name: Pypi package 'bittensor' does not exist for the current version +# command: | +# [[ $(pip index versions bittensor | grep `cat VERSION` | wc -l) == 0 ]] && echo "Pypi package 'bittensor' does not exist" +# - run: +# name: Docker image 'opentensorfdn/bittensor' does not exist for the current version +# command: | +# [[ $(docker manifest inspect opentensorfdn/bittensor:`cat VERSION` > /dev/null 2> /dev/null ; echo $?) == 1 ]] && echo "Docker image 'opentensorfdn/bittensor:`cat VERSION`' does not exist in dockerhub" +# +# +#workflows: +# compatibility_checks: +# jobs: +# - check_compatibility: +# python_version: "3.9" +# name: check-compatibility-3.9 +# - check_compatibility: +# python_version: "3.10" +# name: check-compatibility-3.10 +# - check_compatibility: +# python_version: "3.11" +# name: check-compatibility-3.11 +# - check_compatibility: +# python_version: "3.12" +# name: check-compatibility-3.12 +# - check_compatibility: +# python_version: "3.13" +# name: check-compatibility-3.13 +# +# +# pr-requirements: +# jobs: +# - check-if-pr-is-draft +# - ruff: +# python-version: "3.9.13" +# requires: +# - check-if-pr-is-draft +# - build-and-test: +# matrix: +# parameters: +# python-version: [ "3.9.13", "3.10.6", "3.11.4", "3.12.7", "3.13.1" ] +# requires: +# - check-if-pr-is-draft +# - unit-tests-all-python-versions: +# requires: +# - build-and-test +# - lint-and-type-check: +# matrix: +# parameters: +# python-version: [ "3.9.13", "3.10.6", "3.11.4", "3.12.7", "3.13.1" ] +# requires: +# - check-if-pr-is-draft +# #- coveralls: +# #requires: +# #- build-and-test +# +# release-branches-requirements: +# jobs: +# - check-changelog-updated: +# filters: +# branches: +# only: +# - /^(release|hotfix)/.*/ +# +# release-requirements: +# jobs: +# - check-version-not-released: +# filters: +# branches: +# only: +# - master From 4a8a9472c8125b8a4cb405f3547a48bff210a371 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:30:29 -0700 Subject: [PATCH 07/11] add permissions and delete CI workflow --- .circleci/check_pr_status.sh | 26 -- .circleci/config.yml | 307 ------------------------ .github/workflows/changelog-checker.yml | 4 + 3 files changed, 4 insertions(+), 333 deletions(-) delete mode 100755 .circleci/check_pr_status.sh delete mode 100644 .circleci/config.yml diff --git a/.circleci/check_pr_status.sh b/.circleci/check_pr_status.sh deleted file mode 100755 index 4b31a29698..0000000000 --- a/.circleci/check_pr_status.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Extract the repository owner -REPO_OWNER=$(echo $CIRCLE_PULL_REQUEST | awk -F'/' '{print $(NF-3)}') - -# Extract the repository name -REPO_NAME=$(echo $CIRCLE_PULL_REQUEST | awk -F'/' '{print $(NF-2)}') - -# Extract the pull request number -PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | awk -F'/' '{print $NF}') - - -PR_DETAILS=$(curl -s \ - "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls/$PR_NUMBER") - - -IS_DRAFT=$(echo "$PR_DETAILS" | jq -r .draft) -echo $IS_DRAFT - -if [ "$IS_DRAFT" == "true" ]; then - echo "This PR is a draft. Skipping the workflow." - exit 1 -else - echo "This PR is not a draft. Proceeding with the workflow." - exit 0 -fi diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 509936a34c..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,307 +0,0 @@ -#version: 2.1 -# -#orbs: -# python: circleci/python@2.1.1 -# python-lib: dialogue/python-lib@0.1.55 -# -#jobs: -# check-if-pr-is-draft: -# docker: -# - image: cimg/python:3.10 -# steps: -# - checkout -# - run: -# name: Install jq -# command: sudo apt-get update && sudo apt-get install -y jq -# - run: -# name: Check if PR is a draft -# command: .circleci/check_pr_status.sh -# -# ruff: -# resource_class: small -# parameters: -# python-version: -# type: string -# docker: -# - image: cimg/python:<< parameters.python-version >> -# -# steps: -# - checkout -# -# - restore_cache: -# name: Restore cached ruff venv -# keys: -# - v2-pypi-py-ruff-<< parameters.python-version >> -# -# - run: -# name: Update & Activate ruff venv -# command: | -# python -m venv .venv -# . .venv/bin/activate -# python -m pip install --upgrade uv -# uv pip install ruff==0.11.5 -# -# - save_cache: -# name: Save cached ruff venv -# paths: -# - ".venv/" -# key: v2-pypi-py-ruff-<< parameters.python-version >> -# -# - run: -# name: Ruff format check -# command: | -# . .venv/bin/activate -# ruff format --diff . -# -# -# check_compatibility: -# parameters: -# python_version: -# type: string -# docker: -# - image: cimg/python:3.10 -# steps: -# - checkout -# - run: -# name: Check if requirements files have changed -# command: ./scripts/check_requirements_changes.sh -# - run: -# name: Install dependencies and Check compatibility -# command: | -# if [ "$REQUIREMENTS_CHANGED" == "true" ]; then -# python -m pip install ".[dev,cli]" --dry-run --python-version << parameters.python_version >> --no-deps -# else -# echo "Skipping compatibility checks..." -# fi -# -# -# build-and-test: -# resource_class: medium -# parallelism: 2 -# parameters: -# python-version: -# type: string -# docker: -# - image: cimg/python:<< parameters.python-version >> -# -# steps: -# - checkout -# -# - run: -# name: Update & Activate venv -# command: | -# python -m venv .venv -# . .venv/bin/activate -# python -m pip install --upgrade uv -# uv sync --extra dev --dev -# -# - run: -# name: Install Bittensor -# command: | -# . .venv/bin/activate -# uv sync --extra dev --dev -# -# - run: -# name: Instantiate Mock Wallet -# command: | -# . .venv/bin/activate -# ./scripts/create_wallet.sh -# -# - run: -# name: Unit Tests -# no_output_timeout: 20m -# command: | -# . .venv/bin/activate -# export PYTHONUNBUFFERED=1 -# pytest -n2 --reruns 3 --durations=0 --verbose --junitxml=test-results/unit_tests.xml \ -# --cov=. --cov-append --cov-config .coveragerc \ -# --splits $CIRCLE_NODE_TOTAL --group $((CIRCLE_NODE_INDEX + 1)) \ -# --splitting-algorithm duration_based_chunks --store-durations --durations-path .test_durations \ -# tests/unit_tests/ -# -# - run: -# name: Integration Tests -# no_output_timeout: 30m -# command: | -# . .venv/bin/activate -# export PYTHONUNBUFFERED=1 -# pytest -n2 --reruns 3 --reruns-delay 15 --durations=0 --verbose --junitxml=test-results/integration_tests.xml \ -# --cov=. --cov-append --cov-config .coveragerc \ -# --splits $CIRCLE_NODE_TOTAL --group $((CIRCLE_NODE_INDEX + 1)) \ -# --splitting-algorithm duration_based_chunks --store-durations --durations-path .test_durations \ -# tests/integration_tests/ -# -# - store_test_results: -# path: test-results -# - store_artifacts: -# path: test-results -# -# -# #- when: -# #condition: -# #equal: ["3.10.5", << parameters.python-version >> ] -# #steps: -# #- run: -# #name: Upload Coverage -# #command: | -# #. .venv/bin/activate && coveralls -# #env: -# #CI_NAME: circleci -# #CI_BUILD_NUMBER: $CIRCLE_BUILD_NUM -# #CI_BUILD_URL: $CIRCLE_BUILD_URL -# #CI_BRANCH: $CIRCLE_BRANCH -# #CI_JOB_ID: $CIRCLE_NODE_INDEX -# #COVERALLS_PARALLEL: true -# -# lint-and-type-check: -# resource_class: medium -# parallelism: 2 -# parameters: -# python-version: -# type: string -# docker: -# - image: cimg/python:<< parameters.python-version >> -# -# steps: -# - checkout -# -# - run: -# name: Update & Activate venv -# command: | -# python -m venv .venv -# . .venv/bin/activate -# python -m pip install --upgrade uv -# uv sync --extra dev --dev -# uv pip install flake8 -# -# - run: -# name: Install Bittensor -# command: | -# . .venv/bin/activate -# uv sync --extra dev --dev -# -# - run: -# name: Lint with flake8 -# command: | -# . .venv/bin/activate -# python -m flake8 bittensor/ --count -# -# - run: -# name: Type check with mypy -# command: | -# . .venv/bin/activate -# python -m mypy --ignore-missing-imports bittensor/ -# -# -# unit-tests-all-python-versions: -# docker: -# - image: cimg/python:3.10 -# steps: -# - run: -# name: Placeholder command -# command: echo "Success, only runs if all python versions ran" -# -# coveralls: -# docker: -# - image: cimg/python:3.10 -# steps: -# - run: -# name: Combine Coverage -# command: | -# uv pip install --upgrade coveralls -# coveralls --finish --rcfile .coveragerc || echo "Failed to upload coverage" -# -# -# -# check-changelog-updated: -# docker: -# - image: cimg/python:3.10 -# steps: -# - checkout -# - run: -# name: File CHANGELOG.md is updated -# command: | -# [[ $(git diff-tree --no-commit-id --name-only -r HEAD..master | grep CHANGELOG.md | wc -l) == 1 ]] && echo "CHANGELOG.md has changed" -# -# -# -# check-version-not-released: -# docker: -# - image: cimg/python:3.10 -# steps: -# - checkout -# - run: -# name: Git tag does not exist for the current version -# command: | -# [[ $(git tag | grep `cat VERSION` | wc -l) == 0 ]] && echo "VERSION is not a tag" -# - run: -# name: Pypi package 'bittensor' does not exist for the current version -# command: | -# [[ $(pip index versions bittensor | grep `cat VERSION` | wc -l) == 0 ]] && echo "Pypi package 'bittensor' does not exist" -# - run: -# name: Docker image 'opentensorfdn/bittensor' does not exist for the current version -# command: | -# [[ $(docker manifest inspect opentensorfdn/bittensor:`cat VERSION` > /dev/null 2> /dev/null ; echo $?) == 1 ]] && echo "Docker image 'opentensorfdn/bittensor:`cat VERSION`' does not exist in dockerhub" -# -# -#workflows: -# compatibility_checks: -# jobs: -# - check_compatibility: -# python_version: "3.9" -# name: check-compatibility-3.9 -# - check_compatibility: -# python_version: "3.10" -# name: check-compatibility-3.10 -# - check_compatibility: -# python_version: "3.11" -# name: check-compatibility-3.11 -# - check_compatibility: -# python_version: "3.12" -# name: check-compatibility-3.12 -# - check_compatibility: -# python_version: "3.13" -# name: check-compatibility-3.13 -# -# -# pr-requirements: -# jobs: -# - check-if-pr-is-draft -# - ruff: -# python-version: "3.9.13" -# requires: -# - check-if-pr-is-draft -# - build-and-test: -# matrix: -# parameters: -# python-version: [ "3.9.13", "3.10.6", "3.11.4", "3.12.7", "3.13.1" ] -# requires: -# - check-if-pr-is-draft -# - unit-tests-all-python-versions: -# requires: -# - build-and-test -# - lint-and-type-check: -# matrix: -# parameters: -# python-version: [ "3.9.13", "3.10.6", "3.11.4", "3.12.7", "3.13.1" ] -# requires: -# - check-if-pr-is-draft -# #- coveralls: -# #requires: -# #- build-and-test -# -# release-branches-requirements: -# jobs: -# - check-changelog-updated: -# filters: -# branches: -# only: -# - /^(release|hotfix)/.*/ -# -# release-requirements: -# jobs: -# - check-version-not-released: -# filters: -# branches: -# only: -# - master diff --git a/.github/workflows/changelog-checker.yml b/.github/workflows/changelog-checker.yml index 9342a34344..7407e21607 100644 --- a/.github/workflows/changelog-checker.yml +++ b/.github/workflows/changelog-checker.yml @@ -1,4 +1,8 @@ name: Changelog guard (for release of hotfix) + +permissions: + contents: read + on: pull_request: branches: From 47ea90e0fa48e97724b7aef38a24657bc6e14810 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:34:56 -0700 Subject: [PATCH 08/11] remove deprecated workflow --- .github/workflows/auto-assign.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/workflows/auto-assign.yml diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml deleted file mode 100644 index 3a952f91b8..0000000000 --- a/.github/workflows/auto-assign.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Auto Assign Cortex to Pull Requests - -on: - pull_request: - types: [opened, reopened] - -jobs: - auto-assign: - runs-on: ubuntu-latest - steps: - - name: Auto-assign Cortex Team - uses: kentaro-m/auto-assign-action@v1.2.4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - configuration-path: .github/auto_assign.yml \ No newline at end of file From 0ea23382405699fe5588cad0735408f0cb1478ef Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:41:09 -0700 Subject: [PATCH 09/11] rename job --- .github/workflows/unit-and-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-and-integration-tests.yml b/.github/workflows/unit-and-integration-tests.yml index 64f9404167..b74e9bd36e 100644 --- a/.github/workflows/unit-and-integration-tests.yml +++ b/.github/workflows/unit-and-integration-tests.yml @@ -7,7 +7,7 @@ on: types: [opened, synchronize, reopened, edited] jobs: - unit-tests: + tests: if: github.event.pull_request.draft == false runs-on: ubuntu-latest From c5c3cad6054c578ba7535575e64e937cb51c0651 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:44:01 -0700 Subject: [PATCH 10/11] rename and add matrix --- .github/workflows/unit-and-integration-tests.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-and-integration-tests.yml b/.github/workflows/unit-and-integration-tests.yml index b74e9bd36e..206aaa6842 100644 --- a/.github/workflows/unit-and-integration-tests.yml +++ b/.github/workflows/unit-and-integration-tests.yml @@ -7,10 +7,16 @@ on: types: [opened, synchronize, reopened, edited] jobs: - tests: + unit-and-integration-tests: if: github.event.pull_request.draft == false runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 5 + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + steps: - name: Checkout repository uses: actions/checkout@v4 From ad517e739e1c5585ee1188dd9a13ee7e2abe72cb Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 15 Jul 2025 14:59:02 -0700 Subject: [PATCH 11/11] update workflow name --- .github/workflows/unit-and-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-and-integration-tests.yml b/.github/workflows/unit-and-integration-tests.yml index 206aaa6842..7bc70ae030 100644 --- a/.github/workflows/unit-and-integration-tests.yml +++ b/.github/workflows/unit-and-integration-tests.yml @@ -1,4 +1,4 @@ -name: Unit tests checker +name: Unit and integration tests checker permissions: contents: read