feat: simulate link failure #223
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: netsim-integration-CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| RUST_BACKTRACE: 1 | |
| RUSTFLAGS: -Dwarnings | |
| MSRV: "1.63" | |
| IROH_FORCE_STAGING_RELAYS: "1" | |
| 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: Fetch and build iroh | |
| run: | | |
| git clone --depth 1 https://github.com/n0-computer/iroh.git | |
| cd iroh | |
| cargo build --release --all-features -p iroh-relay -p iroh-dns-server | |
| cargo build --release --all-features -p iroh --examples | |
| - name: Copy binaries to right location | |
| run: | | |
| cp iroh/target/release/iroh-relay netsim/bins/iroh-relay | |
| cp iroh/target/release/iroh-dns-server netsim/bins/iroh-dns-server | |
| cp iroh/target/release/examples/transfer netsim/bins/iroh-transfer | |
| - name: Run tests | |
| run: | | |
| cd netsim | |
| sudo kill -9 $(pgrep ovs) || true | |
| sudo mn --clean | |
| sudo python3 main.py --integration --max-workers=4 sims/integration | |
| - name: Upload logs | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: netsim-logs | |
| path: netsim/logs/ | |
| retention-days: 7 | |
| - 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" |