From 75d78cf09ade889745f053f3a682d625d6aee66d Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Thu, 9 Feb 2023 16:55:51 +0100 Subject: [PATCH] setup: change to reusable github workflows * move check_manifest configuration to setup.cfg * remove upper constraint for pytest-black --- .github/workflows/pypi-publish.yml | 21 ++----------- .github/workflows/tests.yml | 50 ++---------------------------- run-tests.sh | 2 +- setup.cfg | 6 +++- 4 files changed, 10 insertions(+), 69 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 659b76b..84decf9 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -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/gh-action-pypi-publish@v1.3.1 - with: - user: __token__ - password: ${{ secrets.pypi_password }} + uses: tu-graz-library/.github/.github/workflows/pypi-publish.yml@main + secrets: inherit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7382ae4..4f1a622 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/run-tests.sh b/run-tests.sh index 635e3f8..53379a7 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -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 diff --git a/setup.cfg b/setup.cfg index ef010cd..cc35e92 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 = @@ -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