ci(repo): migrate to github actions. (#119)

tests(repo): modified to github actions.
This commit is contained in:
Mojib Wali
2020-12-03 15:19:45 +01:00
committed by GitHub
parent e45832be2b
commit 84f963b407
8 changed files with 65 additions and 66 deletions

View File

@@ -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

54
.github/workflows/tests.yml vendored Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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
recursive-include invenio_theme_tugraz *.gitkeep
recursive-include .github/workflows *.yml

View File

@@ -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

View File

@@ -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

View File

@@ -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