-
Notifications
You must be signed in to change notification settings - Fork 966
160 lines (142 loc) · 5.3 KB
/
sync.yml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: "sync-test"
on:
push:
branches:
- 'release-**'
paths-ignore:
- 'docs/**'
pull_request:
#The branches below must be a subset of the branches above
branches:
- 'release-**'
paths-ignore:
- 'docs/**'
workflow_dispatch:
jobs:
compare-with-rsync:
runs-on: ubuntu-20.04
services:
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18.x'
- name: Build linux target
run: make juicefs
- name: Checkout source code for test
uses: actions/checkout@v2
with:
repository: juicedata/juicefs
path: jfs_source
- name: Test Sync
run: |
meta_url=redis://127.0.0.1/1
mount_point=/tmp/sync-test/
./juicefs format --trash-days 0 $meta_url sync-test
./juicefs mount --no-usage-report $meta_url $mount_point -d
./juicefs sync jfs_source/ $mount_point
for source_dir in "$mount_point" "jfs_source/" ; do
while IFS=, read -r jfs_option rsync_option status; do
printf '\n%s, %s, %s\n' "$jfs_option" "$rsync_option" "$status"
status=$(echo $status| xargs)
if [[ -z "$status" || "$status" = "disable" ]]; then
continue
fi
if [ "$source_dir" = "$mount_point" ]; then
jfs_option="--exclude .stats --exclude .config $jfs_option "
rsync_option="--exclude .stats --exclude .config $rsync_option "
fi
test -d rsync_dir/ && rm rsync_dir/ -rf
mkdir rsync_dir
set -o noglob
rsync -a $source_dir rsync_dir/ $rsync_option
test -d jfs_sync_dir/ && rm jfs_sync_dir/ -rf
mkdir jfs_sync_dir/
./juicefs sync $source_dir jfs_sync_dir/ $jfs_option
set -u noglob
printf ’juicefs sync %s %s %s\n‘ "$source_dir" "jfs_sync_dir/" "$jfs_option"
printf ’rsync %s %s %s\n‘ "$source_dir" "rsync_dir/" "$rsync_option"
printf ‘diff between juicefs sync and rsync:\n’
diff -ur jfs_sync_dir rsync_dir
done < .github/workflows/resources/sync-options.txt
done
- name: Log
if: ${{ always() }}
run: |
echo "juicefs log"
sudo tail -n 1000 ~/.juicefs/juicefs.log
grep "<FATAL>:" ~/.juicefs/juicefs.log && exit 1 || true
- name: Send Slack Notification
if: ${{ failure() }}
uses: juicedata/slack-notify-action@main
with:
channel-id: "${{ secrets.SLACK_CHANNEL_ID_FOR_PR_CHECK_NOTIFY }}"
slack_bot_token: "${{ secrets.SLACK_BOT_TOKEN }}"
- name: Setup upterm session
if: ${{ failure() }}
uses: lhotari/action-upterm@v1
file-head-test:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18.x'
- name: Build linux target
run: |
make juicefs
# wget -q https://github.com/juicedata/juicefs/releases/download/v1.0.0-beta3/juicefs-1.0.0-beta3-linux-amd64.tar.gz
# tar -zxf juicefs-1.0.0-beta3-linux-amd64.tar.gz
- name: Checkout source code for test
uses: actions/checkout@v2
with:
repository: juicedata/juicefs
path: jfs_source
- name: Test
run: |
# issue link: https://github.com/juicedata/juicefs/issues/2125
meta_url=sqlite3://test.db
mount_point=/tmp/sync-test/
./juicefs format --trash-days 0 $meta_url sync-test
./juicefs mount --no-usage-report $meta_url $mount_point -d
mkdir $mount_point/jfs_source/
./juicefs sync jfs_source/ $mount_point/jfs_source/ -u=true --perms=true --check-all=true --bwlimit=81920 --dirs=true --threads=30 --debug
echo "test" > jfs_source/test_file
mkdir jfs_source/test_dir
./juicefs sync jfs_source/ $mount_point/jfs_source/ -u=true --perms=true --check-all=true --bwlimit=81920 --dirs=true --threads=30 --debug
diff -ur jfs_source/ $mount_point/jfs_source
- name: Log
if: ${{ always() }}
run: |
echo "juicefs log"
sudo tail -n 1000 ~/.juicefs/juicefs.log
grep "<FATAL>:" ~/.juicefs/juicefs.log && exit 1 || true
- name: Send Slack Notification
if: ${{ failure() }}
uses: juicedata/slack-notify-action@main
with:
channel-id: "${{ secrets.SLACK_CHANNEL_ID_FOR_PR_CHECK_NOTIFY }}"
slack_bot_token: "${{ secrets.SLACK_BOT_TOKEN }}"
- name: Setup upterm session
if: ${{ failure() }}
uses: lhotari/action-upterm@v1