From 1f0eb98af501d840be122a700b1812e53b22eaed Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 9 May 2023 18:27:45 +0200 Subject: [PATCH] Initialize packit workflow Signed-off-by: Cristian Le --- .distro/.fmf/version | 1 + .distro/.gitignore | 4 ++ .distro/json-schema-validator.rpmlintrc | 0 .distro/json-schema-validator.spec | 61 +++++++++++++++++++ .distro/packit.toml | 3 + .distro/plans/main.fmf.dist-git | 4 ++ .distro/plans/rpmlint.fmf | 14 +++++ .distro/plans/smoke.fmf | 7 +++ .distro/tests/rpmlint.fmf | 13 ++++ .distro/tests/smoke.fmf | 9 +++ .packit.yaml | 79 +++++++++++++++++++++++++ 11 files changed, 195 insertions(+) create mode 100644 .distro/.fmf/version create mode 100644 .distro/.gitignore create mode 100644 .distro/json-schema-validator.rpmlintrc create mode 100644 .distro/json-schema-validator.spec create mode 100644 .distro/packit.toml create mode 100644 .distro/plans/main.fmf.dist-git create mode 100644 .distro/plans/rpmlint.fmf create mode 100644 .distro/plans/smoke.fmf create mode 100644 .distro/tests/rpmlint.fmf create mode 100644 .distro/tests/smoke.fmf create mode 100644 .packit.yaml diff --git a/.distro/.fmf/version b/.distro/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.distro/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.distro/.gitignore b/.distro/.gitignore new file mode 100644 index 0000000..d3dc37e --- /dev/null +++ b/.distro/.gitignore @@ -0,0 +1,4 @@ +/main.fmf +/plans/main.fmf +/tests/main.fmf +*.tar.gz diff --git a/.distro/json-schema-validator.rpmlintrc b/.distro/json-schema-validator.rpmlintrc new file mode 100644 index 0000000..e69de29 diff --git a/.distro/json-schema-validator.spec b/.distro/json-schema-validator.spec new file mode 100644 index 0000000..14cfe2e --- /dev/null +++ b/.distro/json-schema-validator.spec @@ -0,0 +1,61 @@ +Name: json-schema-validator +Summary: JSON schema validator for JSON for Modern C++ +Version: 0.0.0 +Release: %autorelease +License: MIT +URL: https://github.com/pboettch/json-schema-validator + +Source: https://github.com/pboettch/json-schema-validator/archive/refs/tags/v%{version}.tar.gz + +BuildRequires: ninja-build +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: json-devel + +%description +Json schema validator library for C++ projects using nlohmann/json + +%package devel +Summary: Development files for JSON schema validator +Requires: json-schema-validator%{?_isa} = %{version}-%{release} +Requires: json-devel + +%description devel +Json schema validator development files for C++ projects using nlohmann/json + + +%prep +%autosetup -n json-schema-validator-%{version} + + +%build +%cmake \ + -DJSON_VALIDATOR_SHARED_LIBS=ON \ + -DJSON_VALIDATOR_INSTALL=ON \ + -DJSON_VALIDATOR_BUILD_EXAMPLES=OFF \ + -DJSON_VALIDATOR_BUILD_TESTS=ON + +%cmake_build + + +%install +%cmake_install + + +%check +%ctest + + +%files +%doc README.md +%license LICENSE +%{_libdir}/libnlohmann_json_validator.so.* + +%files devel +%{_libdir}/libnlohmann_json_validator.so +%{_includedir}/nlohmann/json-schema.hpp +%{_libdir}/cmake/nlohmann_json_schema_validator + + +%changelog +%autochangelog diff --git a/.distro/packit.toml b/.distro/packit.toml new file mode 100644 index 0000000..40af9bf --- /dev/null +++ b/.distro/packit.toml @@ -0,0 +1,3 @@ +Filters = [ + "unknown-key", +] diff --git a/.distro/plans/main.fmf.dist-git b/.distro/plans/main.fmf.dist-git new file mode 100644 index 0000000..205079c --- /dev/null +++ b/.distro/plans/main.fmf.dist-git @@ -0,0 +1,4 @@ +discover: + how: fmf + dist-git-source: true + path: .distro diff --git a/.distro/plans/rpmlint.fmf b/.distro/plans/rpmlint.fmf new file mode 100644 index 0000000..0db484e --- /dev/null +++ b/.distro/plans/rpmlint.fmf @@ -0,0 +1,14 @@ +summary: + Perform rpmlint and rpminspect tests +prepare: + - name: Download the source rpm + how: shell + script: cd /tmp && curl -O ${PACKIT_SRPM_URL} + - name: Download rpm packages + how: shell + script: cd /tmp && dnf download ${PACKIT_COPR_RPMS} +discover+: + how: fmf + filter: "tag: rpmlint" +execute: + how: tmt diff --git a/.distro/plans/smoke.fmf b/.distro/plans/smoke.fmf new file mode 100644 index 0000000..0f486b6 --- /dev/null +++ b/.distro/plans/smoke.fmf @@ -0,0 +1,7 @@ +summary: + Basic smoke tests +discover+: + how: fmf + filter: "tag: smoke" +execute: + how: tmt diff --git a/.distro/tests/rpmlint.fmf b/.distro/tests/rpmlint.fmf new file mode 100644 index 0000000..4460da4 --- /dev/null +++ b/.distro/tests/rpmlint.fmf @@ -0,0 +1,13 @@ +# Common test variables +tag: + - rpmlint +tier: 0 +path: / + +# Define tests +/rpmlint: + summary: Rpmlint spec and rpmfiles + test: rpmlint -c packit.toml -r json-schema-validator.rpmlintrc ./*.spec /tmp/*.rpm +/rpminspect-rpms: + summary: Rpminspect the rpms + test: ls /tmp/*.rpm | xargs -L1 rpminspect-fedora -E metadata,disttag diff --git a/.distro/tests/smoke.fmf b/.distro/tests/smoke.fmf new file mode 100644 index 0000000..713ff90 --- /dev/null +++ b/.distro/tests/smoke.fmf @@ -0,0 +1,9 @@ +# Common test variables +tag: + - smoke +tier: 0 +path: / + +# Define tests +/version: + test: echo "TODO: Write a minimum working example" diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..4aab4d1 --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,79 @@ +specfile_path: .distro/json-schema-validator.spec +files_to_sync: + - src: .distro/json-schema-validator.spec + dest: json-schema-validator.spec + - .packit.yaml + - src: .distro/json-schema-validator.rpmlintrc + dest: json-schema-validator.rpmlintrc + # tmt setup + - src: .distro/.fmf/ + dest: .fmf/ + - src: .distro/plans/ + dest: plans/ + filters: + - "- .distro/plans/main.fmf.dist-git" + - "- .distro/plans/rpmlint.fmf" + - src: .distro/plans/main.fmf.dist-git + dest: plans/main.fmf +upstream_package_name: json-schema-validator +downstream_package_name: json-schema-validator +update_release: false +upstream_tag_template: v{version} + +jobs: + - job: copr_build + trigger: pull_request + owner: lecris + project: json-schema-validator + update_release: true + release_suffix: "{PACKIT_RPMSPEC_RELEASE}" + targets: + - fedora-development + - job: tests + trigger: pull_request + targets: + - fedora-development + fmf_path: .distro + - job: copr_build + trigger: commit + branch: main + owner: lecris + project: nightly + # TODO: Remove when upstream issue is resolved + # https://github.com/packit/packit/issues/1924 + additional_repos: + - copr://@scikit-build/release + targets: + - fedora-development-x86_64 + - fedora-latest-x86_64 + - fedora-development-aarch64 + - fedora-latest-aarch64 + - job: copr_build + trigger: release + owner: lecris + project: release + targets: + - fedora-development-x86_64 + - fedora-latest-x86_64 + - fedora-development-aarch64 + - fedora-latest-aarch64 + - job: tests + trigger: commit + branch: main + targets: + - fedora-development + - fedora-latest + fmf_path: .distro + - job: propose_downstream + trigger: release + dist_git_branches: + - fedora-development + - fedora-latest + - job: koji_build + trigger: commit + dist_git_branches: + - fedora-all + - job: bodhi_update + trigger: commit + dist_git_branches: + - fedora-branched