From bfcda436adc46c68eb01e1de3af3bc9dedfdad37 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Tue, 2 Apr 2024 12:43:51 +0200 Subject: [PATCH 1/2] tests: move to reusable workflows * pytest-black -> pytest-black-ng, since former is unsupported * reorder alphabetical the test_requires dependency list --- .github/workflows/tests.yml | 65 ++++--------------------------------- setup.cfg | 12 +++---- 2 files changed, 12 insertions(+), 65 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c2bd765..1eb13f5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,7 +2,7 @@ # # This file is part of Invenio. # Copyright (C) 2020 CERN. -# Copyright (C) 2022 Graz University of Technology. +# Copyright (C) 2022-2024 Graz University of Technology. # # 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. @@ -16,67 +16,14 @@ on: branches: master schedule: # * is a special character in YAML so you have to quote this string - - cron: '0 3 * * 6' + - cron: "0 3 * * 6" workflow_dispatch: inputs: reason: - description: 'Reason' + description: "Reason" required: false - default: 'Manual trigger' + default: "Manual trigger" jobs: - Tests: - runs-on: ubuntu-20.04 - timeout-minutes: 20 - strategy: - matrix: - python-version: [3.8, 3.9] - requirements-level: [pypi] - db-service: [postgresql14,postgresql13,mysql8] - mq-service: [rabbitmq] - search-service: [opensearch2,elasticsearch7] - include: - - db-service: postgresql14 - DB_EXTRAS: "postgresql" - - - db-service: postgresql13 - DB_EXTRAS: "postgresql" - - - db-service: mysql8 - DB_EXTRAS: "mysql" - env: - DB: ${{ matrix.db-service }} - MQ: ${{ matrix.mq-service }} - SEARCH: ${{ matrix.search-service }} - EXTRAS: tests,${{ matrix.search-service }} - 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 + Python: + uses: inveniosoftware/workflows/.github/workflows/tests-python.yml@master diff --git a/setup.cfg b/setup.cfg index 534bdc6..dee46a4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. -# Copyright (C) 2022 Graz University of Technology. +# Copyright (C) 2022-2024 Graz University of Technology. # # 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. @@ -38,15 +38,15 @@ install_requires = [options.extras_require] tests = - pytest-black>=0.3.0 + invenio-admin>=1.3.0,<2.0.0 + invenio-celery>=1.2.5,<2.0.0 + invenio-db[mysql,postgresql,versioning]>=1.0.9,<2.0.0 invenio-indexer>=2.1.0,<3.0.0 invenio-jsonschemas>=1.1.3,<2.0.0 - mock>=1.3.0 + pytest-black-ng>=0.4.0 pytest-invenio>=2.1.0,<3.0.0 - invenio-admin>=1.3.0,<2.0.0 - invenio-celery>=1.2.5,<2.0.0 + mock>=1.3.0 Sphinx>=4.5.0 - invenio-db[mysql,postgresql,versioning]>=1.0.9,<2.0.0 elasticsearch7 = invenio-search[elasticsearch7]>=2.1.0,<3.0.0 opensearch1 = From 141ba81c75e9e54a4e8ef83fd3db92900ea23bad Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Tue, 24 Sep 2024 14:25:32 +0200 Subject: [PATCH 2/2] setup: make invenio-admin optional --- .github/workflows/tests.yml | 2 ++ setup.cfg | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1eb13f5..264fff9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,3 +27,5 @@ on: jobs: Python: uses: inveniosoftware/workflows/.github/workflows/tests-python.yml@master + with: + extras: tests,admin diff --git a/setup.cfg b/setup.cfg index dee46a4..310a321 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,7 +38,6 @@ install_requires = [options.extras_require] tests = - invenio-admin>=1.3.0,<2.0.0 invenio-celery>=1.2.5,<2.0.0 invenio-db[mysql,postgresql,versioning]>=1.0.9,<2.0.0 invenio-indexer>=2.1.0,<3.0.0 @@ -47,6 +46,8 @@ tests = pytest-invenio>=2.1.0,<3.0.0 mock>=1.3.0 Sphinx>=4.5.0 +admin = + invenio-admin>=1.3.0,<2.0.0 elasticsearch7 = invenio-search[elasticsearch7]>=2.1.0,<3.0.0 opensearch1 =