update README #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "sync-test" | |
on: | |
push: | |
branches: | |
- master | |
- 'release-**' | |
paths-ignore: | |
- 'docs/**' | |
pull_request: | |
#The branches below must be a subset of the branches above | |
branches: | |
- master | |
- 'release-**' | |
paths-ignore: | |
- 'docs/**' | |
workflow_dispatch: | |
jobs: | |
compare-with-rsync: | |
runs-on: ubuntu-latest | |
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: Build linux target | |
run: make juicesync | |
- name: Checkout source code for test | |
uses: actions/checkout@v2 | |
with: | |
repository: juicedata/juicefs | |
path: jfs_source | |
- name: Download juicefs | |
run: | | |
JFS_LATEST_TAG=$(curl -s https://api.github.com/repos/juicedata/juicefs/releases/latest | grep 'tag_name' | cut -d '"' -f 4 | tr -d 'v') | |
wget "https://github.com/juicedata/juicefs/releases/download/v${JFS_LATEST_TAG}/juicefs-${JFS_LATEST_TAG}-linux-amd64.tar.gz" | |
tar -zxf "juicefs-${JFS_LATEST_TAG}-linux-amd64.tar.gz" | |
sudo install juicefs /usr/local/bin | |
- name: Test Sync | |
run: | | |
set -x | |
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 | |
./juicesync 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/ | |
./juicesync $jfs_option $source_dir jfs_sync_dir/ | |
set -u noglob | |
printf ’juicesync %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: 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 |