Skip to content

Commit

Permalink
Merge branch 'release/v0.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
fktn-k committed Apr 27, 2024
2 parents b44474d + 36b9c75 commit cbe7c11
Show file tree
Hide file tree
Showing 245 changed files with 5,789 additions and 8,251 deletions.
26 changes: 13 additions & 13 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
# BreakAfterAttributes: Never # since clang-format 16
BreakAfterJavaFieldAnnotations: false
# BreakArrays: true # since clang-format 16
Expand Down Expand Up @@ -100,7 +100,7 @@ IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentPPDirectives: None
# IndentRequiresClause: true # since clang-format 15
IndentWidth: 4
IndentWrappedFunctionNames: false
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/amalgamation_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ on:
- .github/workflows/amalgamation_check.yml
- include/fkYAML/**
- single_include/fkYAML/**
- scripts/*_amalgamation.*
pull_request:
paths:
- .github/workflows/amalgamation_check.yml
- include/fkYAML/**
- single_include/fkYAML/**
- scripts/*_amalgamation.*
workflow_dispatch:

concurrency:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/clang_format_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ on:
- include/**
- test/unit_test/**
- .clang-format
- scripts/run_clang_format.*
pull_request:
paths:
- .github/workflows/clang_format_check.yml
- include/**
- test/unit_test/**
- .clang-format
- scripts/run_clang_format.*
workflow_dispatch:

concurrency:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ jobs:
runs-on: windows-2019
strategy:
matrix:
arch: [ Win32, x64 ]
build_type: [ Debug, Release ]
single_header: ["ON", "OFF"]
single_header: [ "ON", "OFF" ]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -G "Visual Studio 16 2019" -A x64 -DFK_YAML_BUILD_TEST=ON -DFK_YAML_USE_SINGLE_HEADER=${{matrix.single_header}}
run: cmake -B ${{github.workspace}}/build -G "Visual Studio 16 2019" -A ${{matrix.arch}} -DFK_YAML_BUILD_TEST=ON -DFK_YAML_USE_SINGLE_HEADER=${{matrix.single_header}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j ${{env.JOBS}}
Expand All @@ -58,16 +59,17 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
arch: [ Win32, x64 ]
build_type: [ Debug, Release ]
single_header: ["ON", "OFF"]
single_header: [ "ON", "OFF" ]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -G "Visual Studio 17 2022" -A x64 -DFK_YAML_BUILD_TEST=ON -DFK_YAML_USE_SINGLE_HEADER=${{matrix.single_header}}
run: cmake -B ${{github.workspace}}/build -G "Visual Studio 17 2022" -A ${{matrix.arch}} -DFK_YAML_BUILD_TEST=ON -DFK_YAML_USE_SINGLE_HEADER=${{matrix.single_header}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j ${{env.JOBS}}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/.vs/

# documentation
/docs/mkdocs/docs/examples/
/docs/mkdocs/site/
/docs/mkdocs/venv/

Expand Down
2 changes: 1 addition & 1 deletion .reuse/templates/fkYAML.commented.jinja2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// _______ __ __ __ _____ __ __ __
/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library
/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.4
/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5
/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML
///
{% for copyright_line in copyright_lines %}
Expand Down
2 changes: 1 addition & 1 deletion .reuse/templates/fkYAML_support.jinja2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
_______ __ __ __ _____ __ __ __
| __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code)
| __| _ < \_ _/| ___ | _ | |___ version 0.3.4
| __| _ < \_ _/| ___ | _ | |___ version 0.3.5
|__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML

{% for copyright_line in copyright_lines %}
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [v0.3.5](https://github.com/fktn-k/fkYAML/releases/tag/v0.3.5) (2024-04-27)

[Full Changelog](https://github.com/fktn-k/fkYAML/compare/v0.3.4...v0.3.5)

- Fix parse error on the first node which isn't a block mapping [\#322](https://github.com/fktn-k/fkYAML/pull/322) ([fktn-k](https://github.com/fktn-k))

- Add Bash & Batch scripts to run clang-format & amalgamation [\#325](https://github.com/fktn-k/fkYAML/pull/325) ([fktn-k](https://github.com/fktn-k))
- Force LF newline codes in the amalgamated file [\#324](https://github.com/fktn-k/fkYAML/pull/324) ([fktn-k](https://github.com/fktn-k))
- Add workflows items to test Win32 builds [\#323](https://github.com/fktn-k/fkYAML/pull/323) ([fktn-k](https://github.com/fktn-k))
- Set the unit test app as the Visual Studio startup project [\#321](https://github.com/fktn-k/fkYAML/pull/321) ([fktn-k](https://github.com/fktn-k))
- Reformat source files [\#320](https://github.com/fktn-k/fkYAML/pull/320) ([fktn-k](https://github.com/fktn-k))
- Serialize container keys [\#319](https://github.com/fktn-k/fkYAML/pull/319) ([fktn-k](https://github.com/fktn-k))
- Improved UTF encoding processing [\#318](https://github.com/fktn-k/fkYAML/pull/318) ([fktn-k](https://github.com/fktn-k))
- Query the count of UTF-8 character bytes [\#317](https://github.com/fktn-k/fkYAML/pull/317) ([fktn-k](https://github.com/fktn-k))
- Use Clang-Format python distribution [\#316](https://github.com/fktn-k/fkYAML/pull/316) ([fktn-k](https://github.com/fktn-k))

## [v0.3.4](https://github.com/fktn-k/fkYAML/releases/tag/v0.3.4) (2024-04-20)

[Full Changelog](https://github.com/fktn-k/fkYAML/compare/v0.3.3...v0.3.4)
Expand Down
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.8)

project(
fkYAML
VERSION 0.3.4
VERSION 0.3.5
LANGUAGES CXX)

#############################################################
Expand Down Expand Up @@ -140,6 +140,13 @@ if(FK_YAML_BUILD_TEST OR FK_YAML_BUILD_ALL_TEST)
include(CTest)
enable_testing()
add_subdirectory(test)

# Set the unit test app project as the Visual Studio startup project
# if the target compiler is some version of Microsoft Visual C++ and
# if this project is the main project.
if(MSVC AND CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT fkYAMLUnitTest)
endif()
endif()

#######################
Expand Down
97 changes: 70 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ To make it as easy as possible for you to contribute and for me to keep an overv

Usually, all issues are tracked publicly on [GitHub](https://github.com/fktn-k/fkYAML/issues). If you want to make a private report (e.g., for a vulnerability or to attach an example that is not meant to be published), please send an email to <[email protected]>.

## Prerequisites
## Describe your request/issue

Please create a [discussion](https://github.com/fktn-k/fkYAML/discussions) or [issue](https://github.com/fktn-k/fkYAML/issues/new/choose), assuming one does not already exist, and describe your concern.
Note you need a [GitHub account](https://github.com/signup/free) for this.

## Describe your request/issue

Clearly describe the request/issue:

Please keep in mind the followings:
- If you propose a change or addition, try to give an **example** how the improved code could look like or how to use it.
- If it is a bug, please describe how to **reproduce** it. If possible, attach a complete example which demonstrates the error. Please also state what you **expected** to happen instead of the error.
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.
- If you find a bug, please describe how to **reproduce** it. If possible, attach a complete example which demonstrates the error. Please also state what you **expected** to happen instead of the error.
- If you find a compilation error, please tell us which **compiler** (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.

For questions, feature or support requests, please [open a discussion](https://github.com/fktn-k/fkYAML/discussions/new).

Expand All @@ -30,14 +27,33 @@ To make changes to the fkYAML project, you need to edit the following files:

### 1. [`include/fkYAML/**.hpp`](https://github.com/fktn-k/fkYAML/tree/develop/include/fkYAML)

These files are the sources of the fkYAML library. After making changes in those files, please run `make amalgamate` to regenerate [`single_include/fkYAML/node.hpp`](https://github.com/fktn-k/fkYAML/tree/develop/single_include/fkYAML/node.hpp) at least before making a PR. If the `make` command is unavailable on your local environment, the following commands will do the same:
These files are the sources of the fkYAML library. After making changes in those files, please run the script ([`run_amalgamation.bat`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.bat) for Windows, [`run_amalgamation.sh`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.sh) otherwise) to regenerate [`single_include/fkYAML/node.hpp`](https://github.com/fktn-k/fkYAML/tree/develop/single_include/fkYAML/node.hpp) at least before making a PR, with the following commands:

**Windows**
```batch
cd path\to\fkYAML
scripts\run_amalgamation.bat
```

**Otherwise**
```bash
$ cd path/to/fkYAML
$ python3 ./tool/amalgamation/amalgamate.py -c ./tool/amalgamation/fkYAML.json -s . --verbose=yes
cd path/to/fkYAML
scripts/run_amalgamation.sh
```

Note that the amalgamation tool assumes that your current directory is at the root of the fkYAML project.
If you just want to check if amalgamation is needed, run the script ([`run_amalgamation.bat`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.bat) for Windows, [`run_amalgamation.sh`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.sh) otherwise) with the following commands:

**Windows**
```batch
cd path\to\fkYAML
scripts\check_amalgamation.bat
```

**Otherwise**
```bash
cd path/to/fkYAML
scripts/check_amalgamation.sh
```

### 2. [`test/unit_test/*.cpp`](https://github.com/fktn-k/fkYAML/tree/develop/test/unit_test)

Expand All @@ -46,10 +62,10 @@ These files contain the [Catch2](https://github.com/catchorg/Catch2) unit tests
The unit tests can be compiled and executed with the following commands:

```bash
$ cd path/to/fkYAML
$ cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DFK_YAML_BUILD_TEST=ON [-DFK_YAML_USE_SINGLE_HEADER=ON|OFF]
$ cmake --build build --config Debug
$ ctest -C Debug --test-dir build --output-on-failure
cd path/to/fkYAML
cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DFK_YAML_BUILD_TEST=ON [-DFK_YAML_USE_SINGLE_HEADER=(ON|OFF)]
cmake --build build --config Debug
ctest -C Debug --test-dir build --output-on-failure
```

Furthermore, you can test the single-header version of fkYAML by passing `-DFK_YAML_USE_SINGLE_HEADER=ON` when you configure CMake. (disabled by default)
Expand All @@ -64,8 +80,8 @@ In such cases, please run the following commands and open a generated `index.htm
Make sure `lcov` and `genhtml` commands are available before execution.

```bash
$ cd /path/to/fkYAML
$ make html-coverage
cd /path/to/fkYAML
make html-coverage
```

##### For Windows users (help needed)
Expand All @@ -81,28 +97,55 @@ These files are the sources of the documentation from which [MkDocs](https://www
Also, you can build & check the updated documentation on your local environment by executing the following commands:

```bash
$ cd path/to/fkYAML
$ make -C docs/mkdocs serve
cd path/to/fkYAML
make -C docs/mkdocs serve
```

The commands above will automatically install all the dependencies using [Python venv](https://docs.python.org/3.10/library/venv.html) with the [`requirements.txt`](https://github.com/fktn-k/fkYAML/blob/develop/docs/mkdocs/requirements.txt) file. The generated documentation will be available by accessing http://127.0.0.1:8000/.

## Before Opening a PR
### 4. Format source files

[GitHub Actions](https://github.com/fktn-k/fkYAML/actions) will test the updated project with the following Clang tools with the specific versions listed down below once you open a PR for your changes. So, it would be more efficient to check if your changes follow the predefined rules on your local environment in advance.
[GitHub Actions](https://github.com/fktn-k/fkYAML/actions) will test the updated project with the [Clang-Format](https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormat.html) tool (14.0.0) when you push commits which include changes in the source files in either `include` or `test` directories.
So, it would be more efficient to check if your changes follow the rules defined in the [`.clang-format`](https://github.com/fktn-k/fkYAML/tree/develop/.clang-format) file on your local environment in advance.
Since the Clang-Format tool does not seem to gurantee backward compatibility and its behaviors vary from version to version, the script files ([`run_clang_format.bat`](https://github.com/fktn-k/fkYAML/scripts/run_clang_format.bat) for Windows, [`run_clang_format.sh`](https://github.com/fktn-k/fkYAML/scripts/run_clang_format.sh) otherwise) are available to avoid unnecessary confusion for that kind of reason.
The scripts uses [the Clang-Format Python distribution](https://pypi.org/project/clang-format/14.0.0/) and installs it using [the Python venv module](https://docs.python.org/3/library/venv.html) if it's not installed yet.
So, all you need to run the script is only Python 3.3 or better.
You can run it with the following commands:

| Clang Tool Name | Version |
| ------------------------------------------------------------------------------------------------- | ------- |
| [Clang-Format](https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormat.html) | 14.0.0 |
| [Clang-Tidy](https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/index.html) | 14.0.0 |
**Windows**
```batch
cd path\to\fkYAML
scripts\run_clang_format.bat
```

Those Clang tools, however, do not seem to gurantee backward compatibility and their behaviours vary from version to version. So, it is highly recommended to use the specific versions listed above to avoid unnecessary confusion.
**Otherwise**
```bash
cd path/to/fkYAML
scripts/run_clang_format.sh
```

## Note

When you open a pull request, fkYAML will automatically be built/tested with (1) various combinations of compilers and operating systems and (2) [Valgrind](https://valgrind.org/) and [Clang Sanitizers](https://clang.llvm.org/docs/index.html) to detect runtime issues (e.g., memory leaks), on [GitHub Actions](https://github.com/fktn-k/fkYAML/actions) once you open a pull request.
When you open a pull request, fkYAML will automatically be built/tested with (1) various combinations of compilers and operating systems and (2) analyzers such as [Valgrind](https://valgrind.org/) and [Clang Sanitizers](https://clang.llvm.org/docs/index.html) to detect runtime issues (e.g., memory leaks), on [GitHub Actions](https://github.com/fktn-k/fkYAML/actions) once you open a pull request.
These can result in failing builds and/or unit tests which run successfully on your local environment.
As a policy of this project, however, all the workflow checks must be passed before merging.
You can run tests with those tools with the following commands:

**Valgrind** (assuming Valgrind is already installed.)
```bash
cd path/to/fkYAML
cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DFK_YAML_BUOLD_TEST=ON -DFK_YAML_RUN_VALGRIND=ON
cmake --build build --config Debug
ctest -C Debug -T memcheck --test-dir build --output-on-failure
```

**Clang Sanitizers** (assuming some version of Clang is already installed.)
```bash
cd path/to/fkYAML
CXX=clang++ cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DFK_YAML_BUILD_TEST=ON -DFK_YAML_RUN_CLANG_SANITIZERS=ON
cmake --build build --config Debug
ctest -C Debug --test-dir build --output-on-failure
```

## Please don't

Expand Down
Loading

0 comments on commit cbe7c11

Please sign in to comment.