26
26
# job to run tests in parallel
27
27
jobs :
28
28
29
- get-latest-artifact-id :
30
- runs-on : ubuntu-latest
31
-
32
- steps :
33
- - name : Fetch Artifacts List
34
- id : fetch_artifacts
35
- run : |
36
- ARTIFACTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/opentensor/subtensor/actions/artifacts)
37
- echo "$ARTIFACTS" > artifacts.json
38
-
39
- echo "Raw ARTIFACTS response:"
40
- echo "$ARTIFACTS"
41
-
42
- - name : Parse Latest Artifact ID
43
- id : parse_artifact
44
- run : |
45
- LATEST_ARTIFACT_ID=$(jq -r '.artifacts[0].id' artifacts.json)
46
- echo "LATEST_ARTIFACT_ID=$LATEST_ARTIFACT_ID" >> $GITHUB_ENV
47
-
48
- - name : Print Latest Artifact ID
49
- run : |
50
- echo "Latest Artifact ID: ${{ env.LATEST_ARTIFACT_ID }}"
51
-
52
- # Job to find all test files
53
29
find-tests :
54
30
runs-on : ubuntu-latest
55
31
if : ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
@@ -66,81 +42,57 @@ jobs:
66
42
echo "::set-output name=test-files::$test_files"
67
43
shell : bash
68
44
45
+ pull-docker-image :
46
+ runs-on : ubuntu-latest
47
+ steps :
48
+ - name : Log in to GitHub Container Registry (если образ приватный)
49
+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
50
+
51
+ - name : Pull Docker Image
52
+ run : docker pull ghcr.io/opentensor/subtensor-localnet:latest
53
+
54
+ - name : Save Docker Image to Cache
55
+ run : docker save -o subtensor-localnet.tar ghcr.io/opentensor/subtensor-localnet:latest
56
+
57
+ - name : Upload Docker Image as Artifact
58
+ uses : actions/upload-artifact@v3
59
+ with :
60
+ name : subtensor-localnet
61
+ path : subtensor-localnet.tar
62
+ retention-days : 1
63
+
69
64
# Job to run tests in parallel
70
65
run :
71
- needs : find-tests
66
+ needs :
67
+ - find-tests
68
+ - pull-docker-image
72
69
runs-on : ubuntu-latest
73
70
timeout-minutes : 45
74
71
strategy :
75
72
fail-fast : false # Allow other matrix jobs to run even if this job fails
76
73
max-parallel : 8 # Set the maximum number of parallel jobs
77
74
matrix :
78
- rust-branch :
79
- - stable
80
- rust-target :
81
- - x86_64-unknown-linux-gnu
82
75
os :
83
76
- ubuntu-latest
84
77
test-file : ${{ fromJson(needs.find-tests.outputs.test-files) }}
85
- env :
86
- RELEASE_NAME : development
87
- RUSTV : ${{ matrix.rust-branch }}
88
- RUST_BACKTRACE : full
89
- RUST_BIN_DIR : target/${{ matrix.rust-target }}
90
- TARGET : ${{ matrix.rust-target }}
91
78
steps :
92
79
- name : Check-out repository under $GITHUB_WORKSPACE
93
80
uses : actions/checkout@v4
94
81
95
- - name : Install dependencies
96
- run : |
97
- sudo apt-get update &&
98
- sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
82
+ # - name: Install uv
83
+ # uses: astral-sh/setup-uv@v4
84
+ #
85
+ # - name: install dependencies
86
+ # run: uv sync --all-extras --dev
99
87
100
- - name : Install Rust ${{ matrix.rust-branch }}
101
- uses : actions-rs/toolchain@v1.0.6
88
+ - name : Download Cached Docker Image
89
+ uses : actions/download-artifact@v4
102
90
with :
103
- toolchain : ${{ matrix.rust-branch }}
104
- components : rustfmt
105
- profile : minimal
106
-
107
- - name : Add wasm32-unknown-unknown target
108
- run : |
109
- rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu
110
- rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu
111
-
112
- - name : Clone subtensor repo
113
- run : git clone https://github.com/opentensor/subtensor.git
91
+ name : subtensor-localnet
114
92
115
- - name : Setup subtensor repo
116
- working-directory : ${{ github.workspace }}/subtensor
117
- run : git checkout devnet-ready-with-nodes
118
-
119
- - name : Print files and OS info
120
- working-directory : ${{ github.workspace }}/subtensor
121
- run : |
122
- sudo apt install file
123
- echo "File fast-blocks"
124
- file ${{ github.workspace }}/subtensor/nodes/fast-blocks/release/node-subtensor
125
- echo "File non-fast-blocks"
126
- file ${{ github.workspace }}/subtensor/nodes/non-fast-blocks/release/node-subtensor
127
-
128
- echo "uname -m && uname -r"
129
- uname -m && uname -r
130
-
131
- - name : Install uv
132
- uses : astral-sh/setup-uv@v4
133
-
134
- - name : install dependencies
135
- run : uv sync --all-extras --dev
93
+ - name : Load Docker Image
94
+ run : docker load -i subtensor-localnet.tar
136
95
137
96
- name : Run tests
138
97
run : |
139
- ls -lash ${{ github.workspace }}/subtensor/nodes
140
- LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" uv run pytest ${{ matrix.test-file }} -s
141
-
142
- - name : Retry failed tests
143
- if : failure()
144
- run : |
145
- sleep 10
146
- LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" uv run pytest ${{ matrix.test-file }} -s
98
+ pytest ${{ matrix.test-file }} -s
0 commit comments