-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (89 loc) · 2.83 KB
/
netsim_integration.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
name: netsim-integration-CI
on:
pull_request:
push:
branches:
- main
env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
MSRV: "1.63"
jobs:
netsim-integration-tests:
name: Run network simulations/benchmarks
runs-on: [self-hosted, linux, X64]
permissions:
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@master
with:
submodules: recursive
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install netsim deps
run: |
cd netsim
sudo apt update
./setup.sh
- name: Build chuck
run: |
cargo build --release
- name: Fetch and build iroh
run: |
git clone https://github.com/n0-computer/iroh.git
cd iroh
cargo build --release
- name: Fetch and build iroh-ffi
run: |
git clone https://github.com/n0-computer/iroh-ffi.git
cd iroh-ffi
echo "iroh = { path = \"../iroh\" }" >> Cargo.toml
pip3 install maturin uniffi-bindgen
maturin build --release
- name: Copy binaries to right location
run: |
cp target/release/chuck netsim/bins/chuck
cp iroh/target/release/iroh netsim/bins/iroh
cp iroh-ffi/target/wheels/iroh-*-py3-none-manylinux_2_34_x86_64.whl ./netsim/bins/
- name: Setup python venv
run: |
cd netsim
python3 -m venv venv
source venv/bin/activate
pip3 install bins/iroh-*.whl
pip3 install -r playbooks/requirements.txt
- name: Run tests
run: |
cd netsim
sudo kill -9 $(pgrep ovs)
sudo mn --clean
sudo python3 main.py --integration sims/standard/iroh.json
sudo python3 main.py --integration sims/example/playbook.json
- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "LAST_COMMIT_SHA=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> ${GITHUB_ENV}
echo "HEAD_REF=${{ github.event.pull_request.head.ref }}" >> ${GITHUB_ENV}
- name: Setup Environment (Push)
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
echo "LAST_COMMIT_SHA=$(git rev-parse --short ${GITHUB_SHA})" >> ${GITHUB_ENV}
echo "HEAD_REF=${{ github.head_ref }}" >> ${GITHUB_ENV}
- name: Generate reports
run: |
cd netsim
python3 reports_csv.py --prom --commit ${{ env.LAST_COMMIT_SHA }} > report_prom.txt
python3 reports_csv.py --metro --commit ${{ env.LAST_COMMIT_SHA }} > report_metro.txt
- name: Echo metrics
run: |
cd netsim
d=$(cat report_metro.txt)
metro_data=$(printf "%s\n " "$d")
echo "$metro_data"