Skip to content

Commit a387504

Browse files
committed
rsync workflow
1 parent 1f262ac commit a387504

1 file changed

Lines changed: 156 additions & 0 deletions

File tree

.github/workflows/rsync.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: rsync Tests
2+
on:
3+
push:
4+
branches: [ 'master', 'main', 'release/**' ]
5+
pull_request:
6+
branches: [ '*' ]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build_wolfprovider:
14+
uses: ./.github/workflows/build-wolfprovider.yml
15+
with:
16+
wolfssl_ref: ${{ matrix.wolfssl_ref }}
17+
openssl_ref: ${{ matrix.openssl_ref }}
18+
strategy:
19+
matrix:
20+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
21+
openssl_ref: [ 'openssl-3.5.0' ]
22+
23+
test_rsync:
24+
runs-on: ubuntu-22.04
25+
needs: build_wolfprovider
26+
timeout-minutes: 15
27+
strategy:
28+
matrix:
29+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
30+
openssl_ref: [ 'openssl-3.5.0' ]
31+
rsync_ref: [ 'master', 'v3.2.7' ]
32+
force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ]
33+
exclude:
34+
- rsync_ref: 'master'
35+
force_fail: 'WOLFPROV_FORCE_FAIL=1'
36+
steps:
37+
- name: Checkout wolfProvider
38+
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 1
41+
42+
- name: Retrieving wolfSSL/wolfProvider from cache
43+
uses: actions/cache/restore@v4
44+
id: wolfprov-cache
45+
with:
46+
path: |
47+
wolfssl-install
48+
wolfprov-install
49+
openssl-install/lib64
50+
openssl-install/include
51+
openssl-install/bin
52+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }}
53+
fail-on-cache-miss: true
54+
55+
- name: Install rsync dependencies
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y gcc g++ gawk autoconf automake python3-cmarkgfm \
59+
acl libacl1-dev attr libattr1-dev libxxhash-dev \
60+
libzstd-dev liblz4-dev
61+
62+
- name: Checkout rsync
63+
uses: actions/checkout@v4
64+
with:
65+
repository: RsyncProject/rsync
66+
path: rsync_repo
67+
ref: ${{ matrix.rsync_ref }}
68+
fetch-depth: 1
69+
70+
- name: Create SHA test script
71+
run: |
72+
cat > rsync_repo/testsuite/sha-test.test << 'EOF'
73+
#!/bin/sh
74+
# Use rsync binary from current directory or parent directory
75+
if [ -f "./rsync" ]; then
76+
RSYNC="./rsync"
77+
elif [ -f "../rsync" ]; then
78+
RSYNC="../rsync"
79+
else
80+
echo "ERROR: Could not find rsync binary"
81+
exit 1
82+
fi
83+
# Verify SHA256 and SHA512 are available
84+
if $RSYNC --version | grep -A1 "Daemon auth list:" | grep -q "sha512.*sha256"; then
85+
echo "PASS: SHA256 and SHA512 available"
86+
else
87+
echo "FAIL: SHA256/SHA512 not found"
88+
exit 1
89+
fi
90+
# Verify OpenSSL crypto is enabled
91+
if $RSYNC --version | grep -q "openssl-crypto"; then
92+
echo "PASS: OpenSSL crypto enabled"
93+
else
94+
echo "FAIL: OpenSSL crypto not enabled"
95+
exit 1
96+
fi
97+
# Test daemon authentication
98+
TEST_DIR="/tmp/rsync-sha-test"
99+
SECRETS_FILE="$TEST_DIR/secrets"
100+
CONFIG_FILE="$TEST_DIR/rsyncd.conf"
101+
rm -rf "$TEST_DIR"
102+
mkdir -p "$TEST_DIR"
103+
echo "testuser:testpass" > "$SECRETS_FILE"
104+
chmod 600 "$SECRETS_FILE"
105+
cat > "$CONFIG_FILE" << EOC
106+
port = 8730
107+
[test]
108+
path = /tmp
109+
auth users = testuser
110+
secrets file = $SECRETS_FILE
111+
EOC
112+
$RSYNC --daemon --config="$CONFIG_FILE" &
113+
DAEMON_PID=$!
114+
sleep 3
115+
if echo "testpass" | $RSYNC --list-only --password-file=- rsync://testuser@localhost:8730/test/ >/dev/null 2>&1; then
116+
echo "PASS: SHA authentication works"
117+
else
118+
echo "FAIL: SHA authentication failed"
119+
kill $DAEMON_PID 2>/dev/null
120+
rm -rf "$TEST_DIR"
121+
exit 1
122+
fi
123+
kill $DAEMON_PID 2>/dev/null || true
124+
rm -rf "$TEST_DIR" || true
125+
exit 0
126+
EOF
127+
chmod +x rsync_repo/testsuite/sha-test.test
128+
129+
- name: Build and install rsync
130+
working-directory: rsync_repo
131+
run: |
132+
# Set up the environment for wolfProvider
133+
source $GITHUB_WORKSPACE/scripts/env-setup
134+
./configure --disable-xxhash
135+
make -j$(nproc)
136+
#export RSYNC_CHECKSUM_LIST="none"
137+
#This can disable file checksums which currently use rsycs own implementation of MD4 and MD5
138+
139+
- name: Run rsync tests
140+
working-directory: rsync_repo
141+
run: |
142+
# Set up the environment for wolfProvider
143+
source $GITHUB_WORKSPACE/scripts/env-setup
144+
export ${{ matrix.force_fail }}
145+
146+
# Run rsync test suite including our SHA test
147+
make check 2>&1 | tee rsync-test.log
148+
149+
# Check test results - look for "0 failed" in the output
150+
if grep -q "overall result is 0" rsync-test.log; then
151+
TEST_RESULT=0
152+
else
153+
TEST_RESULT=1
154+
fi
155+
156+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} rsync

0 commit comments

Comments
 (0)