From 1b93776d73fde8597bde8251b960e85e2aa2dfea Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Sat, 17 Dec 2022 09:38:17 +0000 Subject: [PATCH 1/2] update ci to use diffenator2 --- .ci/run.sh | 42 ++++++++------- .github/workflows/test.yaml | 105 +++++++++++++++++++++++++++--------- 2 files changed, 104 insertions(+), 43 deletions(-) diff --git a/.ci/run.sh b/.ci/run.sh index 03d434c3c36..91776a72433 100644 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fc8b65fb0fc..94f46644fdb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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, linux-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" @@ -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/ \ No newline at end of file From 269f8cb33573348492d82277888b7cdb2b1da985 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Wed, 11 Jan 2023 09:39:28 +0000 Subject: [PATCH 2/2] use ubuntu --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 94f46644fdb..4243766617f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: strategy: matrix: python-version: ['3.10'] - os: [windows-latest, macos-latest, linux-latest] + os: [windows-latest, macos-latest, ubuntu-latest] steps: - name: Cancel previous uses: styfle/cancel-workflow-action@0.11.0