mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-11 02:52:56 +01:00
Merge branch 'leipert-chrome-install-noto' into 'master'
feat: Proper Emoji support in Chrome images See merge request https://gitlab.com/gitlab-org/gitlab-build-images/-/merge_requests/619 Merged-by: Rémy Coutable <remy@rymai.me> Approved-by: Rémy Coutable <remy@rymai.me> Co-authored-by: Lukas Eipert <leipert@gitlab.com>
This commit is contained in:
commit
40de346eb3
2 changed files with 26 additions and 55 deletions
|
|
@ -3,6 +3,14 @@
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
function download_noto() {
|
||||||
|
local NOTO_VERSION
|
||||||
|
# https://github.com/googlefonts/noto-emoji/releases/tag/v2.038
|
||||||
|
NOTO_VERSION="v2.038"
|
||||||
|
curl --silent -O --location --fail "https://github.com/googlefonts/noto-emoji/raw/${NOTO_VERSION}/fonts/NotoColorEmoji.ttf"
|
||||||
|
echo "NotoColorEmoji.ttf"
|
||||||
|
}
|
||||||
|
|
||||||
function download_deb() {
|
function download_deb() {
|
||||||
component=$1
|
component=$1
|
||||||
|
|
||||||
|
|
@ -17,14 +25,16 @@ function download_deb() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_debian() {
|
function build_debian() {
|
||||||
|
apt-get update
|
||||||
|
|
||||||
echo "Installing browser"
|
echo "Installing browser"
|
||||||
BROWSER_DEB="$(download_deb browser)"
|
BROWSER_DEB="$(download_deb browser)"
|
||||||
if [ "${ARCH}" == "arm64" ]; then
|
if [ "${ARCH}" == "arm64" ]; then
|
||||||
COMMON_DEB=$(download_deb common)
|
COMMON_DEB=$(download_deb common)
|
||||||
apt install -y "$PWD/${COMMON_DEB}" "$PWD/${BROWSER_DEB}"
|
apt-get install -y "./${COMMON_DEB}" "./${BROWSER_DEB}"
|
||||||
rm -rf "$COMMON_DEB"
|
rm -rf "$COMMON_DEB"
|
||||||
else
|
else
|
||||||
apt install -y "$PWD/${BROWSER_DEB}"
|
apt-get install -y "./${BROWSER_DEB}"
|
||||||
fi
|
fi
|
||||||
rm -f "$BROWSER_DEB"
|
rm -f "$BROWSER_DEB"
|
||||||
|
|
||||||
|
|
@ -38,10 +48,23 @@ function build_debian() {
|
||||||
rm -f chromedriver_linux64.zip
|
rm -f chromedriver_linux64.zip
|
||||||
else
|
else
|
||||||
DRIVER_DEB=$(download_deb driver)
|
DRIVER_DEB=$(download_deb driver)
|
||||||
apt install -y "$PWD/$DRIVER_DEB"
|
apt-get install -y "./$DRIVER_DEB"
|
||||||
rm -f "$DRIVER_DEB"
|
rm -f "$DRIVER_DEB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# We have loads of tests rendering emoji, so let's ensure a proper emoji font is installed
|
||||||
|
echo "Installing Noto emoji font"
|
||||||
|
FONT_FILE=$(download_noto)
|
||||||
|
|
||||||
|
mkdir -p /usr/local/share/fonts
|
||||||
|
mv "$FONT_FILE" /usr/local/share/fonts/
|
||||||
|
chmod 644 "/usr/local/share/fonts/${FONT_FILE}"
|
||||||
|
ls -la /usr/local/share/fonts/
|
||||||
|
|
||||||
|
fc-cache -fv
|
||||||
|
fc-match -s noto
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
apt-get autoremove -yq
|
apt-get autoremove -yq
|
||||||
apt-get clean -yqq
|
apt-get clean -yqq
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# This script installs noto color emoji
|
|
||||||
|
|
||||||
function build_debian() {
|
|
||||||
apt-get update
|
|
||||||
apt-get install unzip
|
|
||||||
|
|
||||||
cat > ~/.fonts.conf << EOM
|
|
||||||
<?xml version='1.0'?>
|
|
||||||
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
|
|
||||||
<fontconfig>
|
|
||||||
<match target="scan">
|
|
||||||
<test name="family">
|
|
||||||
<string>Noto Color Emoji</string>
|
|
||||||
</test>
|
|
||||||
<edit name="scalable" mode="assign"><bool>true</bool></edit>
|
|
||||||
</match>
|
|
||||||
<match target="pattern">
|
|
||||||
<test name="prgname">
|
|
||||||
<string>chrome</string>
|
|
||||||
</test>
|
|
||||||
<edit name="family" mode="prepend_first">
|
|
||||||
<string>Noto Color Emoji</string>
|
|
||||||
</edit>
|
|
||||||
</match>
|
|
||||||
</fontconfig>
|
|
||||||
EOM
|
|
||||||
|
|
||||||
mkdir setup_fonts
|
|
||||||
cd setup_fonts
|
|
||||||
curl https://noto-website-2.storage.googleapis.com/pkgs/NotoColorEmoji-unhinted.zip -LO
|
|
||||||
unzip NotoColorEmoji-unhinted.zip
|
|
||||||
|
|
||||||
mkdir -p /usr/local/share/fonts
|
|
||||||
cp NotoColorEmoji.ttf /usr/local/share/fonts/
|
|
||||||
ls -la /usr/local/share/fonts/
|
|
||||||
chmod 644 /usr/local/share/fonts/NotoColorEmoji.ttf
|
|
||||||
|
|
||||||
fc-cache -fv
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
rm -r setup_fonts
|
|
||||||
apt-get clean -yqq && rm -rf /var/lib/apt/lists/*
|
|
||||||
}
|
|
||||||
|
|
||||||
BUILD_OS=${BUILD_OS:-debian}
|
|
||||||
|
|
||||||
if [[ $BUILD_OS =~ debian ]]; then
|
|
||||||
build_debian "$@"
|
|
||||||
elif [[ $BUILD_OS =~ ubi ]]; then
|
|
||||||
build_ubi "$@"
|
|
||||||
fi
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue