-
Notifications
You must be signed in to change notification settings - Fork 2
165 lines (164 loc) · 6.12 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# 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: 8.1.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