Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LecrisUT committed Aug 26, 2024
0 parents commit 9b9cb9c
Show file tree
Hide file tree
Showing 50 changed files with 1,809 additions and 0 deletions.
1 change: 1 addition & 0 deletions .changelog.d/+68c4840b.main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Initial release
Empty file added .changelog.d/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BasedOnStyle: Google
IndentWidth: 4
IncludeBlocks: Preserve
QualifierAlignment: Right
IndentPPDirectives: BeforeHash
BreakAfterAttributes: Always
AllowShortFunctionsOnASingleLine: Empty
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 added .distro/json-type.rpmlintrc
Empty file.
75 changes: 75 additions & 0 deletions .distro/json-type.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
%if 0%{?epel} == 9
# %%ctest macro does not recognize -L
%bcond_with test
%else
%bcond_without test
%endif

Name: json-type
Summary: C++ types for JSON-like datastructure
Version: 0.0.0
Release: %autorelease
License: MIT
URL: https://github.com/LecrisUT/JsonType

Source: %{url}/archive/refs/tags/v%{version}.tar.gz

BuildRequires: ninja-build
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: cmake(Catch2)


%global _description %{expand:
Minimalistic project wrapping C++ container library to provide generic
datastructure compatible with JSON, YAML, TOML.

This project provides only the Json-like type structure and manipulations.
Parsing, formatting, validation, are outside the scope of this project.
}

%description %{_description}

This package contains the runctime library.

%package devel
Summary: %{summary}
Requires: json-type%{?_isa} = %{version}-%{release}

%description devel %{_description}

This package contains the development files.


%prep
%autosetup -n JsonType-%{version}


%build
%cmake
%cmake_build


%install
%cmake_install


%check
%if %{with test}
%ctest -L "(unit|integration)"
%endif


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

%files devel
%{_libdir}/libjson_type.so
%{_includedir}/json_type.hpp
%{_libdir}/cmake/JsonType


%changelog
%autochangelog
16 changes: 16 additions & 0 deletions .distro/plans/ctest.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
summary: Test the bundled ctests

prepare:
- how: install
package:
- cmake
- rsync
- gcc-c++
- git
- cmake(Catch2)

discover+:
how: fmf
path: test
execute:
how: tmt
7 changes: 7 additions & 0 deletions .distro/plans/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
adjust+:
# Cannot use initiator: fedora-ci reliably yet
when: initiator is not defined or initiator != packit
discover+:
how: fmf
dist-git-source: true
dist-git-extract: json-type-*/
14 changes: 14 additions & 0 deletions .distro/plans/rpminspect.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plan:
import:
url: https://github.com/packit/tmt-plans
ref: main
name: /plans/rpminspect
environment:
# upstream is excluded here because it triggers "Unexpected changed source archive content"
# This happens when the released version already contains the package version:
# https://github.com/packit/tmt-plans/issues/13
RPMINSPECT_EXCLUDE: metadata,upstream
adjust:
when: distro >= fedora-41
because: Recently rpminspect fails to get the distro-tag
enabled: false
10 changes: 10 additions & 0 deletions .distro/plans/rpmlint.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prepare:
- how: shell
script: cp ./*.rpmlintrc $TMT_PLAN_DATA/
discover:
how: fmf
filter: "tag: rpmlint"
url: https://github.com/packit/tmt-plans
ref: main
execute:
how: tmt
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
17 changes: 17 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"groupName": "CI and devDependencies",
"matchManagers": ["github-actions", "pre-commit", "pep621"]
}
],
"separateMajorMinor": false,
"extends": [
"config:recommended",
":dependencyDashboard",
"schedule:weekly",
":enablePreCommit",
":semanticCommitTypeAll(chore)"
]
}
62 changes: 62 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI
run-name: >
CI (${{ github.event_name }})
${{ github.event_name == 'pull_request' && format('PR#{0}', github.event.number) || '' }}
on:
workflow_dispatch:
pull_request:
branches: [ main ]
push:
branches: [ main ]
schedule:
- cron: 0 0 * * 3

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
uses: ./.github/workflows/step_pre-commit.yaml

tests:
needs: [ pre-commit ]
uses: ./.github/workflows/step_test.yaml
with:
mask-experimental: ${{ github.event_name == 'push' }}

docs:
name: 📘 docs
needs: [ pre-commit ]
uses: ./.github/workflows/step_docs.yaml

coverage:
name: 👀 coverage
needs: [ tests ]
uses: ./.github/workflows/step_coverage.yaml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: github.event_name != 'schedule'

static-analysis:
needs: [ pre-commit ]
uses: ./.github/workflows/step_static-analysis.yaml
secrets:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
if: github.event_name != 'schedule'

pass:
name: ✅ Pass
needs: [ pre-commit, tests, coverage, docs, static-analysis ]
runs-on: ubuntu-latest
steps:
- name: Check all CI jobs
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: coverage, static-analysis
if: always()
66 changes: 66 additions & 0 deletions .github/workflows/prepare_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: 🔨 Prepare release
run-name: 🔨 Prepare release from ${{ inputs.tag || github.ref_name }}

on:
push:
branches: [ main, v.* ]
workflow_dispatch:
inputs:
tag:
required: true
type: string
description: Version tag to create

jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@v2
id: token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- id: version
name: Find version
run: |
pip install hatch
# Get verison from workflow tag or hatch version
if [[ -n "${{ inputs.tag }}" ]]; then
raw_version="${{ inputs.tag }}"
else
raw_version=$(hatch version)
fi
echo "raw_version=$raw_version" >> "$GITHUB_OUTPUT"
# Remove any dev suffixes
version=$(echo $raw_version | sed -r -e "s/([0-9\.]*).*/\1/" -e 's/.$//')
echo "version=$version" >> "$GITHUB_OUTPUT"
- id: changelog
name: Build the changelog
run: |
pip install towncrier
{
echo "content<<EOF"
towncrier build --version "${{ steps.version.outputs.version }}" --draft 2>/dev/null
echo EOF
} >> "$GITHUB_OUTPUT"
towncrier build --version "${{ steps.version.outputs.version }}" --yes
- uses: peter-evans/create-pull-request@v6
with:
title: "🚀 Release ${{ steps.version.outputs.version }}"
commit-message: "🚀 Release ${{ steps.version.outputs.version }}"
token: ${{ steps.token.outputs.token }}
add-paths: |
Changelog.md
.changelog.d/*
branch: "prepare_release/v${{ steps.version.outputs.version }}"
body: |
${{ steps.changelog.outputs.content }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 🚀 Release
run-name: 🚀 Release (${{ github.ref_name }})

on:
pull_request:
branches: [ "prepare_release/v*" ]
types: [ closed ]

jobs:
release:
name: 🚀 Create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
run: |
version=$(echo "${{ github.ref_name }}" | sed -r "s/prepare_release\/v(.*)/\1/")
echo "version=$version" >> "$GITHUB_OUTPUT"
- uses: softprops/action-gh-release@v2
with:
name: JsonType ${{ steps.version.outputs.version }}
tag_name: "v${{ steps.version.outputs.version }}"
body: |
${{ github.event.pull_request.body }}
if: github.event.pull_request.merged == true
31 changes: 31 additions & 0 deletions .github/workflows/step_coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 👀 coverage

on:
workflow_call:
secrets:
CODECOV_TOKEN:
description: Codecov token of the main repository
required: false

permissions:
contents: read

jobs:
ctest:
name: ctest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- uses: lukka/run-cmake@v10.7
with:
workflowPreset: coverage
- uses: threeal/gcovr-action@xml-out
with:
xml-out: coverage.xml
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
plugin: noop
files: coverage.xml
verbose: true
30 changes: 30 additions & 0 deletions .github/workflows/step_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 📘 docs

on:
workflow_call:

permissions:
contents: read

jobs:
sphinx:
name: Sphinx (${{ matrix.builder }})
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
strategy:
fail-fast: false
matrix:
builder: [ linkcheck, html ]
include:
# Run default html builder with warnings as error
- builder: html
args: -W
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install the project and docs dependencies
run: pip install .[docs]
- name: Run sphinx builder ${{ matrix.builder }}
run: sphinx-build -b ${{ matrix.builder }} ${{ matrix.args }} ./docs ./docs/_build
19 changes: 19 additions & 0 deletions .github/workflows/step_pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pre-commit
run-name: Run pre-commits

on:
workflow_call:

permissions:
contents: read

jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1
Loading

0 comments on commit 9b9cb9c

Please sign in to comment.