Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .distro/.fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
4 changes: 4 additions & 0 deletions .distro/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/main.fmf
/plans/main.fmf
/tests/main.fmf
*.tar.gz
Empty file.
61 changes: 61 additions & 0 deletions .distro/json-schema-validator.spec
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .distro/packit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Filters = [
"unknown-key",
]
12 changes: 12 additions & 0 deletions .distro/plans/import.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
summary:
Basic importing tests
prepare+:
- name: Include minimum fetching packages
how: install
package:
- git
discover+:
how: fmf
filter: "tag: import"
execute:
how: tmt
4 changes: 4 additions & 0 deletions .distro/plans/main.fmf.dist-git
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
discover:
how: fmf
dist-git-source: true
path: .distro
14 changes: 14 additions & 0 deletions .distro/plans/rpmlint.fmf
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .distro/plans/smoke.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
summary:
Basic smoke tests
discover+:
how: fmf
filter: "tag: smoke"
execute:
how: tmt
15 changes: 15 additions & 0 deletions .distro/tests/import/FetchContent/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This is a simple project that tests using cmake to load the installed libraries
cmake_minimum_required(VERSION 3.14)

project(test_fetch_content LANGUAGES CXX)


FetchContent_Declare(nlohmann_json_schema_validator
GIT_REPOSITORY https://github.com/pboettch/json-schema-validator
GIT_TAG main
)
FetchContent_MakeAvailable(nlohmann_json_schema_validator)

if (NOT TARGET nlohmann_json_schema_validator::validator)
message(FATAL_ERROR "Missing target nlohmann_json_schema_validator::validator")
endif ()
11 changes: 11 additions & 0 deletions .distro/tests/import/find_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is a simple project that tests using cmake to load the installed libraries
cmake_minimum_required(VERSION 3.14)

project(test_find_package LANGUAGES CXX)

set(CMAKE_FIND_DEBUG_MODE ON)
find_package(nlohmann_json_schema_validator REQUIRED)

if (NOT TARGET nlohmann_json_schema_validator::validator)
message(FATAL_ERROR "Missing target nlohmann_json_schema_validator::validator")
endif ()
11 changes: 11 additions & 0 deletions .distro/tests/import/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Common test variables
tag:
- import
tier: 0
path: /tests/import

# Define tests
/find_package:
test: ./test_find_package.sh
/FetchContent:
test: ./test_FetchContent.sh
4 changes: 4 additions & 0 deletions .distro/tests/import/test_FetchContent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -eux

tmp_dir=$(mktemp -d)
cmake -S ./FetchContent -B ${tmp_dir}
4 changes: 4 additions & 0 deletions .distro/tests/import/test_find_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -eux

tmp_dir=$(mktemp -d)
cmake -S ./find_package -B ${tmp_dir}
13 changes: 13 additions & 0 deletions .distro/tests/rpmlint.fmf
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions .distro/tests/smoke.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Common test variables
tag:
- smoke
tier: 0
path: /

# Define tests
/version:
test: echo "TODO: Write a minimum working example"
79 changes: 79 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -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