Skip to content

Commit

Permalink
Release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nawaz1991 committed Nov 16, 2023
1 parent 024e24f commit d81ff4a
Show file tree
Hide file tree
Showing 71 changed files with 8,378 additions and 4,405 deletions.
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE /bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug report
about: Create a report to help us improve
title: '[Bug] '
labels: bug
assignees: nawaz1991

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS (include version): [e.g. CentOS 7]
- Compiler (include version): [e.g. gcc 7.3.1]
- Cmake version: [e.g. 3.12.4]

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE /feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[Feature] '
labels: enhancement
assignees: nawaz1991

---

**Describe the feature you'd like**
A clear and concise description of what you want to happen. Add any considered drawbacks.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
32 changes: 32 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## PR Checklist:

Please check if the PR fulfills these requirements

- [ ] The commit message follows [guidelines](https://www.conventionalcommits.org/en)
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)

## PR Type

What kind of change does this PR introduce?

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## What is the current behavior?

Issue Number: <!-- link to a relevant issue. -->

## What is the new behavior?

## Does this PR introduce a breaking change?

- [ ] Yes
- [ ] No

85 changes: 85 additions & 0 deletions .github/workflows/convert_json_to_rst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import json
import sys


def generate_table_from_dict(data_dict, title=None):
rst = ""
if title:
rst += f"{title}\n{'-' * len(title)}\n\n"

rst += ".. list-table::\n"
rst += " :widths: auto\n"
rst += " :header-rows: 1\n\n"

rst += " * - Key\n"
rst += " - Value\n"

for key, value in data_dict.items():
if key == 'caches':
rst += f" * - {key}\n\n"
rst += " - .. list-table::\n\n"
rst += " * - Type\n"
rst += " - Level\n"
rst += " - Size (Bytes)\n"
rst += " - Num Sharing\n"
for cache in value:
rst += f" * - {cache['type']}\n"
rst += f" - {cache['level']}\n"
rst += f" - {cache['size']}\n"
rst += f" - {cache['num_sharing']}\n"
else:
formatted_value = json.dumps(value) if isinstance(value, (list, dict)) else str(value)
rst += f" * - {key}\n"
rst += f" - {formatted_value}\n"

rst += "\n"
return rst


def generate_benchmarks_table(benchmarks):
if not benchmarks:
return ""

headers_to_remove = ['family_index', 'per_family_instance_index', 'run_name', 'run_type', 'repetitions',
'repetition_index', 'threads', 'time_unit']

rst = "Benchmarks\n----------\n\n.. list-table::\n :widths: auto\n :header-rows: 1\n\n * - Index\n"
header_added = False

for benchmark in benchmarks:
if not header_added:
for key in benchmark.keys():
if key not in headers_to_remove:
new_key = key.replace('name', 'Benchmark').replace('real_time', 'Real Time (\u00B5s)').replace(
'cpu_time', 'CPU Time (\u00B5s)').replace('iterations', 'Iterations')
rst += f" - {new_key}\n"
header_added = True

rst += " * - " + str(benchmark['family_index'] + 1) + "\n"
for key, value in benchmark.items():
if key not in headers_to_remove:
if key == 'name':
value = value.replace('OASValidatorPerf/', '').split('/min_time')[0]
elif key in ['real_time', 'cpu_time']:
value = f"{value:.3f}"
rst += f" - {value}\n"
return rst + "\n"


def generate_rst():
file_path = sys.argv[1]
with open(file_path, "r") as file:
data = json.load(file)
rst = f"Benchmark Report\n{'=' * len('Benchmark Report')}\n\n"
rst += generate_table_from_dict(data["context"], "Context")
rst += generate_benchmarks_table(data["benchmarks"])
return rst


rst_document = generate_rst()

# Save the RST to a file
with open(sys.argv[2], "w") as file:
file.write(rst_document)

print("RST document generated and saved as " + sys.argv[2] + ".")
109 changes: 109 additions & 0 deletions .github/workflows/master_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ cmake lcov gcovr
sudo apt-get install -yq doxygen
- name: Install python dependencies
run: |
pip3 install sphinx breathe exhale furo sphinxcontrib-plantuml
- name: Install google test
run: |
sudo apt-get install -y libgtest-dev
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp ./lib/libgtest*.a /usr/lib
- name: Clone libbenchmark
run: git clone https://github.com/google/benchmark.git

- name: Build libbenchmark
run: |
cd benchmark
cmake -E make_directory "build"
cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../
cmake --build "build" --config Release -- -j $(nproc)
- name: Install libbenchmark
run: sudo cmake --build "build" --target install --config Release
working-directory: ./benchmark

- name: Configure CMake
run: cmake -S . -B build -DBUILD_TESTS=ON -DBUILD_COVERAGE=ON -DBUILD_PERF=ON -DBUILD_DOCS=ON -DBUILD_EXAMPLE=ON

- name: Build oasvalidator
run: cmake --build build --target oasvalidator --config Release -j $(nproc)

- name: Build oasvalidator-unittests
run: cmake --build build --target oasvalidator-unittests --config Release -j $(nproc)

- name: Build oasvalidator-perftests
run: cmake --build build --target oasvalidator-perftests --config Release -j $(nproc)

- name: Run oasvalidator-perftests
run: build/test/perftest/oasvalidator-perftests --benchmark_format=json > build/test/perftest/benchmark.json

- name: Convert benchmark.json to benchmark.rst
run: python .github/workflows/convert_json_to_rst.py build/test/perftest/benchmark.json build/docs/benchmark.rst

- name: Build covhtml-oasvalidator
run: cmake --build build --target covhtml-oasvalidator --config Release -j $(nproc)

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'

- name: Install PlantUML
run: |
sudo apt-get update
sudo apt-get install -y plantuml
- name: Build docs
run: cmake --build build --target docs --config Release -j $(nproc)

- name: Copy covhtml-oasvalidator to docs
run: cp -r build/covhtml-oasvalidator build/docs/html

- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.MY_PAT }}
publish_dir: build/docs/html

- name: Generate Coverage Report
if: github.ref == 'refs/heads/main'
run: |
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ deps/
/*.src.rock
/cmake-build-debug
/.idea
.clang-format
.clang-lint-ignore
.clang-tidy
lint.py
/example
Loading

0 comments on commit d81ff4a

Please sign in to comment.