-
-
Notifications
You must be signed in to change notification settings - Fork 351
129 lines (111 loc) · 4.11 KB
/
ci.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
name: ci
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.12"]
steps:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Install main
run: |
pip install .[test]
- name: Lint
run: |
make lint
- name: Test
run: |
make test
- name: Download from URL other than Gdrive
run: |
output=/tmp/gdown_r
gdown https://raw.githubusercontent.com/wkentaro/gdown/3.1.0/gdown/__init__.py -O $output --quiet
test $(md5sum $output | awk '{print $1}') = 2a51927dde6b146ce56b4d89ebbb5268
rm -rf $output
- name: Download small file from Google Drive
run: |
output=/tmp/spam.txt
success=0
while read -r file_id
do
gdown $file_id -O $output --quiet || continue
test $(cat $output) = spam && success=1 && break
done < tests/data/file_ids.csv
test $success = 1
rm -rf $output
- name: Download large file from Google Drive
run: |
output=/tmp/large_file
success=0
while IFS=, read -r file_id md5
do
gdown $file_id -O $output --quiet || continue
test $(md5sum $output | awk '{print $1}') = $md5 && success=1 && break
done < tests/data/file_ids_large.csv
test $success = 1
rm -rf $output
- name: Download and extract
run: |
gdown https://github.com/wkentaro/gdown/archive/refs/tags/v4.0.0.tar.gz -O - --quiet | tar zxf -
test -d gdown-4.0.0
- name: Download folder from Google Drive
run: |
output=/tmp/folder/
success=0
while IFS=, read -r folder_id md5
do
gdown $folder_id -O $output --quiet --folder || continue
actual_hash=$(find $output -type f -exec md5sum {} \; | awk '{print $1}' | sort | md5sum | awk '{print $1}')
test $actual_hash = $md5 || echo "$folder_id, $actual_hash" && success=1 && break
done < tests/data/folder_ids.csv
test $success = 1
rm -rf $output
- name: Try to download a folder with a file count more than the limit from Google Drive, without remaining ok
run: |
output=/tmp/folder-limit/
gdown https://drive.google.com/drive/folders/1gd3xLkmjT8IckN6WtMbyFZvLR4exRIkn -O $output --quiet --folder && exit 1 || exit 0
- name: Download docs from Google Drive
run: |
output=/tmp/file.txt
file_id=1TFYNzuZJTgNGzGmjraZ58ZVOh9_YoKeBnU-opWgXQL4
md5=6c17d87d3d01405ac5c9bb65ee2d2fc2
gdown $file_id -O $output --quiet --format txt
actual_hash=$(md5sum $output | awk '{print $1}')
test $actual_hash = $md5
- name: Download spreadsheets from Google Drive
run: |
output=/tmp/file.pdf
file_id=1h6wQX7ATSJDOSWFEjHPmv_nukJzZD_zZ30Jvy6XNiTE
md5=5be20dd8a23afa06365714edc24856f3
gdown $file_id -O $output --quiet --format pdf
actual_hash=$(md5sum $output | awk '{print $1}')
test $actual_hash = $md5
- name: Download slides from Google Drive
run: |
output=/tmp/file.pdf
file_id=13AhW1Z1GYGaiTpJ0Pr2TTXoQivb6jx-a
md5=96704c6c40e308a68d3842e83a0136b9
gdown $file_id -O $output --quiet --format pdf
actual_hash=$(md5sum $output | awk '{print $1}')
test $actual_hash = $md5
# FIXME: too unstable
# - name: Download a folder with a file count more than the limit from Google Drive
# run: |
# output=/tmp/folder-limit/
# gdown https://drive.google.com/drive/folders/1gd3xLkmjT8IckN6WtMbyFZvLR4exRIkn -O $output --quiet --folder --remaining-ok
# actual_hash=$(find $output -type f -exec md5sum {} \; | awk '{print $1}' | sort | md5sum | awk '{print $1}')
# test $actual_hash = b0e45acb8d9c7d9200ce8fe38896c790
# rm -rf $output
- name: Install from dist
run: |
make build
pip install dist/gdown-*.tar.gz
pip install dist/gdown-*.whl