Skip to content

Commit

Permalink
feat: ci netsim integration tests (#877)
Browse files Browse the repository at this point in the history
* feat: ci netsim integration tests

* cleanup
  • Loading branch information
Arqu authored Mar 23, 2023
1 parent 180b95f commit 15b171d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion .github/workflows/netsim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Build iroh
run: |
cargo build --release
cargo build --profile optimized-release
- name: Fetch and build chuck
run: |
Expand Down

0 comments on commit 15b171d

Please sign in to comment.