Skip to content

Commit

Permalink
ci: add tmt linting to the pre-commit (#809)
Browse files Browse the repository at this point in the history
ci: add tmt linting to the pre-commit

Reviewed-by: František Lachman <flachman@redhat.com>
  • Loading branch information
2 parents 69de9bd + c9516eb commit e6b46ee
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 16 deletions.
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,25 @@ repos:
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies:
[types-pkg_resources, types-requests, types-Deprecated]
- repo: https://github.com/teemtee/tmt.git
rev: 1.27.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, push]
- repo: https://github.com/packit/pre-commit-hooks
rev: v1.2.0
hooks:
- id: check-rebase
args:
- https://github.com/packit-service/ogr.git
# Do not run in pre-commit.ci as it requires an internet access
# to verify the rebasing
stages: [manual, push]
- repo: https://github.com/packit/requre
rev: 0.8.2
hooks:
- id: requre-purge
# Do not run in pre-commit.ci as it requires too much time
stages: [manual, push]
4 changes: 2 additions & 2 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
check:
jobs:
- pre-commit
- ogr-tests-rpm
# - ogr-tests-rpm
- ogr-tests-pip-deps
- ogr-reverse-dep-packit-tests
# - ogr-reverse-dep-packit-tests
gate:
jobs:
- pre-commit
Expand Down
19 changes: 12 additions & 7 deletions plans/full.fmf
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
summary:
Unit & integration tests.
Unit & integration tests

discover+:
filter: tier:1

prepare:
how: ansible
playbook:
- files/packit-testing-farm-prepare.yaml
execute:
script:
- make check
# 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: dnf -y config-manager --save --setopt="*:packit:packit-dev.priority=5"
5 changes: 5 additions & 0 deletions plans/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
discover:
how: fmf

execute:
how: tmt
32 changes: 32 additions & 0 deletions plans/packit-integration.fmf
Original file line number Diff line number Diff line change
@@ -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: dnf -y config-manager --save --setopt="*:packit:packit-dev.priority=5"

adjust:
- when: "how == integration"
because: "provide latest python-ogr rpm when running locally"
prepare+:
- name: python3-ogr 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

- when: "distro == rhel-8 or distro == centos-8 or distro == centos-stream-8"
because: "packit doesn't support EL 8"
enabled: false
10 changes: 7 additions & 3 deletions plans/linters.fmf → plans/rpmlint.fmf
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
summary:
Run linters on source code and packaging files

prepare:
- name: packages
how: install
package:
- rpmlint
execute:
script:
- rpmlint fedora/python-ogr.spec

discover:
how: shell
tests:
- name: rpmlint
test: rpmlint fedora/python-ogr.spec
8 changes: 4 additions & 4 deletions plans/smoke.fmf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
summary:
Basic smoke test.
execute:
script:
- python3 -c "import ogr"
Basic smoke test

discover+:
filter: tier:0
26 changes: 26 additions & 0 deletions tests/full.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
summary:
Unit & integration tests

require:
- python3-flexmock
- python3-pytest
- python3-pytest-cov
# not available on C9S, but is among the ‹pyproject.toml› deps
# - python3-crypto
- python3-deprecated
- python3-GitPython
- python3-pygithub
- python3-gitlab
- python3-pyyaml
- python3-requests
- python3-urllib3
- python3-requre

component:
- ogr
tier: 1
tag:
- basic

test: pytest-3 -v --cov=ogr --cov-report=term-missing .
duration: 30m
11 changes: 11 additions & 0 deletions tests/smoke.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
summary:
Basic smoke test

require:
- python3-ogr

tag:
- smoke
tier: 0

test: ./smoke.sh
5 changes: 5 additions & 0 deletions tests/smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -eux

python3 -c "import ogr"

0 comments on commit e6b46ee

Please sign in to comment.