Repository navigation
Expand file tree
/
Copy pathci.yml
More file actions
114 lines (105 loc) · 4.28 KB
/
Copy pathci.yml
File metadata and controls
114 lines (105 loc) · 4.28 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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: test (${{ matrix.os }}, stable)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release --locked
- name: Unit and loopback network tests
run: cargo test --release --locked
msrv:
name: test (ubuntu, Rust 1.75 MSRV)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@1.75
- run: cargo test --release --locked
lint:
name: rustfmt + clippy (Rust 1.75)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@1.75
with:
components: rustfmt, clippy
- run: cargo fmt --all --check
- run: cargo clippy --release --all-targets --locked -- -D warnings
integration:
name: integration + interop (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- run: cargo build --release --locked
- name: Plain TCP - single frame and 20 MB stream
run: |
set -e
B=./target/release/pse_net; T=$(mktemp -d)
head -c 5000 /dev/urandom > $T/small.bin
head -c 20000000 /dev/urandom > $T/big.bin
$B receive --port 7001 --out-dir $T/r > $T/srv.log 2>&1 & P=$!
trap 'kill $P 2>/dev/null || true' EXIT
sleep 1
$B send --port 7001 $T/small.bin
$B send --port 7001 $T/big.bin
sleep 1
n=0; for f in $T/r/*.bin; do if cmp -s $f $T/small.bin || cmp -s $f $T/big.bin; then n=$((n+1)); fi; done
echo "identical files: $n/2"; test "$n" = 2
- name: TLS - transfer, and rejection of an unknown CA
run: |
set -e
B=./target/release/pse_net; T=$(mktemp -d)
head -c 3000000 /dev/urandom > $T/d.bin
openssl req -x509 -newkey rsa:2048 -nodes -keyout $T/ca.key -out $T/ca.pem -days 1 -subj "/CN=Test CA" 2>/dev/null
openssl req -newkey rsa:2048 -nodes -keyout $T/srv.key -out $T/srv.csr -subj "/CN=localhost" 2>/dev/null
printf "subjectAltName=DNS:localhost\nextendedKeyUsage=serverAuth\n" > $T/ext.cnf
openssl x509 -req -in $T/srv.csr -CA $T/ca.pem -CAkey $T/ca.key -CAcreateserial -out $T/srv.pem -days 1 -extfile $T/ext.cnf 2>/dev/null
openssl req -x509 -newkey rsa:2048 -nodes -keyout $T/o.key -out $T/o.pem -days 1 -subj "/CN=Other" 2>/dev/null
$B receive --port 7002 --out-dir $T/r --tls-cert $T/srv.pem --tls-key $T/srv.key > $T/srv.log 2>&1 & P=$!
trap 'kill $P 2>/dev/null || true' EXIT
sleep 1
$B send --port 7002 $T/d.bin --tls-ca $T/ca.pem --server-name localhost
sleep 1; cmp $T/r/*.bin $T/d.bin
if $B send --port 7002 $T/d.bin --tls-ca $T/o.pem --server-name localhost; then echo "unknown CA was accepted"; exit 1; fi
echo "unknown CA rejected"
- name: Rust <-> Python wire compatibility
run: |
set -e
B=./target/release/pse_net; T=$(mktemp -d)
head -c 300000 /dev/urandom > $T/d.bin
$B receive --port 7101 --out-dir $T/r > $T/srv.log 2>&1 & P=$!
python pse_net_plain.py receive --port 7102 --out $T/py.bin --once > $T/py.log 2>&1 & Q=$!
trap 'kill $P $Q 2>/dev/null || true' EXIT
sleep 1
python pse_net_plain.py send --port 7101 --mode bcd $T/d.bin
python pse_net_plain.py send --port 7101 --mode raw $T/d.bin
sleep 1
n=0; for f in $T/r/*.bin; do if cmp -s $f $T/d.bin; then n=$((n+1)); fi; done
echo "python -> rust identical: $n/2"; test "$n" = 2
$B send --port 7102 $T/d.bin --chunk-kb 4096
sleep 1; cmp $T/py.bin $T/d.bin && echo "rust -> python identical"
python pse_net_plain.py selftest