-
Notifications
You must be signed in to change notification settings - Fork 23
/
make-screenshots.sh
executable file
·109 lines (88 loc) · 3.28 KB
/
make-screenshots.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
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
# For running from launchd
export PATH=$PATH:/usr/local/bin
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
#
# Configuration
#
BRANCH=v14.x
CARTHAGE_BRANCH=screenshots
[email protected]:/home/fxios/public_html/screenshots/fxios/v14/
#
# Decide what screenshots to make on this machine
#
LOCALES=$*
if [ $# -eq 0 ]; then
case "$(hostname)" in
Builder1.local)
LOCALES="af an ar ast az bg bn br bs ca cs cy da de dsb el en-CA en-GB en-US eo es es-AR es-CL es-MX eu fa fr ga-IE gd"
;;
Builder2.local)
LOCALES="gl he hi-IN hr hsb hu hy-AM ia id is it ja ka kab kk km kn ko lo lt lv ml mr ms my nb-NO ne-NP nl"
;;
Builder3.local)
LOCALES="nn-NO oc or pa-IN pl pt-BR pt-PT rm ro ru ses si sk sl sq sv-SE ta te th tl tr uk ur uz zh-CN zh-TW"
;;
*)
echo "Unknown machine, not sure what to do"
exit 1
;;
esac
fi
echo "$(date) Making screenshots for $LOCALES"
#
# Wipe workspace and caches on every run
#
rm -rf firefox-ios-l10n-screenshots ~/Library/Caches/org.carthage.CarthageKit
#
# Clone projects
#
echo "$(date) Cloning mozilla-mobile/firefox-ios"
git clone --depth 1 --single-branch --branch "$BRANCH" https://github.com/mozilla-mobile/firefox-ios.git firefox-ios-l10n-screenshots >> firefox-ios-l10n-screenshots.log 2>&1
cd firefox-ios-l10n-screenshots
#
# Run Carthage. Previously we would just grab a tar file, which speeds things up considerably. That
# does not work anymore because of strange Fuzi / libxml errors that I have not been able to explain.
#
if [ -f "$HOME/Carthage-$BRANCH.tar" ]
then
echo "$(date) Extracting Carthage-$BRANCH.tar"
tar xf "$HOME/Carthage-$BRANCH.tar" >> ../firefox-ios-l10n-screenshots.log 2>&1
else
echo "$(date) Running ./bootstrap.sh"
./bootstrap.sh >> ../firefox-ios-l10n-screenshots.log 2>&1
fi
#
# Clone the l10n scripts and import locales
#
echo "$(date) Cloning mozilla-mobile/ios-l10n-scripts"
git clone https://github.com/mozilla-mobile/ios-l10n-scripts.git >> ../firefox-ios-l10n-screenshots.log 2>&1
echo "$(date) Importing locales"
./ios-l10n-scripts/import-locales-firefox.sh >> ../firefox-ios-l10n-screenshots.log 2>&1
#
# Update Fastlane
#
gem install -f fastlane
#
# Run Fastlane and upload results
#
mkdir l10n-screenshots
for lang in $LOCALES; do
echo "$(date) Snapshotting $lang"
mkdir "l10n-screenshots/$lang"
fastlane snapshot --project Client.xcodeproj --scheme L10nSnapshotTests \
--skip_open_summary \
--derived_data_path l10n-screenshots-dd \
--erase_simulator --localize_simulator --number_of_retries 0 \
-i "12.0" --devices "iPhone 8" --languages "$lang" \
--output_directory "l10n-screenshots/$lang" > "l10n-screenshots/$lang/snapshot.txt" 2>&1
# Generate the gallery
rm -f "l10n-screenshots/$lang/screenshots.html"
../ios-l10n-scripts/gallery.py "l10n-screenshots/$lang" > "l10n-screenshots/$lang/gallery.html"
# Sync all content, in case one previously failed
echo "$(date) Syncing screenshots to $REMOTE"
rsync -avzhe ssh l10n-screenshots/* "$REMOTE" >> ../firefox-ios-l10n-screenshots.log 2>&1
done
# Do a final sync for all content, in case one previously failed
echo "$(date) Syncing screenshots to $REMOTE"
rsync -avzhe ssh l10n-screenshots/* "$REMOTE" >> ../firefox-ios-l10n-screenshots.log 2>&1