-
Notifications
You must be signed in to change notification settings - Fork 35
102 lines (97 loc) · 3.5 KB
/
data-cron.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
name: diopi gen data
on:
workflow_dispatch:
# push:
# branches:
# - "wgs/*"
schedule:
- cron: '01 22 * * *'
concurrency:
group: data-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
CLUSTER_V100: SCO
CLUSTER_CAMB: CAMB
CLUSTER_ASCEND_910B: ASCEND-910B
CLUSTER_TOPSRIDER: TOPSRIDER
CLUSTER_SUPA: SUPA
DEEPLINK_PATH: '/mnt/cache/share/deeplinkci/github/${{ github.repository }}'
HASH_FILE: 'diopi/diopi_case_items.cfg'
HASH_FILE2: 'diopi_test/python/conformance/customized_test.py'
DATA_DIR: '/mnt/cache/share/deeplinkci/gen-data'
ENV_PATH: '/mnt/cache/share/platform/env'
GEN_DATA: 'diopi_test/python/cache'
ENV_NAME: 'pt2.0_diopi'
jobs:
Clone:
name: checkout code
runs-on: tps-diopi-ci
steps:
- name: clone repo
run: |
set -e
cd ${GITHUB_WORKSPACE} && rm -rf source
git clone ${{ github.event.repository.clone_url }} source
cd source && git submodule update --init --recursive
- name: Rsync to Server
run: |
ssh ${CLUSTER_V100} "mkdir -p ${DATA_DIR} && cd ${DATA_DIR} && rm -rf source && mkdir source" \
&& rsync -a --delete ${GITHUB_WORKSPACE}/source/ ${CLUSTER_V100}:${DATA_DIR}/source/
Gen-Data:
name: Gen-Data
runs-on: tps-sco-ci
needs: [Clone]
steps:
- name: gen-test-data
run: |
set -e
srun bash -c "cd ${DATA_DIR}/source/diopi_test/python \
&& source ${ENV_PATH}/pt2.0_diopi \
&& python main.py --mode gen_data \
|| ( cd ${DATA_DIR}/source/diopi_test/python && git clean -xdf ${GEN_DATA} && exit 1 ) "
CheckAndRsync:
name: check and rsync
runs-on: tps-diopi-ci
needs: Gen-Data
outputs:
output: ${{ steps.get_gen_data.outputs.to_gen_data }}
steps:
- name: check
id: get_gen_data
run: |
ssh ${CLUSTER_V100} """
set -e
cd ${DATA_DIR}
if [[ -f "pre_hash" ]] && [[ -f "pre_hash2" ]]; then
sha1sum source/${GEN_DATA}/${HASH_FILE} > new_hash
diff_output=\$(diff -q --ignore-all-space "new_hash" "pre_hash" ) && echo "false" > to_gen_data || echo "true" > to_gen_data
sha1sum source/${HASH_FILE2} > new_hash2
diff_output=\$(diff -q --ignore-all-space "new_hash2" "pre_hash2" ) || echo "true" > to_gen_data
else
echo "true" > to_gen_data
fi
cp new_hash pre_hash
cp new_hash2 pre_hash2
"""
export file_path="/home/autolink/rsync/sourcecode"
rsync -a --delete ${CLUSTER_V100}:${DATA_DIR}/to_gen_data ${file_path}/
if grep -q "true" "${file_path}/to_gen_data"; then
echo "to_gen_data=true" >> "$GITHUB_ENV"
else
echo "to_gen_data=false" >> "$GITHUB_ENV"
fi
- name: rsync
if: ${{ env.to_gen_data == 'true' }}
run: |
set -e
ssh ${CLUSTER_CAMB} """
mkdir -p ${DATA_DIR}/source/${GEN_DATA}
rsync -a --delete ${CLUSTER_V100}:${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
"""
ssh ${CLUSTER_ASCEND_910B} """
mkdir -p ${DATA_DIR}/source/${GEN_DATA}
rsync -a --delete ${CLUSTER_V100}:${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
"""
# ssh ${CLUSTER_SUPA} """
# rsync -a ${CLUSTER_V100}:${DATA_DIR}/source/${GEN_DATA}/diopi/ ${DATA_DIR}/source/${GEN_DATA}/diopi/
# """