From 84f963b40762d8f429af9e9d16e1121288bbcd0f Mon Sep 17 00:00:00 2001 From: Mojib Wali <44528277+mb-wali@users.noreply.github.com> Date: Thu, 3 Dec 2020 15:19:45 +0100 Subject: [PATCH] ci(repo): migrate to github actions. (#119) tests(repo): modified to github actions. --- .editorconfig | 4 +-- .github/workflows/tests.yml | 54 ++++++++++++++++++++++++++++++++++++ .travis.yml | 55 ------------------------------------- CONTRIBUTING.rst | 2 +- MANIFEST.in | 3 +- README.rst | 4 +-- pytest.ini | 2 +- run-tests.sh | 7 ++--- 8 files changed, 65 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.editorconfig b/.editorconfig index fda371a..7bd22df 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 5853172..0000000 --- a/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2020 mojib wali. -# -# invenio-theme-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 - - REQUIREMENTS=devel - -python: - - "3.6" - - "3.7" - - "3.8" - -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 a62a25d..4b11771 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 2.7, 3.5 and 3.6. Check - https://travis-ci.com/github/tu-graz-library/invenio-theme-tugraz/pull_requests + https://github.com/tu-graz-library/invenio-theme-tugraz/actions?query=event%3Apull_request and make sure that the tests pass for all supported Python versions. diff --git a/MANIFEST.in b/MANIFEST.in index ce9ac31..256c703 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -35,4 +35,5 @@ recursive-include invenio_theme_tugraz *.less recursive-include invenio_theme_tugraz *.ico recursive-include tests *.py recursive-include invenio_theme_tugraz *.jpg -recursive-include invenio_theme_tugraz *.gitkeep \ No newline at end of file +recursive-include invenio_theme_tugraz *.gitkeep +recursive-include .github/workflows *.yml \ No newline at end of file diff --git a/README.rst b/README.rst index d00b4d0..6b2d96c 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ invenio-theme-tugraz ====================== -.. image:: https://travis-ci.com/tu-graz-library/invenio-theme-tugraz.svg - :target: https://travis-ci.com/github/tu-graz-library/invenio-theme-tugraz +.. image:: https://github.com/tu-graz-library/invenio-theme-tugraz/workflows/CI/badge.svg + :target: https://github.com/tu-graz-library/invenio-theme-tugraz/actions .. image:: https://img.shields.io/pypi/dm/invenio-theme-tugraz.svg :target: https://pypi.python.org/pypi/invenio-theme-tugraz diff --git a/pytest.ini b/pytest.ini index d43fee4..a9e180e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,6 +7,6 @@ # details. [pytest] -addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_theme_tugraz --cov-report=term-missing +addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_theme_tugraz --cov-report=term-missing tests invenio_theme_tugraz testpaths = tests invenio_theme_tugraz live_server_scope = module diff --git a/run-tests.sh b/run-tests.sh index 073e150..6b61e60 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -7,10 +7,9 @@ # 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