24
24
VERBOSE : ${{ github.event.inputs.verbose }}
25
25
26
26
jobs :
27
- run-tests :
28
- runs-on : SubtensorCI
29
- if : ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
30
- timeout-minutes : 180
31
- env :
32
- RELEASE_NAME : development
33
- RUSTV : stable
34
- RUST_BACKTRACE : full
35
- RUST_BIN_DIR : target/x86_64-unknown-linux-gnu
36
- TARGET : x86_64-unknown-linux-gnu
37
27
28
+ find-tests :
29
+ runs-on : ubuntu-latest
30
+ if : ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
31
+ outputs :
32
+ test-files : ${{ steps.get-tests.outputs.test-files }}
38
33
steps :
39
34
- name : Check-out repository under $GITHUB_WORKSPACE
40
- uses : actions/checkout@v2
35
+ uses : actions/checkout@v4
41
36
42
- - name : Install dependencies
37
+ - name : Find test files
38
+ id : get-tests
43
39
run : |
44
- sudo apt-get update &&
45
- sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
40
+ test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
41
+ echo "::set-output name=test-files::$test_files"
42
+ shell : bash
43
+
44
+ pull-docker-image :
45
+ runs-on : ubuntu-latest
46
+ steps :
47
+ - name : Log in to GitHub Container Registry
48
+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
49
+
50
+ - name : Pull Docker Image
51
+ run : docker pull ghcr.io/opentensor/subtensor-localnet:devnet-ready
52
+
53
+ - name : Save Docker Image to Cache
54
+ run : docker save -o subtensor-localnet.tar ghcr.io/opentensor/subtensor-localnet:devnet-ready
46
55
47
- - name : Install Rust ${{ env.RUSTV }}
48
- uses :
actions-rs/[email protected]
56
+ - name : Upload Docker Image as Artifact
57
+ uses : actions/upload-artifact@v4
49
58
with :
50
- toolchain : ${{ env.RUSTV }}
51
- components : rustfmt
52
- profile : minimal
59
+ name : subtensor-localnet
60
+ path : subtensor-localnet.tar
53
61
54
- - name : Add wasm32-unknown-unknown target
55
- run : |
56
- rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu
57
- rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu
62
+ run-e2e-tests :
63
+ name : ${{ matrix.test-file }} / Python ${{ matrix.python-version }}
64
+ needs :
65
+ - find-tests
66
+ - pull-docker-image
67
+ runs-on : ubuntu-latest
68
+ timeout-minutes : 45
69
+ strategy :
70
+ fail-fast : false # Allow other matrix jobs to run even if this job fails
71
+ max-parallel : 32 # Set the maximum number of parallel jobs (same as we have cores in SubtensorCI runner)
72
+ matrix :
73
+ os :
74
+ - ubuntu-latest
75
+ test-file : ${{ fromJson(needs.find-tests.outputs.test-files) }}
76
+ python-version : ["3.9", "3.10", "3.11", "3.12", "3.13"]
77
+ steps :
78
+ - name : Check-out repository
79
+ uses : actions/checkout@v4
80
+
81
+ - name : Install uv
82
+ uses : astral-sh/setup-uv@v4
83
+ with :
84
+ python-version : 3.13
58
85
59
- - name : Clone subtensor repo
60
- run : git clone https://github.com/opentensor/subtensor.git
86
+ - name : install dependencies
87
+ run : |
88
+ uv venv .venv
89
+ source .venv/bin/activate
90
+ uv pip install .[dev]
91
+ uv pip install pytest
61
92
62
- - name : Setup subtensor repo
63
- working-directory : ${{ github.workspace }}/subtensor
64
- run : git checkout testnet
93
+ - name : Download Cached Docker Image
94
+ uses : actions/download-artifact@v4
95
+ with :
96
+ name : subtensor-localnet
65
97
66
- - name : Install Python dependencies
67
- run : python3 -m pip install -e . pytest
98
+ - name : Load Docker Image
99
+ run : docker load -i subtensor-localnet.tar
68
100
69
- - name : Run all tests
101
+ - name : Run tests
70
102
run : |
71
- LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest tests/e2e_tests -s
103
+ source .venv/bin/activate
104
+ uv run pytest ${{ matrix.test-file }} -s
0 commit comments