]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
Use Rust tooling for QA action
authorSimon Cozens <simon@simon-cozens.org>
Mon, 24 Mar 2025 14:55:28 +0000 (14:55 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Tue, 1 Apr 2025 08:15:00 +0000 (09:15 +0100)
.ci/run.py
.github/workflows/test.yaml

index 3b95137c685f1258d3636b7d6c0783da3101cb51..20bfad0a7d609d3aa1476a9ffe83821678d268a5 100644 (file)
@@ -15,7 +15,7 @@ def main():
     parser.add_argument(
         "--render", action="store_true", help="Check rendering of families only"
     )
-    parser.add_argument("--pr-number", help="PR to output fontbakery report to")
+    parser.add_argument("--pr-number", help="PR to output fontspector report to")
     parser.add_argument(
         "--pr-url-body", default="https://www.github.com/google/fonts/pull/%s"
     )
@@ -49,20 +49,20 @@ def main():
         elif check_type == CheckType.NEW_FAMILY:
             print(f"Checking new family: {directory}")
             subprocess.run(
-                qa_cmd_prefix + ["--fontbakery", "--interpolations"], check=True
+                qa_cmd_prefix + ["--fontspector", "--interpolations"], check=True
             )
 
         elif check_type == CheckType.MODIFIED_FAMILY:
             print(f"Checking modified family: {directory}")
             subprocess.run(
                 qa_cmd_prefix
-                + ["-gfb", "--fontbakery", "--diffenator", "--interpolations"],
+                + ["-gfb", "--fontspector", "--diffenator", "--interpolations"],
                 check=True,
             )
 
         elif check_type == CheckType.MODIFIED_FAMILY_METADATA:
             print(f"Checking modified family metadata: {directory}")
-            subprocess.run(qa_cmd_prefix + ["--fontbakery", "-o", out], check=True)
+            subprocess.run(qa_cmd_prefix + ["--fontspector", "-o", out], check=True)
 
         elif check_type == CheckType.DESIGNER:
             print(f"Checking designer profile: {directory}")
index 2843ccbfac9bc8a07f38ad50d0ea5466df0e41d4..2855ce4e7bad3843496597d6325e3860609e2ef7 100644 (file)
@@ -2,30 +2,32 @@ name: Google Fonts QA
 on:
   pull_request:
     paths:
-    - 'ofl/*/*'
-    - 'ufl/*/*'
-    - 'apache/*/*'
+      - "ofl/*/*"
+      - "ufl/*/*"
+      - "apache/*/*"
 
-jobs:
+env:
+  DIFFENATOR3_VERSION: "0.1.2"
 
+jobs:
   diffbrowsers:
     name: Build Google Fonts
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        python-version: ['3.10']
+        python-version: ["3.10"]
         os: [windows-latest, macos-13, ubuntu-22.04]
     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'
+          python-version: "3.10"
       - name: Install packages
         run: |
           pip install gftools[qa] pytest
@@ -33,7 +35,7 @@ jobs:
       - name: Setup Chrome
         uses: browser-actions/setup-chrome@v1.6.2
         with:
-          chrome-version: '127.0.6509.0'
+          chrome-version: "127.0.6509.0"
       - name: Setup Chrome Driver
         uses: nanasess/setup-chromedriver@v2.2.2
 
@@ -51,8 +53,8 @@ jobs:
           chromedriver --url-base=/wd/hub &
           python3 .ci/run.py --render
         env:
-          PYTHONIOENCODING: 'utf-8'
-          PYTHONUTF8: '1'
+          PYTHONIOENCODING: "utf-8"
+          PYTHONUTF8: "1"
         shell: bash
 
       - name: Check file existence
@@ -83,33 +85,45 @@ jobs:
         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'
+          python-version: "3.10"
       - name: Install packages
         # The --pre flag below will ensure we use the latest Font Bakery pre-releases
         # and benefit from its newest checks:
         run: |
           pip install --upgrade pip
-          pip install --pre fontbakery[googlefonts]
-          pip install gftools[qa] pytest
+          pip install pytest
+          pip install "gftools[qa]@git+https://github.com/simoncozens/gftools@rust-qa"
         shell: bash
+      - name: Install diffenator3 and fontspector
+        run: |
+          wget https://nightly.link/fonttools/fontspector/workflows/rust/main/fontspector-dev-x86_64-unknown-linux-gnu-py3.10.tar.gz.zip
+          unzip fontspector-dev-x86_64-unknown-linux-gnu-py3.10.tar.gz.zip
+          tar zxvf fontspector-dev-x86_64-unknown-linux-gnu-py3.10.tar.gz
+          sudo cp fontspector-dev*/fontspector /usr/local/bin/
 
+          wget "https://github.com/googlefonts/diffenator3/releases/download/v$DIFFENATOR3_VERSION/diffenator3-v$DIFFENATOR3_VERSION-x86_64-unknown-linux-musl.tar.gz"
+          tar zxvf diffenator3-v$DIFFENATOR3_VERSION-x86_64-unknown-linux-musl.tar.gz
+          cp diffenator3*/* /usr/local/bin/
+      - name: Install interpolatable
+        run: |
+          cargo install --git https://github.com/simoncozens/interpolatable
       - name: Run Diffenator and Fontbakery
         run: |
           mkdir out
           python -m youseedee 0x078A
           python3 .ci/run.py --pr-number $PR_NUMBER --pr-url-body https://www.github.com/google/fonts/pull/
         env:
-          PYTHONIOENCODING: 'utf-8'
-          PYTHONUTF8: '1'
+          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
@@ -148,7 +162,6 @@ jobs:
       - name: Set up Python 3.10
         uses: actions/setup-python@v4.4.0
         with:
-          python-version: '3.10'
+          python-version: "3.10"
       - name: Test font with ftxvalidator
         run: python3 .ci/ftxvalidator.py
-