]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
update ci to use diffenator2
authorMarc Foley <m.foley.88@gmail.com>
Sat, 17 Dec 2022 09:38:17 +0000 (09:38 +0000)
committerMarc Foley <m.foley.88@gmail.com>
Wed, 11 Jan 2023 09:21:17 +0000 (09:21 +0000)
.ci/run.sh
.github/workflows/test.yaml

index 03d434c3c36117a433c2dc076fbaad609448e91f..91776a724339a390d80b9aba45ebf997a4edd2fc 100644 (file)
@@ -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
 
index fc8b65fb0fc9a7c6c01f57b12df6113cbb1e2030..94f46644fdb0e8ffd285e8534f86094b338e9bed 100644 (file)
@@ -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