Merge pull request #2100 from fonttools/switch-to-gha

Switch to GitHub Actions
This commit is contained in:
Cosimo Lupo 2020-11-20 11:03:54 +00:00 committed by GitHub
commit ae07ce6e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 151 additions and 239 deletions

View File

@ -1,56 +0,0 @@
environment:
matrix:
- JOB: "3.7 64-bit"
PYTHON_HOME: "C:\\Python37-x64"
- JOB: "3.8 64-bit"
PYTHON_HOME: "C:\\Python38-x64"
branches:
only:
- master
# We want to build wip/* branches since these are not usually used for PRs
- /^wip\/.*$/
# We want to build version tags as well.
- /^\d+\.\d+.*$/
install:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Prepend Python to the PATH of this build
- "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;%PATH%"
# check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
# upgrade pip and setuptools to avoid out-of-date warnings
- "python -m pip install --disable-pip-version-check --user --upgrade pip setuptools virtualenv"
# install the dependencies to run the tests
- "python -m pip install tox"
build: false
test_script:
# run tests with the current 'python' in %PATH%, and measure test coverage
- "tox -e py-cov"
after_test:
# upload test coverage to Codecov.io
- "tox -e codecov"
notifications:
- provider: Email
to:
- fonttools-dev@googlegroups.com
on_build_success: false
on_build_failure: true
on_build_status_changed: true

31
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a tag is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*

86
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,86 @@
name: Test
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install packages
run: pip install tox
- name: Run Tox
run: tox -e mypy,package_readme
test:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
platform: [ubuntu-latest, macos-latest, windows-latest]
exclude: # Only test on the oldest and latest supported stable Python on macOS and Windows.
- platform: macos-latest
python-version: 3.7
- platform: macos-latest
python-version: 3.8
- platform: windows-latest
python-version: 3.7
- platform: windows-latest
python-version: 3.8
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install packages
run: pip install tox coverage
- name: Run Tox
run: tox -e py-cov
- name: Run Tox without lxml
run: tox -e py-cov-nolxml
- name: Produce coverage files
run: |
coverage combine
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
test-cython:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install packages
run: pip install tox
- name: Run Tox
run: tox -e py-cy-nolxml
test-pypy3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python pypy3
uses: actions/setup-python@v2
with:
python-version: "pypy3"
- name: Install packages
run: pip install tox
- name: Run Tox
run: tox -e pypy3-nolxml

View File

@ -1,90 +0,0 @@
dist: xenial
language: python
python: 3.6
env:
global:
- TWINE_USERNAME="anthrotype"
- secure: PJuCmlDuwnojiw3QuDhfNAaU4f/yeJcEcRzJAudA66bwZK7hvxV7Tiy9A17Bm6yO0HbJmmyjsIr8h2e7/PyY6QCaV8RqcMDkQ0UraU16pRsihp0giVXJoWscj2sCP4cNDOBVwSaGAX8yZ2OONc5srESywghzcy8xmgw6O+XFqx4=
branches:
only:
- master
# We want to build wip/* branches since these are not usually used for PRs
- /^wip\/.*$/
# We want to build version tags as well.
- /^\d+\.\d+.*$/
matrix:
fast_finish: true
include:
- python: 3.6
env:
- TOXENV=mypy
- python: 3.6
env:
- TOXENV=py36-cov,package_readme
- BUILD_DIST=true
- python: 3.7
env: TOXENV=py37-cov
- python: 3.8
env: TOXENV=py38-cov
- python: 3.8
env: TOXENV=py38-cy
- python: pypy3
# disable coverage.py on pypy because of performance problems
env: TOXENV=pypy3
dist: xenial
- language: generic
os: osx
env:
- TOXENV=py3-cov
- HOMEBREW_NO_AUTO_UPDATE=1
allow_failures:
# We use fast_finish + allow_failures because OSX builds take forever
# https://blog.travis-ci.com/2013-11-27-fast-finishing-builds
- language: generic
os: osx
env:
- TOXENV=py3-cov
- HOMEBREW_NO_AUTO_UPDATE=1
cache:
- pip
- directories:
- $HOME/.pyenv_cache
addons:
apt:
packages:
- language-pack-de
before_install:
- source ./.travis/before_install.sh
install:
- ./.travis/install.sh
script:
- ./.travis/run.sh
after_success:
- ./.travis/after_success.sh
notifications:
irc: "irc.freenode.org##fonts"
email: fonttools-dev@googlegroups.com
deploy:
# deploy to Github Releases on tags
- provider: releases
api_key:
secure: KEcWhJxMcnKay7wmWJCpg2W5GWHTQ+LaRbqGM11IKGcQuEOFxWuG7W1xjGpVdKPj/MQ+cG0b9hGUFpls1hwseOA1HANMv4xjCgYkuvT1OdpX/KOcZ7gfe/qaovzVxHyP9xwohnHSJMb790t37fmDfFUSROx3iEexIX09LLoDjO8=
skip_cleanup: true
file_glob: true
file: "dist/*"
on:
tags: true
repo: fonttools/fonttools
all_branches: true
condition: "$BUILD_DIST == true"

View File

@ -1,16 +0,0 @@
#!/bin/bash
set -e
set -x
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
source .venv/bin/activate
fi
# upload coverage data to Codecov.io
[[ ${TOXENV} == *"-cov"* ]] && tox -e codecov
# if tagged commit, create distribution packages and deploy to PyPI
if [ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_REPO_SLUG" == "fonttools/fonttools" ] && [ "$BUILD_DIST" == true ]; then
tox -e pypi
fi

View File

@ -1,6 +0,0 @@
#!/bin/bash
if [[ -n "$PYENV_VERSION" ]]; then
wget https://github.com/praekeltfoundation/travis-pyenv/releases/download/${TRAVIS_PYENV_VERSION}/setup-pyenv.sh
source setup-pyenv.sh
fi

View File

@ -1,30 +0,0 @@
#!/bin/bash
set -e
set -x
ci_requirements="pip setuptools tox"
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
if [[ ${TOXENV} == *"py27"* ]]; then
# install pip on the system python
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
python -m pip install --user virtualenv
python -m virtualenv .venv/
elif [[ ${TOXENV} == *"py3"* ]]; then
# install current python3 with homebrew
# NOTE: the formula is now named just "python"
brew install python
command -v python3
python3 --version
python3 -m pip install virtualenv
python3 -m virtualenv .venv/
else
echo "unsupported $TOXENV: "${TOXENV}
exit 1
fi
source .venv/bin/activate
fi
python -m pip install --upgrade $ci_requirements

View File

@ -1,20 +0,0 @@
#!/bin/bash
set -e
set -x
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
source .venv/bin/activate
fi
tox --skip-missing-interpreters false
# re-run all the XML-related tests, this time without lxml but using the
# built-in ElementTree library.
if [ -z "$TOXENV" ]; then
TOXENV="py-nolxml"
else
# strip additional tox envs after the comma, add -nolxml factor
TOXENV="${TOXENV%,*}-nolxml"
fi
tox --skip-missing-interpreters false -e $TOXENV -- Tests/ufoLib Tests/misc/etree_test.py Tests/misc/plistlib_test.py

View File

@ -45,10 +45,15 @@ class BuildTest(unittest.TestCase):
if self.tempdir:
shutil.rmtree(self.tempdir)
@staticmethod
def get_test_input(test_file_or_folder):
path, _ = os.path.split(__file__)
return os.path.join(path, "data", test_file_or_folder)
def get_test_input(self, test_file_or_folder, copy=False):
parent_dir = os.path.dirname(__file__)
path = os.path.join(parent_dir, "data", test_file_or_folder)
if copy:
copied_path = os.path.join(self.tempdir, test_file_or_folder)
shutil.copy2(path, copied_path)
return copied_path
else:
return path
@staticmethod
def get_test_output(test_file_or_folder):
@ -314,11 +319,12 @@ class BuildTest(unittest.TestCase):
)
def test_varlib_nonmarking_CFF2(self):
ds_path = self.get_test_input('TestNonMarkingCFF2.designspace')
self.temp_dir()
ds_path = self.get_test_input('TestNonMarkingCFF2.designspace', copy=True)
ttx_dir = self.get_test_input("master_non_marking_cff2")
expected_ttx_path = self.get_test_output("TestNonMarkingCFF2.ttx")
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'TestNonMarkingCFF2_'):
self.compile_font(path, ".otf", self.tempdir)
@ -336,11 +342,12 @@ class BuildTest(unittest.TestCase):
self.expect_ttx(varfont, expected_ttx_path, tables)
def test_varlib_build_CFF2(self):
ds_path = self.get_test_input('TestCFF2.designspace')
self.temp_dir()
ds_path = self.get_test_input('TestCFF2.designspace', copy=True)
ttx_dir = self.get_test_input("master_cff2")
expected_ttx_path = self.get_test_output("BuildTestCFF2.ttx")
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'TestCFF2_'):
self.compile_font(path, ".otf", self.tempdir)
@ -358,11 +365,12 @@ class BuildTest(unittest.TestCase):
self.expect_ttx(varfont, expected_ttx_path, tables)
def test_varlib_build_CFF2_from_CFF2(self):
ds_path = self.get_test_input('TestCFF2Input.designspace')
self.temp_dir()
ds_path = self.get_test_input('TestCFF2Input.designspace', copy=True)
ttx_dir = self.get_test_input("master_cff2_input")
expected_ttx_path = self.get_test_output("BuildTestCFF2.ttx")
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'TestCFF2_'):
self.compile_font(path, ".otf", self.tempdir)
@ -380,11 +388,12 @@ class BuildTest(unittest.TestCase):
self.expect_ttx(varfont, expected_ttx_path, tables)
def test_varlib_build_sparse_CFF2(self):
ds_path = self.get_test_input('TestSparseCFF2VF.designspace')
self.temp_dir()
ds_path = self.get_test_input('TestSparseCFF2VF.designspace', copy=True)
ttx_dir = self.get_test_input("master_sparse_cff2")
expected_ttx_path = self.get_test_output("TestSparseCFF2VF.ttx")
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'MasterSet_Kanji-'):
self.compile_font(path, ".otf", self.tempdir)
@ -402,11 +411,12 @@ class BuildTest(unittest.TestCase):
self.expect_ttx(varfont, expected_ttx_path, tables)
def test_varlib_build_vpal(self):
ds_path = self.get_test_input('test_vpal.designspace')
self.temp_dir()
ds_path = self.get_test_input('test_vpal.designspace', copy=True)
ttx_dir = self.get_test_input("master_vpal_test")
expected_ttx_path = self.get_test_output("test_vpal.ttx")
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'master_vpal_test_'):
self.compile_font(path, ".otf", self.tempdir)
@ -494,11 +504,12 @@ class BuildTest(unittest.TestCase):
self.expect_ttx(varfont, expected_ttx_path, tables)
def test_varlib_build_from_ttf_paths(self):
ds_path = self.get_test_input("Build.designspace")
self.temp_dir()
ds_path = self.get_test_input("Build.designspace", copy=True)
ttx_dir = self.get_test_input("master_ttx_interpolatable_ttf")
expected_ttx_path = self.get_test_output("BuildMain.ttx")
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'TestFamily-'):
self.compile_font(path, ".ttf", self.tempdir)
@ -643,12 +654,13 @@ class BuildTest(unittest.TestCase):
assert all(tag in mvar_tags for tag in fontTools.varLib.mvar.MVAR_ENTRIES)
def test_varlib_build_VVAR_CFF2(self):
ds_path = self.get_test_input('TestVVAR.designspace')
self.temp_dir()
ds_path = self.get_test_input('TestVVAR.designspace', copy=True)
ttx_dir = self.get_test_input("master_vvar_cff2")
expected_ttx_name = 'TestVVAR'
suffix = '.otf'
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'TestVVAR'):
font, savepath = self.compile_font(path, suffix, self.tempdir)
@ -668,12 +680,13 @@ class BuildTest(unittest.TestCase):
self.check_ttx_dump(varfont, expected_ttx_path, tables, suffix)
def test_varlib_build_BASE(self):
ds_path = self.get_test_input('TestBASE.designspace')
self.temp_dir()
ds_path = self.get_test_input('TestBASE.designspace', copy=True)
ttx_dir = self.get_test_input("master_base_test")
expected_ttx_name = 'TestBASE'
suffix = '.otf'
self.temp_dir()
for path in self.get_file_list(ttx_dir, '.ttx', 'TestBASE'):
font, savepath = self.compile_font(path, suffix, self.tempdir)

View File

@ -16,7 +16,7 @@ deps =
pytest
pytest-randomly
-rrequirements.txt
!nolxml: lxml==4.5.0
!nolxml: lxml==4.6.1
extras =
ufo
woff