From 018a798fdd080145ae81bb84ee320c6ae6625d2e Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Fri, 20 Nov 2020 10:06:27 +0000 Subject: [PATCH] Add GitHub Actions integration --- .github/workflows/publish.yml | 31 +++++++++++++ .github/workflows/test.yml | 86 +++++++++++++++++++++++++++++++++++ tox.ini | 2 +- 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..d43c8408e --- /dev/null +++ b/.github/workflows/publish.yml @@ -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/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..7c3025871 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/tox.ini b/tox.ini index b2d1033fe..8ced886b8 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ deps = pytest pytest-randomly -rrequirements.txt - !nolxml: lxml==4.5.0 + !nolxml: lxml==4.6.1 extras = ufo woff