-
Notifications
You must be signed in to change notification settings - Fork 67
/
run.sh
executable file
·66 lines (58 loc) · 2.88 KB
/
run.sh
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
#!/bin/bash
# We use the autobuild to always test our new functionality. But YOU should not do that!
# Instead use the latest tagged version as the next row
# DOCKER_CONTAINER=sitespeedio/sitespeed.io:25.5.1
DOCKER_CONTAINER=sitespeedio/sitespeed.io-autobuild:main
DOCKER_SETUP="--cap-add=NET_ADMIN --shm-size=4g --rm -v /config:/config -v "$(pwd)":/sitespeed.io -v /etc/localtime:/etc/localtime:ro -e MAX_OLD_SPACE_SIZE=3072 --name sitespeedio"
DESKTOP_BROWSERS_DOCKER=(chrome firefox)
DESKTOP_BROWSERS=(chrome firefox edge)
EMULATED_MOBILE_BROWSERS=(chrome)
# We loop through the desktop directory
for file in tests/docker/desktop/*.{txt,js} ; do
for browser in "${DESKTOP_BROWSERS_DOCKER[@]}" ; do
FILENAME=$(basename -- "$file")
FILENAME_WITHOUT_EXTENSION="${FILENAME%.*}"
CONFIG_FILE="config/$FILENAME_WITHOUT_EXTENSION.json"
[[ -f "$CONFIG_FILE" ]] && echo "Using config file $CONFIG_FILE" || echo "Missing config file $CONFIG_FILE"
docker run $DOCKER_SETUP $DOCKER_CONTAINER --config $CONFIG_FILE -b $browser $file
control
done
done
for file in tests/docker/emulatedMobile/*.{txt,js} ; do
for browser in "${EMULATED_MOBILE_BROWSERS[@]}" ; do
FILENAME=$(basename -- "$file")
FILENAME_WITHOUT_EXTENSION="${FILENAME%.*}"
CONFIG_FILE="config/$FILENAME_WITHOUT_EXTENSION.json"
[[ -f "$CONFIG_FILE" ]] && echo "Using config file $CONFIG_FILE" || echo "Missing config file $CONFIG_FILE"
docker run $DOCKER_SETUP $DOCKER_CONTAINER --config $CONFIG_FILE -b $browser $file
control
done
done
# Run test direct on Ubuntu
for file in tests/desktop/*.{txt,js} ; do
for browser in "${DESKTOP_BROWSERS[@]}" ; do
FILENAME=$(basename -- "$file")
FILENAME_WITHOUT_EXTENSION="${FILENAME%.*}"
CONFIG_FILE="config/$FILENAME_WITHOUT_EXTENSION.json"
[[ -f "$CONFIG_FILE" ]] && echo "Using config file $CONFIG_FILE" || echo "Missing config file $CONFIG_FILE"
sitespeed.io --config $CONFIG_FILE -b $browser $file
control
done
done
# Run a couple of tests using WebPageReplay
for file in tests/docker/webpagereplay/*.txt ; do
for browser in "${DESKTOP_BROWSERS_DOCKER[@]}" ; do
FILENAME=$(basename -- "$file")
FILENAME_WITHOUT_EXTENSION="${FILENAME%.*}"
CONFIG_FILE="config/$FILENAME_WITHOUT_EXTENSION.json"
[[ -f "$CONFIG_FILE" ]] && echo "Using config file $CONFIG_FILE" || echo "Missing config file $CONFIG_FILE"
docker run $DOCKER_SETUP -e REPLAY=true -e LATENCY=100 $DOCKER_CONTAINER --config $CONFIG_FILE -b $browser $file
control
done
done
# Remove the current container so we fetch the latest autobuild the next time
# If you run a stable version (as YOU should), you don't need to remove the container,
# instead make sure you remove all volumes (of data)
# docker volume prune -f
docker system prune --all --volumes -f
sleep 20