From 6923aee503ac81c26d2425592e90a2254c7666d9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 22 Apr 2021 22:40:52 +0300 Subject: Move from Travis CI to GitHub Actions and Coveralls to Codecov --- .github/workflows/lint.yml | 12 ++++++++++ .github/workflows/test.yml | 59 ++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + .pre-commit-config.yaml | 12 ++++++++++ .travis.yml | 24 ------------------- tox.ini | 21 ++++++++--------- 6 files changed, 94 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml create mode 100644 .pre-commit-config.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..6f8c677 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,12 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..bab2ac2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,59 @@ +name: Test + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3"] + os: [ubuntu-latest, macos-latest, windows-latest] + include: + # Include new variables for Codecov + - { codecov-flag: GHA_Ubuntu, os: ubuntu-latest } + - { codecov-flag: GHA_macOS, os: macos-latest } + - { codecov-flag: GHA_Windows, os: windows-latest } + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + ${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ + hashFiles('**/setup.py') }} + restore-keys: | + ${{ matrix.os }}-${{ matrix.python-version }}-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install -U tox + + - name: Tox tests + run: | + tox -e py + + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + flags: ${{ matrix.codecov-flag }} + name: ${{ matrix.os }} Python ${{ matrix.python-version }} diff --git a/.gitignore b/.gitignore index 8b04075..fdacade 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ develop-eggs dist parts .coverage +coverage.xml htmlcov diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..763d597 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +repos: + + - repo: https://github.com/pycqa/flake8 + rev: 3.9.1 + hooks: + - id: flake8 + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: check-merge-conflict + - id: check-yaml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ab80767..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: python -matrix: - include: - - python: 2.7 - env: TOXENV=py27 - - python: 3.4 - env: TOXENV=py34 - - python: 3.5 - env: TOXENV=py35 - - python: 3.6 - env: TOXENV=py36 - - python: 3.5 - env: TOXENV=flake - - python: 3.5 - env: TOXENV=cover -install: - - pip install tox -script: - - tox -after_script: - - if [ $TOXENV == "cover" ]; then - pip install --quiet coveralls; - coveralls; - fi diff --git a/tox.ini b/tox.ini index 16616ab..cd25d99 100644 --- a/tox.ini +++ b/tox.ini @@ -1,20 +1,19 @@ [tox] -envlist = py27,py34,py35,py36,pypy,pypy3,flake,cover +envlist = + lint + py{36, 37, 38, 39, py3} [testenv] deps = commands = {envpython} setup.py test - -[testenv:flake] -basepython = python3.5 -commands= - pip install --quiet flake8 - {envpython} setup.py clean --all flake8 - -[testenv:cover] -basepython = python3.5 -commands = pip install --quiet coverage {envpython} setup.py clean --all coverage run setup.py test + coverage xml + +[testenv:lint] +deps = pre-commit +commands = pre-commit run --all-files +skip_install = true +passenv = PRE_COMMIT_COLOR -- cgit v1.2.1