Skip to content

Commit

Permalink
Merge pull request #16 from nikromen/ci
Browse files Browse the repository at this point in the history
ci: run tests on GH
  • Loading branch information
nikromen authored Mar 29, 2023
2 parents e08ce95 + 70abef3 commit 0a7ef83
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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/
4 changes: 2 additions & 2 deletions alpa/config/packit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 0 additions & 2 deletions test/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
METADATA_CONFIG_ALL_KEYS = """
name: pretty_package
autoupdate: true
maintainers:
Expand Down
9 changes: 5 additions & 4 deletions test/unit/test_packit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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": [
Expand Down Expand Up @@ -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

0 comments on commit 0a7ef83

Please sign in to comment.