Skip to content

Commit

Permalink
Merge pull request #5764 from m4rc1e/diffenator2-2
Browse files Browse the repository at this point in the history
update ci to use diffenator2
  • Loading branch information
simoncozens authored Jan 11, 2023
2 parents 5dcf6c0 + 269f8cb commit d3de6ba
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 43 deletions.
42 changes: 23 additions & 19 deletions .ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@ do
is_designer_dir=$(echo $dir | grep "designers")
if [ $font_count != 0 ]
then
echo "Checking $dir"
mkdir -p $OUT
# If pr contains modified fonts, check with Fontbakery, Diffenator and DiffBrowsers.
# If pr doesn't contain modified fonts, just check with Fontbakery.
modified_fonts=$(git diff --name-only origin/main HEAD $dir*.ttf)
if [ -n "$modified_fonts" ]
then
echo "Fonts have been modified. Checking fonts with all tools"
gftools qa -f $dir*.ttf -gfb -a -o $OUT/$(basename $dir)_qa --out-url $PR_URL
else
echo "Fonts have not been modified. Checking fonts with Fontbakery only"
gftools qa -f $dir*.ttf --fontbakery -o $OUT/$(basename $dir)_qa --out-url $PR_URL
fi
elif [ ! -z $is_designer_dir ]
then
echo "Checking designer profile"
pytest .ci/test_profiles.py $dir
else
echo "Skipping $dir. Directory does not contain fonts"
echo "Checking $dir"
mkdir -p $OUT
# If pr contains modified fonts, check with Fontbakery, Diffenator and DiffBrowsers.
# If pr doesn't contain modified fonts, just check with Fontbakery.
modified_fonts=$(git diff --name-only origin/main HEAD $dir*.ttf)
if [ -n "$modified_fonts" ]
then
echo "Fonts have been modified. Checking fonts with all tools"
if [ "$SCREENSHOTS" = true ]; then
gftools qa -f $dir*.ttf -gfb --diffbrowsers --imgs -o $OUT/$(basename $dir)_qa
else
gftools qa -f $dir*.ttf -gfb --diffenator --fontbakery -o $OUT/$(basename $dir)_qa --out-url $PR_URL
fi
else
echo "Fonts have not been modified. Checking fonts with Fontbakery only"
gftools qa -f $dir*.ttf --fontbakery -o $OUT/$(basename $dir)_qa --out-url $PR_URL
fi
elif [ ! -z $is_designer_dir ]
then
echo "Checking designer profile"
pytest .ci/test_profiles.py $dir
else
echo "Skipping $dir. Directory does not contain fonts"
fi
done

105 changes: 81 additions & 24 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,55 @@ on:

jobs:

build:
diffbrowsers:
name: Build Google Fonts
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.10']
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.8.0
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v1
- name: Setup python
uses: actions/setup-python@v1
- name: Set up Python 3.10
uses: actions/setup-python@v4.4.0
with:
# TODO use build matrix?
python-version: 3.8

- name: Install dependencies
# The --pre flag below will ensure we use the latest Font Bakery pre-releases
# and benefit from its newest checks:
python-version: '3.10'
- name: Install packages
run: |
sudo apt install libharfbuzz-dev libharfbuzz-bin libfreetype6-dev libglib2.0-dev libcairo2-dev
python -m pip install --upgrade pip
pip install --pre fontbakery
pip install gftools[qa] pytest
- name: Check fonts
env:
GF_API_KEY: ${{ secrets.GF_API_KEY }}
BSTACK_ACCESS_KEY: ${{ secrets.BSTACK_ACCESS_KEY }}
BSTACK_USERNAME: ${{ secrets.BSTACK_USERNAME }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
pip install "gftools[qa]@git+https://github.com/googlefonts/gftools@main"
shell: bash
- name: Setup Chrome
uses: browser-actions/setup-chrome@latest
- name: Setup Chrome Driver
uses: nanasess/setup-chromedriver@master

- name: Setup Firefox
uses: m4rc1e/setup-firefox@master
with:
firefox-version: '84.0'
- name: Setup Firefox Driver
uses: m4rc1e/setup-geckodriver@master

- name: Run Diffbrowsers
run: |
mkdir out
python -m youseedee 0x078A
chromedriver --url-base=/wd/hub &
sh .ci/run.sh
env:
PYTHONIOENCODING: 'utf-8'
PYTHONUTF8: '1'
SCREENSHOTS: true
shell: bash

- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v1
uses: andstor/file-existence-action@v2.0.0
with:
files: "out"

Expand All @@ -56,3 +68,48 @@ jobs:
name: qa
path: out/

diffenator:
name: Diffenate fonts
runs-on: ubuntu-latest

steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v1
- name: Set up Python 3.10
uses: actions/setup-python@v4.4.0
with:
python-version: '3.10'
- name: Install packages
run: |
pip install --upgrade pip
pip install "gftools[qa]@git+https://github.com/googlefonts/gftools@main"
shell: bash

- name: Run Diffenator
run: |
mkdir out
python -m youseedee 0x078A
sh .ci/run.sh
env:
PYTHONIOENCODING: 'utf-8'
PYTHONUTF8: '1'
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.number }}
shell: bash

- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v2.0.0
with:
files: "out"

- name: Upload check results
if: steps.check_files.outputs.files_exists == 'true'
uses: actions/upload-artifact@v1
with:
name: qa
path: out/

0 comments on commit d3de6ba

Please sign in to comment.