Skip to content

Commit

Permalink
setup: change to reusable github workflows
Browse files Browse the repository at this point in the history
* move check_manifest configuration to setup.cfg

* remove upper constraint for pytest-black
  • Loading branch information
utnapischtim committed Feb 10, 2023
1 parent 2e5fbcb commit 75d78cf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 69 deletions.
21 changes: 2 additions & 19 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,5 @@ on:

jobs:
build-n-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel "babel<=2.9.1"
- name: Build package
run: |
python setup.py compile_catalog sdist bdist_wheel
- name: pypi-publish
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
uses: tu-graz-library/.github/.github/workflows/pypi-publish.yml@main
secrets: inherit
50 changes: 2 additions & 48 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,5 @@ on:
default: 'Manual trigger'

jobs:
Tests:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8, 3.9]
requirements-level: [pypi]
db-service: [postgresql13]
search-service: [opensearch2]
include:
- db-service: postgresql13
DB_EXTRAS: "postgresql"

- search-service: opensearch2
SEARCH_EXTRAS: "opensearch2"

env:
DB: ${{ matrix.db-service }}
SEARCH: ${{ matrix.search-service }}
EXTRAS: tests,${{ matrix.SEARCH_EXTRAS }}
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: |
pip install wheel requirements-builder
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.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }}

- name: Install dependencies
run: |
pip install -r .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt
pip install ".[$EXTRAS]"
pip freeze
docker --version
docker-compose --version
- name: Run tests
run: |
./run-tests.sh
tests:
uses: tu-graz-library/.github/.github/workflows/tests.yml@main
2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function cleanup() {
}
trap cleanup EXIT

python -m check_manifest --ignore ".*-requirements.txt"
python -m check_manifest
python -m sphinx.cmd.build -qnN docs docs/_build/html
eval "$(docker-services-cli up --search ${SEARCH:-elasticsearch} --env)"
python -m pytest
Expand Down
6 changes: 5 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ install_requires =

[options.extras_require]
tests =
pytest-black>=0.3.0,<0.3.10
pytest-black>=0.3.0
Sphinx>=4.5.0
pytest-invenio>=1.4.7
# elasticsearch7 =
Expand Down Expand Up @@ -95,6 +95,10 @@ output-dir = invenio_config_tugraz/translations/
[isort]
profile=black

[check-manifest]
ignore =
*-requirements.txt

[tool:pytest]
addopts = --black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_config_tugraz --cov-report=term-missing tests invenio_config_tugraz
testpaths = tests invenio_config_tugraz
Expand Down

0 comments on commit 75d78cf

Please sign in to comment.