-
Notifications
You must be signed in to change notification settings - Fork 318
118 lines (102 loc) · 3.41 KB
/
e2e-multiple-versions.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
name: E2E tests with multiple versions
on:
workflow_dispatch:
inputs:
bittensor_versions:
description: 'Bittensor versions to test (comma-separated)'
required: true
default: '7.3.0,7.2.0'
bittensor_branch:
description: 'Branch of bittensor'
required: true
default: 'staging'
subtensor_branch:
description: 'Branch of subtensor'
required: true
default: 'testnet'
push:
branches: [main, development, staging]
pull_request:
branches: [main, development, staging]
types: [opened, synchronize, reopened, ready_for_review]
env:
DEFAULT_BITTENSOR_VERSIONS: '7.3.0,7.2.0'
DEFAULT_BITTENSOR_BRANCH: 'staging'
DEFAULT_SUBTENSOR_BRANCH: 'testnet'
RUSTV: nightly-2024-03-05
RUST_BACKTRACE: full
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set up test matrix
id: set-matrix
run: |
versions=$(echo "${{ github.event.inputs.bittensor_versions || env.DEFAULT_BITTENSOR_VERSIONS }}" | jq -R -s -c 'split(",")| map(select(. != ""))')
echo "matrix=${versions}" >> $GITHUB_OUTPUT
test:
needs: setup
runs-on: SubtensorCI
strategy:
fail-fast: false
matrix:
bittensor-version: ${{fromJson(needs.setup.outputs.matrix)}}
rust-target:
- x86_64-unknown-linux-gnu
env:
RUST_BIN_DIR: target/${{ matrix.rust-target }}
TARGET: ${{ matrix.rust-target }}
steps:
- name: Check-out repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.bittensor_branch || env.DEFAULT_BITTENSOR_BRANCH }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Install Rust dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
- name: Install Rust ${{ env.RUSTV }}
uses: actions-rs/[email protected]
with:
toolchain: ${{ env.RUSTV }}
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: Clone subtensor repo
run: git clone https://github.com/opentensor/subtensor.git
- name: Setup subtensor repo
working-directory: ${{ github.workspace }}/subtensor
run: git checkout ${{ github.event.inputs.subtensor_branch || env.DEFAULT_SUBTENSOR_BRANCH }}
- name: Create tox.ini
run: |
cat << EOF > tox.ini
[tox]
envlist = bt-${{ matrix.bittensor-version }}
[testenv]
deps =
pytest
pytest-asyncio
anyio
nest_asyncio
bittensor==${{ matrix.bittensor-version }}
commands =
pytest tests/e2e_tests -v -s {posargs}
passenv =
LOCALNET_SH_PATH
[pytest]
asyncio_mode = auto
EOF
- name: Run tox
env:
LOCALNET_SH_PATH: ${{ github.workspace }}/subtensor/scripts/localnet.sh
run: |
tox -e bt-${{ matrix.bittensor-version }}