From a2f47999435292d446d7276456b6da95e32caa38 Mon Sep 17 00:00:00 2001 From: Jiri Kyjovsky Date: Wed, 29 Mar 2023 12:09:12 +0200 Subject: [PATCH 1/2] ci: run tests on GH --- .github/workflows/tests.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a2882be --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,29 @@ +name: Tests + +on: + pull_request: + branches: + - main + +jobs: + test-cases: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-versions: ["3.8", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python --version ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install poetry + poetry install + - name: Run tests + run: | + poetry run pytest -vvv test/ From 70abef30a80ad3b6262f8434561d8fe105bb5a77 Mon Sep 17 00:00:00 2001 From: Jiri Kyjovsky Date: Wed, 29 Mar 2023 12:24:14 +0200 Subject: [PATCH 2/2] meta: not necessary pkgname field removed from meta --- alpa/config/packit.py | 4 ++-- test/constants.py | 2 -- test/unit/test_packit.py | 9 +++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/alpa/config/packit.py b/alpa/config/packit.py index 096e773..29d7e7a 100644 --- a/alpa/config/packit.py +++ b/alpa/config/packit.py @@ -15,13 +15,13 @@ def __init__(self, package_name: str) -> None: def get_packit_config(self) -> dict: return { - "specfile_path": f"{self.metadata.package_name}.spec", + "specfile_path": f"{self.package_name}.spec", "srpm_build_deps": ["pip"], "actions": { "create-archive": [ "pip install pyalpa alpa-conf", 'bash -c "alpa get-pkg-archive"', - f'bash -c "ls -1 ./{self.metadata.package_name}-*.tar.gz"', + f'bash -c "ls -1 ./{self.package_name}-*.tar.gz"', ], }, "jobs": [ diff --git a/test/constants.py b/test/constants.py index 63a115b..fa8d2dd 100644 --- a/test/constants.py +++ b/test/constants.py @@ -1,6 +1,4 @@ METADATA_CONFIG_ALL_KEYS = """ -name: pretty_package - autoupdate: true maintainers: diff --git a/test/unit/test_packit.py b/test/unit/test_packit.py index 8f437e1..fb3a4bb 100644 --- a/test/unit/test_packit.py +++ b/test/unit/test_packit.py @@ -5,9 +5,10 @@ from yaml import safe_load from alpa_conf.metadata import Metadata -from alpa_conf.packit import PackitConfig from test.constants import METADATA_CONFIG_ALL_KEYS +from alpa.config.packit import PackitConfig + class TestPackitConfig: @patch.object(Metadata, "_mandatory_fields_check") @@ -19,13 +20,13 @@ def test_get_packit_config( mock_mandatory_fields_check.return_value = True, "" assert PackitConfig("uwu").get_packit_config() == { - "specfile_path": "pretty_package.spec", + "specfile_path": "uwu.spec", "srpm_build_deps": ["pip"], "actions": { "create-archive": [ "pip install pyalpa alpa-conf", 'bash -c "alpa get-pkg-archive"', - 'bash -c "ls -1 ./pretty_package-*.tar.gz"', + 'bash -c "ls -1 ./uwu-*.tar.gz"', ], }, "jobs": [ @@ -71,4 +72,4 @@ def test_packit_config_file_exists( mock_load_metadata_config.return_value = safe_load(METADATA_CONFIG_ALL_KEYS) mock_mandatory_fields_check.return_value = True, "" - assert PackitConfig("uwu")._packit_config_file_exists() == result + assert PackitConfig("uwu").packit_config_file_exists() == result