Skip to content

Commit 869e8d3

Browse files
committed
Revert "remove some ci steps"
This reverts commit 1f57c7f.
1 parent 1a17400 commit 869e8d3

File tree

6 files changed

+429
-4
lines changed

6 files changed

+429
-4
lines changed

.github/ansible/redeploy-relay.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
- name: Update iroh-relay node
3+
hosts: derper
4+
become: yes
5+
6+
tasks:
7+
- name: Fetch iroh-relay binary
8+
get_url:
9+
url: https://vorc.s3.us-east-2.amazonaws.com/iroh-relay-linux-amd64-{{ relay_version }}
10+
mode: '0755'
11+
force: yes
12+
dest: /usr/local/bin/iroh-relay
13+
- name: Allow ports
14+
shell:
15+
cmd: sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/iroh-relay
16+
- name: Make sure iroh-relay is started
17+
ansible.builtin.systemd:
18+
state: restarted
19+
enabled: yes
20+
name: iroh-relay

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ jobs:
161161
- name: Add wasm target
162162
run: rustup target add wasm32-unknown-unknown
163163

164-
- name: wasm32 build
165-
run: cargo build --all-features --target wasm32-unknown-unknown
164+
- name: wasm32 build (iroh-base)
165+
run: cargo build -p iroh-base --all-features --target wasm32-unknown-unknown
166166

167167
check_semver:
168168
runs-on: ubuntu-latest
@@ -190,7 +190,7 @@ jobs:
190190
# uses: obi1kenobi/cargo-semver-checks-action@v2
191191
uses: n0-computer/cargo-semver-checks-action@feat-baseline
192192
with:
193-
package: iroh-blobs
193+
package: iroh, iroh-base, iroh-blobs, iroh-cli, iroh-dns-server, iroh-gossip, iroh-metrics, iroh-net, iroh-net-bench, iroh-docs
194194
baseline-rev: ${{ env.HEAD_COMMIT_SHA }}
195195
use-cache: false
196196

.github/workflows/netsim.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: netsim-CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
pr_number:
10+
required: true
11+
type: string
12+
branch:
13+
required: true
14+
type: string
15+
netsim_branch:
16+
required: true
17+
type: string
18+
default: "main"
19+
report_table:
20+
required: false
21+
type: boolean
22+
default: false
23+
24+
env:
25+
RUST_BACKTRACE: 1
26+
RUSTFLAGS: -Dwarnings
27+
MSRV: "1.66"
28+
SCCACHE_GHA_ENABLED: "true"
29+
RUSTC_WRAPPER: "sccache"
30+
IROH_FORCE_STAGING_RELAYS: "1"
31+
32+
jobs:
33+
netsim-release:
34+
permissions: write-all
35+
if: ${{github.ref_name=='main' && github.event_name == 'push'}}
36+
uses: './.github/workflows/netsim_runner.yaml'
37+
secrets: inherit
38+
with:
39+
branch: "main"
40+
max_workers: 1
41+
netsim_branch: "main"
42+
sim_paths: "sims/iroh,sims/integration"
43+
pr_number: ""
44+
publish_metrics: true
45+
build_profile: "optimized-release"
46+
47+
netsim-perf:
48+
permissions: write-all
49+
if: ${{github.event_name != 'push'}}
50+
uses: './.github/workflows/netsim_runner.yaml'
51+
secrets: inherit
52+
with:
53+
branch: ${{inputs.branch}}
54+
max_workers: 1
55+
netsim_branch: ${{inputs.netsim_branch}}
56+
sim_paths: "sims/iroh"
57+
pr_number: ${{inputs.pr_number}}
58+
publish_metrics: false
59+
build_profile: "optimized-release"
60+
report_table: ${{inputs.report_table}}

.github/workflows/netsim_runner.yaml

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
name: netsim-runner
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
required: true
8+
type: string
9+
max_workers:
10+
required: true
11+
type: number
12+
default: 4
13+
netsim_branch:
14+
required: true
15+
type: string
16+
default: "main"
17+
debug_logs:
18+
required: false
19+
type: boolean
20+
default: false
21+
build_profile:
22+
required: false
23+
type: string
24+
default: "release"
25+
sim_paths:
26+
required: false
27+
type: string
28+
default: "sims/iroh,sims/integration"
29+
publish_metrics:
30+
required: false
31+
type: boolean
32+
default: false
33+
visualizations:
34+
required: false
35+
type: boolean
36+
default: false
37+
pr_number:
38+
required: false
39+
type: string
40+
default: ""
41+
report_table:
42+
required: false
43+
type: boolean
44+
default: false
45+
workflow_call:
46+
inputs:
47+
branch:
48+
required: true
49+
type: string
50+
max_workers:
51+
required: true
52+
type: number
53+
default: 4
54+
netsim_branch:
55+
required: true
56+
type: string
57+
default: "main"
58+
debug_logs:
59+
required: false
60+
type: boolean
61+
default: false
62+
build_profile:
63+
required: false
64+
type: string
65+
default: "release"
66+
sim_paths:
67+
required: false
68+
type: string
69+
default: "sims/iroh,sims/integration"
70+
publish_metrics:
71+
required: false
72+
type: boolean
73+
default: false
74+
visualizations:
75+
required: false
76+
type: boolean
77+
default: false
78+
pr_number:
79+
required: false
80+
type: string
81+
default: ""
82+
report_table:
83+
required: false
84+
type: boolean
85+
default: false
86+
87+
env:
88+
RUST_BACKTRACE: 1
89+
RUSTFLAGS: -Dwarnings
90+
MSRV: "1.66"
91+
SCCACHE_GHA_ENABLED: "true"
92+
RUSTC_WRAPPER: "sccache"
93+
IROH_FORCE_STAGING_RELAYS: "1"
94+
95+
jobs:
96+
netsim:
97+
permissions: write-all
98+
name: Netsim
99+
timeout-minutes: 45
100+
runs-on: [self-hosted, linux, X64]
101+
steps:
102+
- name: Checkout
103+
uses: actions/checkout@v4
104+
with:
105+
submodules: recursive
106+
ref: ${{ inputs.branch }}
107+
108+
- name: Install rust stable
109+
uses: dtolnay/rust-toolchain@stable
110+
111+
- name: Install sccache
112+
uses: mozilla-actions/sccache-action@v0.0.6
113+
114+
- name: Build iroh
115+
run: |
116+
cargo build --profile ${{ inputs.build_profile }} --workspace --all-features --examples --bins
117+
118+
- name: Fetch and build chuck
119+
run: |
120+
cd ..
121+
rm -rf chuck
122+
git clone --single-branch --branch ${{ inputs.netsim_branch }} https://github.com/n0-computer/chuck.git
123+
cd chuck
124+
cargo build --release
125+
126+
- name: Install netsim deps
127+
run: |
128+
cd ../chuck/netsim
129+
sudo apt update
130+
./setup.sh
131+
./cleanup.sh || true
132+
133+
- name: Copy binaries to right location
134+
run: |
135+
cp target/${{inputs.build_profile}}/examples/* ../chuck/netsim/bins/
136+
cp target/${{inputs.build_profile}}/iroh ../chuck/netsim/bins/iroh
137+
cp target/${{inputs.build_profile}}/iroh-relay ../chuck/netsim/bins/iroh-relay
138+
cp ../chuck/target/release/chuck ../chuck/netsim/bins/chuck
139+
140+
- name: Get commit sha
141+
shell: bash
142+
run: |
143+
echo "LAST_COMMIT_SHA=$(git rev-parse --short ${GITHUB_SHA})" >> ${GITHUB_ENV}
144+
145+
- name: Run tests
146+
id: run_tests
147+
continue-on-error: true
148+
run: |
149+
cd ../chuck/netsim
150+
# split sim_paths by comma
151+
IFS=',' read -ra sim_paths <<< "${{ inputs.sim_paths }}"
152+
for sim_path in "${sim_paths[@]}"; do
153+
sudo python3 main.py ${{ inputs.debug_logs && '--debug' || ''}} ${{ inputs.visualizations && '--visualize' || ''}} --max-workers=${{ inputs.max_workers }} --integration $sim_path
154+
done
155+
156+
- name: Generate report
157+
id: generate_report
158+
if: always()
159+
run: |
160+
cd ../chuck/netsim
161+
python3 reports_csv.py --table > report_table.txt
162+
python3 reports_csv.py --prom --commit ${{ env.LAST_COMMIT_SHA }} > report_prom.txt
163+
python3 reports_csv.py --metro --commit ${{ env.LAST_COMMIT_SHA }} > report_metro.txt
164+
python3 reports_csv.py --metro --integration --commit ${{ env.LAST_COMMIT_SHA }} > report_metro_integration.txt
165+
166+
- name: Upload report
167+
if: always()
168+
run: |
169+
export AWS_ACCESS_KEY_ID=${{secrets.S3_ACCESS_KEY_ID}}
170+
export AWS_SECRET_ACCESS_KEY=${{secrets.S3_ACCESS_KEY}}
171+
export AWS_DEFAULT_REGION=us-west-2
172+
173+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
174+
unzip -q awscliv2.zip
175+
sudo ./aws/install --update
176+
177+
cd ../chuck/netsim
178+
179+
aws_fname=${{ env.LAST_COMMIT_SHA }}.tar.gz
180+
tar -cvzf report.tar.gz report_prom.txt report_table.txt report_metro.txt report_metro_integration.txt logs/ report/ viz/
181+
if [[ -n "${{ secrets.S3_BUCKET }}" ]]; then
182+
aws s3 cp ./report.tar.gz s3://${{secrets.S3_REPORT_BUCKET}}/$aws_fname --no-progress
183+
fi
184+
185+
- name: Move report
186+
if: always()
187+
run: |
188+
cp ../chuck/netsim/report.tar.gz ./report.tar.gz
189+
190+
- name: Upload report
191+
if: always()
192+
uses: actions/upload-artifact@v4
193+
id: upload-report
194+
with:
195+
name: netsim-report-${{ env.LAST_COMMIT_SHA }}
196+
path: report.tar.gz
197+
retention-days: 3
198+
overwrite: true
199+
200+
- name: Fail Job if Tests Failed
201+
if: ${{ failure() && steps.run_tests.outcome == 'failure' }}
202+
run: exit 1
203+
204+
- name: Find Docs Comment
205+
if: ${{ inputs.pr_number != '' }}
206+
uses: peter-evans/find-comment@v3
207+
id: fc
208+
with:
209+
issue-number: ${{ inputs.pr_number }}
210+
comment-author: 'github-actions[bot]'
211+
body-includes: Netsim report & logs for this PR have been generated
212+
213+
- name: Create or Update Docs Comment
214+
if: ${{ inputs.pr_number != '' && !github.event.pull_request.head.repo.fork }}
215+
uses: peter-evans/create-or-update-comment@v4
216+
with:
217+
issue-number: ${{ inputs.pr_number }}
218+
comment-id: ${{ steps.fc.outputs.comment-id }}
219+
body: |
220+
Netsim report & logs for this PR have been generated and is available at: [LOGS](${{steps.upload-report.outputs.artifact-url}})
221+
This report will remain available for 3 days.
222+
223+
Last updated for commit: ${{ env.LAST_COMMIT_SHA }}
224+
edit-mode: replace
225+
226+
- name: Generate report table
227+
if: ${{ inputs.pr_number != '' && inputs.report_table}}
228+
id: generate_report_table
229+
run: |
230+
cd ../chuck/netsim
231+
export NETSIM_REPORT=$(cat report_table.txt)
232+
echo "NETSIM_REPORT<<EOFMARKER" >> ${GITHUB_OUTPUT}
233+
echo "${NETSIM_REPORT}" >> ${GITHUB_OUTPUT}
234+
echo "EOFMARKER" >> ${GITHUB_OUTPUT}
235+
236+
- name: Echo Report Table on PR
237+
uses: peter-evans/create-or-update-comment@v4
238+
if: ${{ inputs.pr_number != '' && inputs.report_table && !github.event.pull_request.head.repo.fork }}
239+
with:
240+
issue-number: ${{ inputs.pr_number }}
241+
body: |
242+
`${{ inputs.branch }}.${{ env.LAST_COMMIT_SHA }}`
243+
Perf report:
244+
${{ steps.generate_report_table.outputs.NETSIM_REPORT }}
245+
246+
- name: Publish metrics
247+
if: ${{ inputs.publish_metrics && !github.event.pull_request.head.repo.fork }}
248+
run: |
249+
cd ../chuck/netsim
250+
d=$(cat report_metro.txt)
251+
metro_data=$(printf "%s\n " "$d")
252+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${{secrets.METRO_TOKEN}}" --data "$metro_data" ${{secrets.METRO_ENDPOINT}}
253+
d=$(cat report_metro_integration.txt)
254+
metro_data=$(printf "%s\n " "$d")
255+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${{secrets.METRO_TOKEN}}" --data "$metro_data" ${{secrets.METRO_ENDPOINT}}
256+
257+
- name: Echo metrics (debug)
258+
run: |
259+
cd ../chuck/netsim
260+
d=$(cat report_metro.txt)
261+
metro_data=$(printf "%s\n " "$d")
262+
echo "$metro_data"
263+
d=$(cat report_metro_integration.txt)
264+
metro_data=$(printf "%s\n " "$d")
265+
echo "$metro_data"
266+
267+
- name: Cleanup
268+
run: |
269+
./cleanup.sh || true

0 commit comments

Comments
 (0)