-
Notifications
You must be signed in to change notification settings - Fork 7
136 lines (115 loc) · 4.5 KB
/
check_sdk_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Bittensor Checks
concurrency:
group: e2e-sdk-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- master
- staging
types: [opened, synchronize, reopened, labeled, unlabeled]
env:
CARGO_TERM_COLOR: always
VERBOSE: ${{ github.event.inputs.verbose }}
jobs:
check-labels:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.draft == false }}
outputs:
skip-tests: ${{ contains(github.event.pull_request.labels.*.name, 'skip-bittensor-tests') }}
run-sdk-tests: ${{ contains(github.event.pull_request.labels.*.name, 'run-bittensor-sdk-tests') }}
steps:
- name: Check out repository
uses: actions/checkout@v4
find-e2e-tests:
runs-on: ubuntu-latest
outputs:
test-files: ${{ steps.get-tests.outputs.test-files }}
steps:
- name: Research preparation
working-directory: ${{ github.workspace }}
run: git clone https://github.com/opentensor/bittensor.git
- name: Checkout
working-directory: ${{ github.workspace }}/bittensor
run: git checkout staging
- name: Install dependencies
run: sudo apt-get install -y jq
- name: Find e2e test files
id: get-tests
run: |
test_files=$(find ${{ github.workspace }}/bittensor/tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "::set-output name=test-files::$test_files"
shell: bash
run-tests:
needs:
- find-e2e-tests
- check-labels
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false && needs.check-labels.outputs.run-sdk-tests == 'true' }}
strategy:
fail-fast: false
max-parallel: 8
matrix:
rust-branch:
- stable
rust-target:
- x86_64-unknown-linux-gnu
os:
- ubuntu-latest
test-file: ${{ fromJson(needs.find-e2e-tests.outputs.test-files) }}
timeout-minutes: 60
name: "Run Tests: ${{ matrix.test-file }}"
steps:
- name: Check-out repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update &&
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler jq
- name: Install Rust stable
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: stable
components: rustfmt
profile: minimal
- name: Add wasm32-unknown-unknown target
run: |
rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu
- name: Create Python virtual environment
working-directory: ${{ github.workspace }}
run: python3 -m venv venv
- name: Clone Bittensor SDK repo
working-directory: ${{ github.workspace }}
run: git clone https://github.com/opentensor/bittensor.git
- name: Setup Bittensor SDK from cloned repo
working-directory: ${{ github.workspace }}/bittensor
run: |
source ${{ github.workspace }}/venv/bin/activate
git checkout staging
python3 -m pip install --upgrade pip
python3 -m pip install '.[dev]'
python3 -m pip install maturin
- name: Clone Bittensor Wallet repo
run: git clone https://github.com/opentensor/btwallet.git
- name: Checkout PR branch in Wallet repo
working-directory: ${{ github.workspace }}/btwallet
run: |
git fetch origin ${{ github.event.pull_request.head.ref }}
git checkout ${{ github.event.pull_request.head.ref }}
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
- name: Build and install Rust Bittensor Wallet package
working-directory: ${{ github.workspace }}
run: |
source ${{ github.workspace }}/venv/bin/activate
maturin develop
- name: Clone Subtensor repo
working-directory: ${{ github.workspace }}
run: git clone https://github.com/opentensor/subtensor.git
- name: Checkout Subtensor repo to `devnet-ready` branch
working-directory: ${{ github.workspace }}/subtensor
run: git checkout devnet-ready
- name: Run Bittensor SDK e2e test
run: |
source ${{ github.workspace }}/venv/bin/activate
LOCALNET_SH_PATH="${{ github.workspace }}/subtensor/scripts/localnet.sh" pytest ${{ matrix.test-file }} -s