Skip to content

Commit

Permalink
ci: Use xml2rfc-fonts for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kesara committed May 15, 2024
1 parent 01661ae commit 889b598
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 36 deletions.
54 changes: 19 additions & 35 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,23 @@ jobs:
- name: Download Fonts
if: steps.cache-fonts-linux.outputs.cache-hit != 'true'
run: |
echo "Downloading Noto Font..."
mkdir -p ~/.fonts/opentype/noto
wget -q https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip
unzip -q Noto-unhinted.zip -d ~/.fonts/opentype/noto/
mkdir -p /usr/share/fonts/truetype/noto/
ln -sf ~/.fonts/opentype/noto/*.[to]tf /usr/share/fonts/truetype/noto/
echo "Downloading Roboto Mono Font..."
mkdir -p ~/.fonts/opentype/roboto
wget -q https://fonts.google.com/download?family=Roboto%20Mono -O roboto-mono.zip
unzip -q roboto-mono.zip -d ~/.fonts/opentype/roboto/
mkdir -p /usr/share/fonts/truetype/roboto/
ln -sf ~/.fonts/opentype/roboto/*.[to]tf /usr/share/fonts/truetype/roboto/
echo "Downloading xml2rfc-fonts"
mkdir -p ~/.fonts/opentype ~/fonts
wget -q -O fonts.tar.gz https://github.com/ietf-tools/xml2rfc-fonts/archive/refs/tags/3.20.0.tar.gz
tar zxf fonts.tar.gz -C ~/fonts
mv ~/fonts/*/noto/* ~/.fonts/opentype/
mv ~/fonts/*/roboto_mono/* ~/.fonts/opentype/
mkdir -p /usr/share/fonts/truetype
ln -sf ~/.fonts/opentype/*.[to]tf /usr/share/fonts/truetype/
echo "Reloading Font Cache..."
fc-cache -f -v
- name: Link Fonts
if: steps.cache-fonts-linux.outputs.cache-hit == 'true'
run: |
echo "Linking Noto Font..."
mkdir -p /usr/share/fonts/truetype/noto/
ln -sf ~/.fonts/opentype/noto/*.[to]tf /usr/share/fonts/truetype/noto/
echo "Linking Roboto Mono Font..."
mkdir -p /usr/share/fonts/truetype/roboto/
ln -sf ~/.fonts/opentype/roboto/*.[to]tf /usr/share/fonts/truetype/roboto/
echo "Linking Fonts..."
mkdir -p /usr/share/fonts/truetype/
ln -sf ~/.fonts/opentype/*.[to]tf /usr/share/fonts/truetype/
echo "Reloading Font Cache..."
fc-cache -f -v
Expand Down Expand Up @@ -124,30 +117,21 @@ jobs:
id: cache-fonts-mac
uses: pat-s/[email protected]
with:
path: ~/new-fonts
path: ~/fonts
key: fonts-macos

- name: Download Fonts
if: steps.cache-fonts-mac.outputs.cache-hit != 'true'
run: |
mkdir -p ~/new-fonts
cd ~/new-fonts
echo "Downloading Noto Font..."
wget -q https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip
unzip -o -q Noto-unhinted.zip -d /Library/Fonts/
echo "Downloading Roboto Mono Font..."
wget -q https://fonts.google.com/download?family=Roboto%20Mono -O roboto-mono.zip
unzip -o -q roboto-mono.zip -d /Library/Fonts/
- name: Extract Fonts
if: steps.cache-fonts-mac.outputs.cache-hit == 'true'
run: |
unzip -o -q ~/new-fonts/Noto-unhinted.zip -d /Library/Fonts/
unzip -o -q ~/new-fonts/roboto-mono.zip -d /Library/Fonts/
echo "Downloading xml2rfc-fonts"
mkdir -p ~/fonts /Library/Fonts
wget -q -O fonts.tar.gz https://github.com/ietf-tools/xml2rfc-fonts/archive/refs/tags/3.20.0.tar.gz
tar zxf fonts.tar.gz -C ~/fonts
mv ~/fonts/*/noto/* /Library/Fonts/
mv ~/fonts/*/roboto_mono/* /Library/Fonts/
- name: Install dependencies
run: |
brew install pango libffi groff make diffutils
brew install weasyprint groff make diffutils
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
Expand Down
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def setUp(self):

def test_text_content(self):
def norm(t):
return re.sub(r'\s+', ' ', t).strip()
return re.sub(r'\s+', '', t).strip()
#
text = norm('\n'.join( p.text for p in self.pdfxml.xpath('.//Page/text') ))
for e in self.root.xpath('./middle//*'):
Expand Down

0 comments on commit 889b598

Please sign in to comment.