From 15b171d19c2931cb5b7865f4a513a39d7f41de0e Mon Sep 17 00:00:00 2001 From: Asmir Avdicevic Date: Thu, 23 Mar 2023 17:31:47 +0100 Subject: [PATCH] feat: ci netsim integration tests (#877) * feat: ci netsim integration tests * cleanup --- .github/workflows/ci.yml | 69 ++++++++++++++++++++++++++++++++++++ .github/workflows/netsim.yml | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ebb95a4a1..f31f6ebc01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -277,3 +277,72 @@ jobs: arguments: --workspace --all-features command: check command-arguments: "-Dwarnings" + + netsim-integration-tests: + name: Run network simulations/benchmarks + runs-on: [self-hosted, linux, X64] + 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: Build iroh + run: | + cargo build --release + + - name: Fetch and build chuck + run: | + git clone https://github.com/n0-computer/chuck.git + cd chuck + cargo build --release + + - name: Install netsim deps + run: | + cd chuck/netsim + sudo apt update + ./setup.sh + + - name: Copy binaries to right location + run: | + cp target/release/iroh chuck/netsim/bins/iroh + cp chuck/target/release/chuck chuck/netsim/bins/chuck + + - name: Run tests + run: | + cd chuck/netsim + sudo kill -9 $(pgrep ovs) + sudo mn --clean + sudo python3 main.py --integration sims/standard/iroh.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 chuck/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 chuck/netsim + d=$(cat report_metro.txt) + metro_data=$(printf "%s\n " "$d") + echo "$metro_data" diff --git a/.github/workflows/netsim.yml b/.github/workflows/netsim.yml index d5807f4314..fb1611ff7c 100644 --- a/.github/workflows/netsim.yml +++ b/.github/workflows/netsim.yml @@ -37,7 +37,7 @@ jobs: - name: Build iroh run: | - cargo build --release + cargo build --profile optimized-release - name: Fetch and build chuck run: |