Skip to content

Streamline add_placeholders_for_missing_children #521

Streamline add_placeholders_for_missing_children

Streamline add_placeholders_for_missing_children #521

Workflow file for this run

# Copyright 2019, 2022-2023 David Corbett
# Copyright 2020-2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Main workflow
on: push
permissions:
contents: read
env:
FONTFORGE_COMMIT: aa062f4cbd1db21e27b2620f16993ebe4c540ab6
HARFBUZZ_VERSION: 7.3.0
PYTHON_VERSION: 3.11
jobs:
main:
runs-on: ubuntu-22.04
strategy:
matrix:
noto:
- ''
requirements:
- frozen
- oldest
- newest
skip-check:
- ''
include:
- noto: Noto
requirements: frozen
- requirements: frozen
skip-check: skip-check
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache FontForge
id: cache-fontforge
uses: actions/cache@v3
with:
key: ${{ runner.os }}-fontforge-${{ env.FONTFORGE_COMMIT }}-python-${{ env.PYTHON_VERSION }}
path: fontforge
- name: Install FontForge
if: steps.cache-fontforge.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get -qy --no-install-recommends install \
build-essential \
cmake \
ninja-build \
packaging-dev \
pkg-config \
python${{ env.PYTHON_VERSION }}-dev \
;
curl -Lo fontforge.zip https://github.com/fontforge/fontforge/archive/${{ env.FONTFORGE_COMMIT }}.zip
unzip fontforge.zip
mv fontforge-${{ env.FONTFORGE_COMMIT }} fontforge
cd fontforge
curl -O https://patch-diff.githubusercontent.com/raw/fontforge/fontforge/pull/4232.patch
patch -p1 <4232.patch
mkdir build
cd build
cmake -G Ninja \
-D CMAKE_INSTALL_PREFIX="$PWD/target" \
-D ENABLE_DOCS=OFF \
-D ENABLE_GUI=OFF \
-D ENABLE_LIBGIF=OFF \
-D ENABLE_LIBJPEG=OFF \
-D ENABLE_LIBPNG=OFF \
-D ENABLE_LIBREADLINE=OFF \
-D ENABLE_LIBSPIRO=OFF \
-D ENABLE_LIBTIFF=OFF \
-D ENABLE_LIBUNINAMESLIST=OFF \
-D ENABLE_PYTHON_EXTENSION=ON \
-D ENABLE_NATIVE_SCRIPTING=OFF \
-D ENABLE_WOFF2=OFF \
.. \
;
ninja
sudo ninja install
- name: Add site-packages to default search path
run: echo "PYTHONPATH=$PWD/fontforge/build/target/lib/python${{ env.PYTHON_VERSION }}/site-packages:$PYTHONPATH" >>"$GITHUB_ENV"
- name: Cache HarfBuzz
if: matrix.skip-check == ''
id: cache-harfbuzz
uses: actions/cache@v3
with:
key: ${{ runner.os }}-harfbuzz-${{ env.HARFBUZZ_VERSION }}
path: .hb/harfbuzz-${{ env.HARFBUZZ_VERSION }}
- name: Install HarfBuzz
if: steps.cache-harfbuzz.outputs.cache-hit != 'true' && matrix.skip-check == ''
run: make HB_VERSION=${{ env.HARFBUZZ_VERSION }} hb-shape
- name: Add HarfBuzz to path
if: matrix.skip-check == ''
run: echo "$PWD/.hb/harfbuzz-${{ env.HARFBUZZ_VERSION }}/util" >>"$GITHUB_PATH"
- name: Install unifdef
run: |
sudo apt-get -qy --no-install-recommends install unifdef
- name: Prepare newest requirements
if: matrix.requirements == 'newest'
run: |
cp dev-requirements.in dev-requirements.txt
cp requirements.in requirements.txt
- name: Install dev requirements
if: matrix.skip-check == ''
run: pip install ${{ matrix.requirements != 'newest' && '--no-deps' || '' }} --upgrade --upgrade-strategy eager -r dev-requirements.txt
- name: Prepare oldest requirements
if: matrix.requirements == 'oldest'
run: |
./get-old-requirements.py --input requirements.in --output requirements.txt
- name: Make a virtual environment for building
run: python -m venv build-venv
- name: Install requirements
run: |
. build-venv/bin/activate
pip install ${{ matrix.requirements == 'frozen' && '--no-deps' || '' }} --upgrade --upgrade-strategy eager -r requirements.txt
- name: Build
run: |
. build-venv/bin/activate
make -B -j "NOTO=${{ matrix.noto }}"
- name: Test
if: matrix.skip-check == ''
run: make -j "NOTO=${{ matrix.noto }}" check
- name: Determine whether to push the fonts or upload them
id: push-or-upload
run: |
is_noto=${{ matrix.noto != '' }}
job_will_push=${{ github.ref_name == github.event.repository.default_branch && contains(github.event.repository.name, 'Noto') }}
if [ $job_will_push = true ]
then
echo push=$is_noto >>"$GITHUB_OUTPUT"
else
if [ $is_noto = true ]
then
upload_name=fonts-noto
elif [ ${{ matrix.skip-check != '' }} = true ]
then
upload_name=fonts
fi
echo upload-name=$upload_name >>"$GITHUB_OUTPUT"
fi
- name: Commit and push
if: steps.push-or-upload.outputs.push == 'true'
run: |
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
git config --local user.name 'github-actions[bot]'
git add -f fonts
git commit -m 'Automatically build the fonts'
git push
- name: Upload build artifacts
if: steps.push-or-upload.outputs.upload-name
uses: actions/upload-artifact@v3
with:
name: ${{ steps.push-or-upload.outputs.upload-name }}
path: fonts