mirror of
https://gitee.com/juicedata/JuiceFS.git
synced 2025-12-06 09:39:14 +08:00
separate load steps to jobs for parallel run (#1922)
This commit is contained in:
51
.github/actions/load/action.yml
vendored
Normal file
51
.github/actions/load/action.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: 'Load Action'
|
||||
description: 'Juicefs load action'
|
||||
inputs:
|
||||
meta_url:
|
||||
description: 'meta url'
|
||||
required: true
|
||||
default: ''
|
||||
load_file:
|
||||
description: 'path of the file to load'
|
||||
required: true
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '1.17.x'
|
||||
|
||||
- name: Build linux target
|
||||
run: |
|
||||
make juicefs
|
||||
shell: bash
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
mount_point=/tmp/juicefs-sync-test
|
||||
meta_url=${{inputs.meta_url}}
|
||||
load_file=${{inputs.load_file}}
|
||||
echo meta_url is: $meta_url
|
||||
db_name=$(basename $meta_url | awk -F? '{print $1}')
|
||||
if [[ "$meta_url" == mysql* ]]; then
|
||||
mysql -uroot -proot -e "drop database if exists $db_name; create database $db_name;"
|
||||
elif [[ "$meta_url" == postgres* ]]; then
|
||||
export PGPASSWORD="postgres"
|
||||
printf "\set AUTOCOMMIT on\ndrop database if exists $db_name; create database $db_name; " | psql -U postgres -h localhost
|
||||
fi
|
||||
echo "start load..."
|
||||
./juicefs load $meta_url $load_file
|
||||
echo "finish load..."
|
||||
./juicefs mount $meta_url $mount_point -d
|
||||
if [ -d data/ ]; then
|
||||
rm data/{*,.*} -rf || true
|
||||
else
|
||||
mkdir data
|
||||
fi
|
||||
echo "start sync..."
|
||||
./juicefs sync $mount_point/t1 data/t1 --exclude '.accesslog'
|
||||
echo "finish sync..."
|
||||
shell: bash
|
||||
121
.github/workflows/load.yml
vendored
Normal file
121
.github/workflows/load.yml
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
name: "load-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/**'
|
||||
schedule:
|
||||
- cron: '0 3 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
load-to-pg:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Init
|
||||
run: |
|
||||
sudo chmod 777 /var
|
||||
wget -q https://s.juicefs.com/static/meta_with_4M_Empty_files.json.gz
|
||||
gzip -dk meta_with_4M_Empty_files.json.gz
|
||||
- name: Load
|
||||
uses: ./.github/actions/load
|
||||
with:
|
||||
meta_url: "postgres://postgres:postgres@127.0.0.1:5432/sync_test?sslmode=disable"
|
||||
load_file: "meta_with_4M_Empty_files.json"
|
||||
|
||||
load-to-mysql:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Init
|
||||
run: |
|
||||
sudo chmod 777 /var
|
||||
sudo /etc/init.d/mysql start
|
||||
wget -q https://s.juicefs.com/static/meta_with_4M_Empty_files.json.gz
|
||||
gzip -dk meta_with_4M_Empty_files.json.gz
|
||||
- name: Load
|
||||
uses: ./.github/actions/load
|
||||
with:
|
||||
meta_url: "mysql://root:root@\\(127.0.0.1\\)/sync_test"
|
||||
load_file: "meta_with_4M_Empty_files.json"
|
||||
|
||||
load-to-redis:
|
||||
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:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Init
|
||||
run: |
|
||||
sudo chmod 777 /var
|
||||
wget -q https://s.juicefs.com/static/meta_with_4M_Empty_files.json.gz
|
||||
gzip -dk meta_with_4M_Empty_files.json.gz
|
||||
- name: Load
|
||||
uses: ./.github/actions/load
|
||||
with:
|
||||
meta_url: redis://127.0.0.1:6379/1
|
||||
load_file: "meta_with_4M_Empty_files.json"
|
||||
|
||||
load-to-sqlite3:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Init
|
||||
run: |
|
||||
sudo chmod 777 /var
|
||||
wget -q https://s.juicefs.com/static/meta_with_4M_Empty_files.json.gz
|
||||
gzip -dk meta_with_4M_Empty_files.json.gz
|
||||
- name: Load
|
||||
uses: ./.github/actions/load
|
||||
with:
|
||||
meta_url: sqlite3://sync-test.db
|
||||
load_file: "meta_with_4M_Empty_files.json"
|
||||
|
||||
Reference in New Issue
Block a user