Skip to content

Commit

Permalink
Migrate to gh-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
avivace authored and lnielsen committed Dec 9, 2020
1 parent 6e8b13d commit 11aa24e
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 128 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish

on:
push:
tags:
- v*

jobs:
Publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build package
# Remove `compile_catalog` if the package has no translations.
run: |
python setup.py compile_catalog sdist bdist_wheel
- name: Publish on PyPI
uses: pypa/[email protected]
with:
user: __token__
# The token is provided by the inveniosoftware organization
password: ${{ secrets.pypi_token }}
47 changes: 19 additions & 28 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-requirements: [min, pypi]
python-version: [3.6, 3.7, 3.8, 3.9]
requirements-level: [min, pypi]
cache-service: [redis]
db-service: [postgresql9, postgresql11, mysql5, mysql8]
exclude:
- python-version: 3.8
python-requirements: min
requirements-level: min

- python-version: 3.9
requirements-level: min

- db-service: postgresql11
python-version: 3.6
Expand All @@ -35,34 +39,21 @@ jobs:

include:
- db-service: postgresql9
DB: postgresql
POSTGRESQL_VERSION: POSTGRESQL_9_LATEST
SQLALCHEMY_DATABASE_URI: "postgresql+psycopg2://invenio:invenio@localhost:5432/invenio"
EXTRAS: "all,postgresql"
DB_EXTRAS: "postgresql"

- db-service: postgresql11
DB: postgresql
POSTGRESQL_VERSION: POSTGRESQL_11_LATEST
SQLALCHEMY_DATABASE_URI: "postgresql+psycopg2://invenio:invenio@localhost:5432/invenio"
EXTRAS: "all,postgresql"
DB_EXTRAS: "postgresql"

- db-service: mysql5
DB: mysql
MYSQL_VERSION: MYSQL_5_LATEST
SQLALCHEMY_DATABASE_URI: "mysql+pymysql://invenio:invenio@localhost:3306/invenio"
EXTRAS: "all,mysql"
DB_EXTRAS: "mysql"

- db-service: mysql8
DB: mysql
MYSQL_VERSION: MYSQL_8_LATEST
SQLALCHEMY_DATABASE_URI: "mysql+pymysql://invenio:invenio@localhost:3306/invenio"
EXTRAS: "all,mysql"
env:
SQLALCHEMY_DATABASE_URI: ${{matrix.SQLALCHEMY_DATABASE_URI}}
POSTGRESQL_VERSION: ${{matrix.POSTGRESQL_VERSION}}
MYSQL_VERSION: ${{matrix.MYSQL_VERSION}}
DB: ${{ matrix.DB }}
DB_EXTRAS: "mysql"

env:
CACHE: ${{ matrix.cache-service }}
DB: ${{ matrix.db-service }}
EXTRAS: all,${{ matrix.DB_EXTRAS }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -75,18 +66,18 @@ jobs:
- name: Generate dependencies
run: |
python -m pip install --upgrade pip setuptools py wheel requirements-builder
requirements-builder -e ${{ matrix.EXTRAS }} --level=${{ matrix.python-requirements }} setup.py > .${{ matrix.python-requirements }}-${{ matrix.python-version }}-requirements.txt
requirements-builder -e "$EXTRAS" --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.python-requirements }}-${{ matrix.python-version }}-requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }}

- name: Install dependencies
run: |
pip install -r .${{matrix.python-requirements}}-${{ matrix.python-version }}-requirements.txt
pip install .[${{ matrix.EXTRAS }}]
pip install -r .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt
pip install ".[$EXTRAS]"
pip freeze
docker --version
docker-compose --version
Expand Down
87 changes: 0 additions & 87 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,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.3, 3.4 and 3.5. Check
https://travis-ci.org/inveniosoftware/invenio-accounts/pull_requests
https://github.com/inveniosoftware/invenio-accounts/actions?query=event%3Apull_request
and make sure that the tests pass for all supported Python versions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ recursive-include invenio_accounts *.txt
recursive-include invenio_accounts *.po *.pot *.mo
recursive-include invenio_accounts *.py
recursive-include tests *.py
recursive-include .github/workflows *.yml
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
.. image:: https://img.shields.io/github/license/inveniosoftware/invenio-accounts.svg
:target: https://github.com/inveniosoftware/invenio-accounts/blob/master/LICENSE

.. image:: https://img.shields.io/travis/inveniosoftware/invenio-accounts.svg
:target: https://travis-ci.org/inveniosoftware/invenio-accounts
.. image:: https://github.com/inveniosoftware/invenio-accounts/workflows/CI/badge.svg
:target: https://github.com/inveniosoftware/invenio-accounts/actions?query=workflow%3ACI

.. image:: https://img.shields.io/coveralls/inveniosoftware/invenio-accounts.svg
:target: https://coveralls.io/r/inveniosoftware/invenio-accounts
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@

[pytest]
addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_accounts --cov-report=term-missing
testpaths = tests invenio_accounts
16 changes: 7 additions & 9 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2020 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

# Usage:
# env DB=postgresql ./run-tests.sh

# Quit on errors
set -o errexit

# Quit on unbound symbols
set -o nounset

# Always bring down docker services
function cleanup {
docker-services-cli down
function cleanup() {
eval "$(docker-services-cli down --env)"
}
trap cleanup EXIT


python -m check_manifest --ignore ".*-requirements.txt"
python -m sphinx.cmd.build -qnNW docs docs/_build/html
docker-services-cli up redis ${DB:-}
eval "$(docker-services-cli up --db ${DB:-postgresql} --cache ${CACHE:-redis} --env)"
python -m pytest
python -m sphinx.cmd.build -qnNW -b doctest docs docs/_build/doctest
tests_exit_code=$?
exit "$tests_exit_code"
python -m sphinx.cmd.build -qnNW -b doctest docs docs/_build/doctest
exit "$tests_exit_code"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
history = open('CHANGES.rst').read()

tests_require = [
'pytest-invenio>=1.4.0',
"pytest-invenio>=1.4.0"
]

extras_require = {
Expand Down

0 comments on commit 11aa24e

Please sign in to comment.