-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (123 loc) · 4.44 KB
/
ci-network.yml
File metadata and controls
143 lines (123 loc) · 4.44 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: CI - Network Tests
on:
push:
branches: [main]
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'docker/**'
- 'scripts/docker-network-tests.sh'
- '.github/workflows/ci-network.yml'
pull_request:
branches: [main]
paths:
- '**.rs'
- '**/Cargo.toml'
- '**/Cargo.lock'
- 'docker/**'
- 'scripts/docker-network-tests.sh'
- '.github/workflows/ci-network.yml'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
# Multi-process network tests (localhost) - cross-platform
network-tests:
name: Network Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install cargo-nextest
uses: ./.github/actions/install-cargo-tool
with:
tool: cargo-nextest
- name: Configure sccache
id: sccache
uses: mozilla-actions/sccache-action@v0.0.9
continue-on-error: true
- name: Verify sccache is working (Unix)
id: sccache-check-unix
if: steps.sccache.outcome == 'success' && runner.os != 'Windows'
run: ./scripts/verify-sccache.sh
continue-on-error: true
- name: Verify sccache is working (Windows)
id: sccache-check-windows
if: steps.sccache.outcome == 'success' && runner.os == 'Windows'
shell: bash
run: ./scripts/verify-sccache.sh
continue-on-error: true
- name: Set sccache working status
id: sccache-check
shell: bash
run: |
# Assign GitHub expressions to variables (avoids shellcheck SC2193)
unix_working="${{ steps['sccache-check-unix'].outputs.working }}"
windows_working="${{ steps['sccache-check-windows'].outputs.working }}"
if [ "$unix_working" == "true" ] || [ "$windows_working" == "true" ]; then
echo "working=true" >> "$GITHUB_OUTPUT"
else
echo "working=false" >> "$GITHUB_OUTPUT"
fi
- name: Clear sccache env on failure
if: steps.sccache.outcome != 'success' || steps.sccache-check.outputs.working != 'true'
shell: bash
run: |
echo "RUSTC_WRAPPER=" >> "$GITHUB_ENV"
echo "SCCACHE_GHA_ENABLED=" >> "$GITHUB_ENV"
- name: Cache cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: network-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
network-${{ runner.os }}-cargo-
- name: Build network test peer
run: cargo build --release -p network-test-peer
env:
RUSTC_WRAPPER: ${{ steps.sccache-check.outputs.working == 'true' && 'sccache' || '' }}
SCCACHE_GHA_ENABLED: ${{ steps.sccache-check.outputs.working == 'true' && 'true' || 'false' }}
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
SCCACHE_STARTUP_NOTIFY_TIMEOUT: "60"
SCCACHE_IDLE_TIMEOUT: "0"
- name: Run multi-process network tests (nextest)
run: cargo nextest run --profile ci --release -E 'test(multi_process)' --test network
timeout-minutes: 10
env:
RUSTC_WRAPPER: ${{ steps.sccache-check.outputs.working == 'true' && 'sccache' || '' }}
SCCACHE_GHA_ENABLED: ${{ steps.sccache-check.outputs.working == 'true' && 'true' || 'false' }}
SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
SCCACHE_STARTUP_NOTIFY_TIMEOUT: "60"
SCCACHE_IDLE_TIMEOUT: "0"
# Docker-based network tests with tc/netem
docker-network-tests:
name: Network Tests (Docker)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image
run: docker compose -f docker/docker-compose.yml build
- name: Run Docker network tests (quick)
run: ./scripts/docker-network-tests.sh --quick
timeout-minutes: 15
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: docker-network-test-results
path: test-results/
retention-days: 7