Skip to content

Commit

Permalink
Add packit packaging
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT committed Nov 6, 2023
1 parent e921165 commit 7ad30c2
Show file tree
Hide file tree
Showing 15 changed files with 225 additions and 0 deletions.
1 change: 1 addition & 0 deletions .distro/.fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Empty file.
58 changes: 58 additions & 0 deletions .distro/cmake-template.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Name: cmake-template
Summary: CMake project template
Version: 0.0.0
Release: %autorelease
License: MIT
URL: https://github.com/LecrisUT/CMake-Template

Source: https://github.com/LecrisUT/CMake-Template/archive/refs/tags/v%{version}.tar.gz

BuildRequires: ninja-build
BuildRequires: cmake
BuildRequires: gcc-c++

%description
CMake project template

%package devel
Summary: Development files for cmake-template
Requires: cmake-template%{?_isa} = %{version}-%{release}

%description devel
This package contains libraries and header files for developing
applications that use cmake-template.


%prep
%autosetup -n cmake-template-%{version}


%build
%cmake \
-DTEMPLATE_SHARED_LIBS=ON \
-DTEMPLATE_TESTS=ON
%cmake_build


%install
%cmake_install


%check
%ctest


%files
%doc README.md
%license LICENSE
%{_libdir}/libtemplate.so.*

%files devel
%{_libdir}/libtemplate.so
%{_includedir}/template.h
%{_libdir}/cmake/Template
%{_libdir}/pkgconfig/template.pc


%changelog
%autochangelog
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
dist-git-extract: cmake-template-*/
8 changes: 8 additions & 0 deletions .distro/plans/package.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
summary:
Test importing package
discover+:
how: fmf
filter: "tag: package"
path: test
execute:
how: tmt
7 changes: 7 additions & 0 deletions .distro/plans/rpminspect.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plan:
import:
url: https://github.com/packit/tmt-plans
ref: main
name: /plans/rpminspect
environment:
RPMINSPECT_EXCLUDE: disttag
5 changes: 5 additions & 0 deletions .distro/plans/rpmlint.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plan:
import:
url: https://github.com/packit/tmt-plans
ref: main
name: /plans/rpmlint
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
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: hello
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/cmake-template.spec

# add or remove files that should be synced
files_to_sync:
- src: .distro/cmake-template.spec
dest: cmake-template.spec
- .packit.yaml
- src: .distro/cmake-template.rpmlintrc
dest: cmake-template.rpmlintrc
# tmt setup
- src: .distro/.fmf/
dest: .fmf/
- src: .distro/plans/
dest: plans/
filters:
- "- main.fmf.dist-git"
- src: .distro/plans/main.fmf.dist-git
dest: plans/main.fmf
- .packit.yaml

upstream_package_name: CMake-Template
downstream_package_name: cmake-template

update_release: false
upstream_tag_template: v{version}

jobs:
- job: copr_build
trigger: pull_request
owner: lecris
project: cmake-template
targets:
- fedora-all-x86_64
- fedora-all-aarch64
- epel-9-x86_64
- epel-9-aarch64
- job: tests
trigger: pull_request
targets:
- fedora-all-x86_64
- fedora-all-aarch64
- epel-9-x86_64
- epel-9-aarch64
fmf_path: .distro
- job: copr_build
trigger: commit
branch: main
owner: lecris
project: nightly
targets:
- fedora-all-x86_64
- fedora-all-aarch64
- epel-9-x86_64
- epel-9-aarch64
- job: tests
trigger: commit
branch: main
targets:
- fedora-all-x86_64
- fedora-all-aarch64
- epel-9-x86_64
- epel-9-aarch64
fmf_path: .distro
## Uncomment when released downstream
# - job: propose_downstream
# trigger: release
# dist_git_branches:
# - fedora-rawhide
# - epel-9
# - job: koji_build
# trigger: commit
# dist_git_branches:
# - fedora-all
# - epel-9
# - job: bodhi_update
# trigger: commit
# dist_git_branches:
# - fedora-branched
# - epel-9
5 changes: 5 additions & 0 deletions test/package/FetchContent/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
summary:
Test FetchContent
require+:
- git
tag+: [ FetchContent ]
3 changes: 3 additions & 0 deletions test/package/find_package/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
summary:
Test find_package
tag+: [ find_package ]
9 changes: 9 additions & 0 deletions test/package/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tag: [ cmake, package ]
require:
- cmake
- rsync
- tree
- gcc-c++
framework: beakerlib
path: /
test: ./package/test.sh
5 changes: 5 additions & 0 deletions test/package/pkg-config/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
summary:
Test pkg-config for C library
require+:
- pkgconf
tag+: [ pkg-config ]
25 changes: 25 additions & 0 deletions test/package/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# shellcheck disable=all
source /usr/share/beakerlib/beakerlib.sh || exit 1

rlJournalStart
rlPhaseStartSetup
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "rsync -rL .$TMT_TEST_NAME/ $tmp" 0 "Copy example project"
rlRun "pushd $tmp"
rlRun "tree" 0 "Show directory tree"
rlRun "set -o pipefail"
rlPhaseEnd

rlPhaseStartTest
rlRun "cmake -B ./build"
rlRun "cmake --build ./build"
rlRun "./build/main"
rlPhaseEnd

rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

0 comments on commit 7ad30c2

Please sign in to comment.