diff --git a/.editorconfig b/.editorconfig index 1fc0b5b..eb62f29 100644 --- a/.editorconfig +++ b/.editorconfig @@ -32,8 +32,8 @@ indent_size = 4 [*.{css,html,js,json,yml}] indent_size = 2 -# Matches the exact files either package.json or .travis.yml -[{package.json,.travis.yml}] +# Matches the exact files either package.json or .github/workflows/*.yml +[{package.json,.github/workflows/*.yml}] indent_size = 2 # Dockerfile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..dc2eccb --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + branches: master + pull_request: + branches: master + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '0 3 * * 6' + workflow_dispatch: + inputs: + reason: + description: 'Reason' + required: false + default: 'Manual trigger' + +jobs: + Tests: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + requirements-level: [min, pypi] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Generate dependencies + run: | + python -m pip install --upgrade pip setuptools py wheel requirements-builder + requirements-builder -e all --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt + + - name: Cache pip + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }} + + - name: Install dependencies + run: | + pip install -r .${{matrix.requirements-level}}-${{ matrix.python-version }}-requirements.txt + pip install .[all] + pip freeze + + - name: Run tests + run: | + ./run-tests.sh \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1fc0ba2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2020 Mojib Wali. -# -# invenio-config-tugraz is free software; you can redistribute it and/or -# modify it under the terms of the MIT License; see LICENSE file for more -# details. -branches: - except: - - /^v\d+\.\d+(\.\d+)?(\S*)?$/ - -notifications: - email: false - -sudo: false - -language: python - -matrix: - fast_finish: true - allow_failures: - # To allow failures, you need to specify the full environment - - env: REQUIREMENTS=devel - -cache: - - pip - -env: - - REQUIREMENTS=lowest - - REQUIREMENTS=release DEPLOY=true - - REQUIREMENTS=devel - -python: - - "3.6" - - "3.7" - -before_install: - - "nvm install 6; nvm use 6" - - "travis_retry pip install --upgrade pip setuptools py" - - "travis_retry pip install twine wheel coveralls requirements-builder" - - "requirements-builder -e all --level=min setup.py > .travis-lowest-requirements.txt" - - "requirements-builder -e all --level=pypi setup.py > .travis-release-requirements.txt" - - "requirements-builder -e all --level=dev --req requirements-devel.txt setup.py > .travis-devel-requirements.txt" - -install: - - "travis_retry pip install -r .travis-${REQUIREMENTS}-requirements.txt" - - "travis_retry pip install -e .[all]" - -script: - - "./run-tests.sh" - -after_success: - - coveralls \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index cd973f4..4e8e7bd 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -114,5 +114,5 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring. 3. The pull request should work for Python 3.6 and 3.7. Check - https://travis-ci.com/github/tu-graz-library/invenio-config-tugraz/pull_requests + https://github.com/github/tu-graz-library/invenio-config-tugraz//actions?query=event%3Apull_request and make sure that the tests pass for all supported Python versions. diff --git a/README.rst b/README.rst index a2cb218..2993ade 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ invenio-config-tugraz ======================= -.. image:: https://travis-ci.com/tu-graz-library/invenio-config-tugraz.svg - :target: https://travis-ci.com/github/tu-graz-library/invenio-config-tugraz +.. image:: https://github.com/tu-graz-library/invenio-config-tugraz/workflows/CI/badge.svg + :target: https://github.com/tu-graz-library/invenio-config-tugraz/actions .. image:: https://img.shields.io/pypi/dm/invenio-config-tugraz.svg :target: https://pypi.python.org/pypi/invenio-config-tugraz diff --git a/pytest.ini b/pytest.ini index bfaacfc..ba9347e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,6 +7,6 @@ # details. [pytest] -addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_config_tugraz --cov-report=term-missing +addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_config_tugraz --cov-report=term-missing tests invenio_config_tugraz testpaths = tests invenio_config_tugraz live_server_scope = module \ No newline at end of file diff --git a/run-tests.sh b/run-tests.sh index 4a867b0..3c69f79 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -7,11 +7,10 @@ # modify it under the terms of the MIT License; see LICENSE file for more # details. -docker-services-cli up postgresql es redis -python -m check_manifest --ignore ".travis-*" && \ -python -m sphinx.cmd.build -qnNW docs docs/_build/html && \ -docker-services-cli up es postgresql redis +python -m check_manifest --ignore ".*-requirements.txt" +python -m sphinx.cmd.build -qnNW docs docs/_build/html +docker-services-cli --verbose up es postgresql redis python -m pytest tests_exit_code=$? docker-services-cli down -exit "$tests_exit_code" \ No newline at end of file +exit "$tests_exit_code"