diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.packit.yaml b/.packit.yaml index 9eedc7e..e69beae 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -36,15 +36,20 @@ srpm_build_deps: - python3-hatch-vcs jobs: - - job: propose_downstream - trigger: release - dist_git_branches: - - fedora-all + # PR jobs - job: copr_build trigger: pull_request targets: - fedora-all - epel-9 + + - job: tests + trigger: pull_request + targets: + - fedora-all + - epel-9 + + # Latest-greatest development build - job: copr_build trigger: commit branch: main @@ -54,6 +59,13 @@ jobs: - epel-9 list_on_homepage: True preserve_project: True + + # Jobs on release + - job: propose_downstream + trigger: release + dist_git_branches: + - fedora-all + - job: copr_build trigger: release project: packit-releases @@ -63,13 +75,14 @@ jobs: list_on_homepage: True preserve_project: True - # downstream automation: + # Downstream automation - job: koji_build trigger: commit packit_instances: ["stg"] dist_git_branches: - fedora-all - epel-9 + - job: bodhi_update trigger: commit packit_instances: ["stg"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0534b1a..85175bb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,3 +62,10 @@ repos: - LICENSE_HEADER.txt - --comment-style - "#" + - repo: https://github.com/teemtee/tmt.git + rev: 1.41.0 + hooks: + - id: tmt-lint + # Do not run in pre-commit.ci as it requires an internet access + # for verifying imported tmt plans + stages: [manual, pre-push] diff --git a/ci.fmf b/ci.fmf deleted file mode 100644 index 3332f2d..0000000 --- a/ci.fmf +++ /dev/null @@ -1,11 +0,0 @@ -/test/build: - /smoke: - execute: - how: shell - script: - - python3 -c "import requre" - /full: - execute: - how: shell - script: - - pwd; cd ~/git-source && pwd && make check diff --git a/plans/full.fmf b/plans/full.fmf new file mode 100644 index 0000000..c93f645 --- /dev/null +++ b/plans/full.fmf @@ -0,0 +1,14 @@ +summary: + Unit & integration tests + +discover+: + filter: tier:1 + +prepare: + # Enable packit-dev Copr repo to get the latest builds of packages + - how: install + copr: packit/packit-dev + + # Make sure the Copr repo has higher priority than TF Tag Repository + - how: shell + script: sed -i -n '/^priority=/!p;$apriority=5' /etc/yum.repos.d/*:packit:packit-dev.repo diff --git a/plans/main.fmf b/plans/main.fmf new file mode 100644 index 0000000..cb7616b --- /dev/null +++ b/plans/main.fmf @@ -0,0 +1,5 @@ +discover: + how: fmf + +execute: + how: tmt diff --git a/plans/ogr-integration.fmf b/plans/ogr-integration.fmf new file mode 100644 index 0000000..3c9a013 --- /dev/null +++ b/plans/ogr-integration.fmf @@ -0,0 +1,24 @@ +discover: + how: fmf + url: https://github.com/packit/ogr + filter: tier:0 | tier:1 + +prepare: + - how: install + copr: packit/packit-dev + + # make sure the Copr repo has higher priority than TF Tag Repository + - how: shell + script: sed -i -n '/^priority=/!p;$apriority=5' /etc/yum.repos.d/*:packit:packit-dev.repo + +adjust: + - when: "how == integration" + because: "provide latest python-requre rpm when running locally" + prepare+: + - name: python3-requre rpm + how: install + directory: noarch/ + + - when: "distro == rhel-8 or distro == centos-8 or distro == centos-stream-8" + because: "ogr doesn't support EL 8" + enabled: false diff --git a/plans/packit-integration.fmf b/plans/packit-integration.fmf new file mode 100644 index 0000000..86ce194 --- /dev/null +++ b/plans/packit-integration.fmf @@ -0,0 +1,32 @@ +discover: + how: fmf + url: https://github.com/packit/packit + filter: tier:0 | tier:1 + +prepare: + - how: install + copr: packit/packit-dev + + # make sure the Copr repo has higher priority than TF Tag Repository + - how: shell + script: sed -i -n '/^priority=/!p;$apriority=5' /etc/yum.repos.d/*:packit:packit-dev.repo + +adjust: + - when: "how == integration" + because: "provide latest python-requre rpm when running locally" + prepare+: + - name: python3-requre rpm + how: install + directory: noarch/ + + - when: "distro == rhel-9 or distro == centos-9 or distro == centos-stream-9" + because: "build and deepdiff are not in EPEL 9" + prepare+: + - how: install + package: python3-pip + - how: shell + script: pip3 install build 'deepdiff < 8.0.0' # version 8.0.0 depends on numpy, avoid it + + - when: "distro == rhel-8 or distro == centos-8 or distro == centos-stream-8" + because: "packit doesn't support EL 8" + enabled: false diff --git a/plans/rpmlint.fmf b/plans/rpmlint.fmf new file mode 100644 index 0000000..cba0437 --- /dev/null +++ b/plans/rpmlint.fmf @@ -0,0 +1,14 @@ +summary: + Run linters on source code and packaging files + +prepare: + - name: packages + how: install + package: + - rpmlint + +discover: + how: shell + tests: + - name: rpmlint + test: rpmlint fedora/python-requre.spec diff --git a/plans/smoke.fmf b/plans/smoke.fmf new file mode 100644 index 0000000..810a1ea --- /dev/null +++ b/plans/smoke.fmf @@ -0,0 +1,5 @@ +summary: + Basic smoke test + +discover+: + filter: tier:0 diff --git a/tests/full.fmf b/tests/full.fmf new file mode 100644 index 0000000..eb36fdf --- /dev/null +++ b/tests/full.fmf @@ -0,0 +1,27 @@ +summary: + Unit & integration tests + +require: + - python3-flexmock + - python3-pytest + - python3-pytest-cov + + - python3-pyyaml + + - python3-httpx + - python3-requests + - python3-urllib3 + + - python3-GitPython + - python3-ogr + +component: + - requre +tier: 1 +tag: + - basic + +test: pytest-3 -v --cov=requre --cov-report=term-missing $TEST_TARGET +duration: 30m +environment: + TEST_TARGET: . diff --git a/tests/smoke.fmf b/tests/smoke.fmf new file mode 100644 index 0000000..1452f15 --- /dev/null +++ b/tests/smoke.fmf @@ -0,0 +1,11 @@ +summary: + Basic smoke test + +require: + - python3-requre + +tag: + - smoke +tier: 0 + +test: ./smoke.sh diff --git a/tests/smoke.sh b/tests/smoke.sh new file mode 100755 index 0000000..a88207f --- /dev/null +++ b/tests/smoke.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -eux + +python3 -c "import requre"