-
-
Notifications
You must be signed in to change notification settings - Fork 54
76 lines (68 loc) · 2.19 KB
/
Copy pathci.yaml
File metadata and controls
76 lines (68 loc) · 2.19 KB
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
on:
push:
schedule:
- cron: '0 0 */1 * *'
workflow_dispatch:
name: Test Registry
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: docker-practice/actions-setup-docker@master
with:
docker_version: "20.10"
docker_channel: test
docker_buildx: false
- run: docker version
- run: docker info
- name: Test
run: |
registrys="
cjie.eu.org
cf-workers-docker-io-2cl.pages.dev
dockerhub.timeweb.cloud
docker.ketches.cn
docker.m.daocloud.io
docker.1ms.run
docker.io
docker.fxxk.dedyn.io
dockerproxy.com
hub.iyuu.cn
hub-mirror.c.163.com
hub.atomgit.com
hub.docker.com
registry.docker.com
registry-1.docker.io
mirror.gcr.io
$ALIYUN_MIRROR
"
image="library/nginx:1.27.2-alpine"
for registry in $registrys
do
echo ::group::Test $registry/$image
docker pull $registry/$image \
&& (echo -e "\033[32m$registry is good\033[0m" \
; echo "::warning file=README.md,line=1,col=0::OK [ $registry ] is good") \
|| (echo -e "\033[31m$registry is outdated\033[0m" \
; echo "::error file=README.md,line=1,col=0::X [ $registry ] is outdated")
docker rmi $registry/$image || true
echo ::endgroup::
done
IMAGE=busybox
MIRROR=https://dockerhub.icu
NUM_TRIALS=5
echo "Testing $MIRROR with $IMAGE"
total_time=0
for i in $(seq 1 $NUM_TRIALS); do
echo "Trial $i"
start_time=$(date +%s.%N)
docker pull $IMAGE
end_time=$(date +%s.%N)
elapsed_time=$(echo "$end_time - $start_time" | bc)
total_time=$(echo "$total_time + $elapsed_time" | bc)
docker rmi $IMAGE
done
average_time=$(echo "scale=2; $total_time / $NUM_TRIALS" | bc)
echo "::warning $MIRROR is ok Average pull time: $average_time seconds "
env:
ALIYUN_MIRROR: ${{secrets.ALIYUN_MIRROR}}