mirror of
https://github.com/google/fonts.git
synced 2024-11-28 11:00:21 +03:00
Migrate CI to Github Actions (#2466)
* Migrate CI to Github Actions Replaces current Travis setup. Benefits include: - Faster - Multiple families can now be included in a single PR - PRs can come from forked repos Fixes #2463 * Restore travis file temporarily
This commit is contained in:
parent
ca242ca137
commit
5f3675b809
32
.ci/run_gh.sh
Normal file
32
.ci/run_gh.sh
Normal file
@ -0,0 +1,32 @@
|
||||
# Only run gftools qa on prs which have modified files in directories which
|
||||
# contain font binaries.
|
||||
|
||||
# Find directories which contain files that have been altered or added. Also
|
||||
# Skip /static directories.
|
||||
CHANGED_DIRS=$(git diff origin/master --dirstat=files --diff-filter d | sed "s/[0-9. ].*%//g" | grep -v "static")
|
||||
OUT=out
|
||||
|
||||
|
||||
for dir in $CHANGED_DIRS
|
||||
do
|
||||
font_count=$(ls -1 $dir*.ttf 2>/dev/null | wc -l)
|
||||
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/master 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
|
||||
else
|
||||
echo "Fonts have not been modified. Checking fonts with Fontbakery only"
|
||||
gftools qa -f $dir*.ttf --fontbakery -o $OUT/$(basename $dir)_qa
|
||||
fi
|
||||
else
|
||||
echo "Skipping $dir. Directory does not contain fonts"
|
||||
fi
|
||||
done
|
||||
|
42
.github/workflows/test.yaml
vendored
Normal file
42
.github/workflows/test.yaml
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
name: Google Fonts QA
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: Build Google Fonts
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
# TODO use build matrix?
|
||||
python-version: 3.8
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt install libharfbuzz-dev libharfbuzz-bin libfreetype6-dev libglib2.0-dev libcairo2-dev
|
||||
python -m pip install --upgrade pip
|
||||
pip install gftools[qa]
|
||||
- name: Check fonts
|
||||
env:
|
||||
GF_API_KEY: ${{ secrets.GF_API_KEY }}
|
||||
BSTACK_ACCESS_KEY: ${{ secrets.BSTACK_ACCESS_KEY }}
|
||||
BSTACK_USERNAME: ${{ secrets.BSTACK_USERNAME }}
|
||||
run: |
|
||||
sh .ci/run_gh.sh
|
||||
|
||||
- name: Check file existence
|
||||
id: check_files
|
||||
uses: andstor/file-existence-action@v1
|
||||
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/
|
||||
|
Loading…
Reference in New Issue
Block a user