Update testing instructions #206
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: ["master"] | |
tags: | |
- "*" | |
pull_request: | |
branches: ["master"] | |
workflow_dispatch: | |
jobs: | |
build-test: | |
# Python version < 3.7 requires ubuntu-20.04 | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.6", "3.x"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup locales | |
run: | | |
sudo locale-gen en_US.UTF-8 | |
sudo locale-gen de_DE.UTF-8 | |
sudo update-locale | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Test | |
run: | | |
pytest | |
- name: Test with lxml | |
run: | | |
pip install lxml | |
pytest | |
coverage-lint: | |
needs: build-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Setup locales | |
run: | | |
sudo locale-gen en_US.UTF-8 | |
sudo locale-gen de_DE.UTF-8 | |
sudo update-locale | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install lxml flake8 pytest coverage | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test and coverage | |
run: | | |
coverage run -m pytest | |
bash <(curl -s https://codecov.io/bash) | |
package-publish: | |
needs: coverage-lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Build packages | |
run: | | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
pip install setuptools wheel | |
python setup.py sdist bdist_wheel | |
- name: Publish to pypi | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |