Skip to content

Commit

Permalink
Version 1.9.0 (#7)
Browse files Browse the repository at this point in the history
feat: new design and cleaner output
feat: CMake build
fix: Cleaner code
fix: Cleaner documentation
  • Loading branch information
martin-olivier authored Jan 29, 2022
1 parent 55de0d4 commit a68cc72
Show file tree
Hide file tree
Showing 30 changed files with 731 additions and 543 deletions.
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

## [BUG] [Subject of the issue]

### Description

Describe your issue in as much detail as possible here.

### Your environment

* OS and version
* branch that causes this issue

### Steps to reproduce

* Tell us how to reproduce this issue <br />
* Where the issue is, if you know <br />
* Which commands triggered the issue, if any

### Expected behaviour

Tell us what should happen

### Actual behaviour

Tell us what happens instead

### Logs

Please paste any logs here that demonstrate the issue, if they exist

### Proposed solution

If you have an idea of how to fix this issue, please write it down here, so we can begin discussing it
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Feature report
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

## [FEATURES] [Subject of the issue]

### Description

Describe your issue in as much detail as possible here.

### Your environment

* OS and version
* branch that causes this issue

### Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

### Describe the solution you'd like

A clear and concise description of what you want to happen.

### Expected behaviour

Tell us what should happen

### Actual behaviour

Tell us what happens instead

### Logs

Please paste any logs here that demonstrate the issue, if they exist

### Additional context

Add any other context or screenshots about the feature request here.
Binary file modified .github/example_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/example_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Description

Please provide a detailed description of what was done in this PR.

# Changes include

- [ ] Bugfix (non-breaking change that solves an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (change that is not backwards-compatible and/or changes current functionality)

# Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it.

# Checklist

- [ ] I have assigned this PR to myself
- [ ] I have added at least 1 reviewer
- [ ] I have tested this code
- [ ] I have added sufficient documentation in the code

# Additional comments

Please post additional comments in this section if you have them, otherwise delete it.
32 changes: 32 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on: [push]

defaults:
run:
shell: bash

jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Build Project
run: make

- name: Build Unit Tests
run: make tests

- name: Run Unit Tests
run: ./unit_tests

- name: Cleanup
run: make fclean
26 changes: 0 additions & 26 deletions .github/workflows/build.yml

This file was deleted.

19 changes: 16 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
# Editor files and folders
# Editor Files and Folders

.idea/
.vscode/
*.DS_Store
.DS_Store
*~
\#*#

# Binary files
# Build Files and Binaries

*.log
*.o
*.so
*.dll
*.dylib
cmake-build-*/
*build/
*build_tests/
IO_Tester
unit_tests

# Documentation Generation Files

doc/latex/
doc/html/
69 changes: 69 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
cmake_minimum_required(VERSION 3.17)

project(IO_Tester)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR})

option(UNIT_TESTS "When sets to ON, build the unit tests" OFF)

if(UNIT_TESTS)
set(BIN unit_tests)
else()
set(BIN IO_Tester)
endif()

if(UNIT_TESTS)
find_package(googletest QUIET)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
endif()

if(UNIX)
add_compile_options(-Wall -Wextra -Weffc++)
elseif(WIN32)
add_compile_options(/W4)
endif()

set(MAIN src/main.cpp)

set(SOURCES
src/io_tester.cpp
src/tools.cpp
src/parsing.cpp
src/test.cpp
src/diff.cpp
src/updater.cpp
)

set(TEST_SOURCES
tests/parser.cpp
)

if(UNIT_TESTS)
add_executable(${BIN}
${SOURCES}
${TEST_SOURCES}
)
enable_testing()
include(GoogleTest)
gtest_discover_tests(${BIN})
target_link_libraries(${BIN} PRIVATE gtest_main)
else()
add_executable(${BIN}
${MAIN}
${SOURCES}
)
endif()

target_link_libraries(${BIN} PRIVATE pthread)

target_include_directories(${BIN} PRIVATE include)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Martin Olivier
Copyright (c) 2022 Martin Olivier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
57 changes: 14 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
MAKEFLAGS = --no-print-directory

CXX ?= g++

RM ?= rm -f

CXXFLAGS = -std=c++17 -Wall -Wextra -Weffc++

CPPFLAGS = -iquote include

SRC += src/Utils.cpp
SRC += src/IO_Tester.cpp
SRC += src/Parsing.cpp
SRC += src/Test.cpp
SRC += src/Diff.cpp
SRC += src/Updater.cpp

OBJ = $(SRC:.cpp=.o)

NAME = IO_Tester

ifneq (,$(findstring xterm,${TERM}))
GREEN := $(shell tput -Txterm setaf 2)
RED := $(shell tput -Txterm setaf 1)
Expand All @@ -29,36 +8,28 @@ RED := ""
RESET := ""
endif

%.o: %.cpp
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< && \
(echo "${GREEN}[OK]${RESET}" $<) || \
(echo "${RED}[BUILD ERROR]${RESET}" $<; false)

ifdef DEBUG
CXXFLAGS += -ggdb3
endif

all: $(NAME)
all:
cmake . -B build/ -DCMAKE_BUILD_TYPE=Debug
cmake --build build/

$(NAME): $(OBJ)
@$(CXX) -o $(NAME) $(OBJ) -lpthread
tests:
cmake . -B build_tests/ -DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTS=ON
cmake --build build_tests/

install: all
@cp $(NAME) /usr/local/bin
@echo "${GREEN}[SUCCESS]${RESET} Install : IO_Tester => /usr/local/bin"
@cp IO_Tester /usr/local/bin
@echo "${GREEN}[SUCCESS]${RESET} IO_Tester has been installed at /usr/local/bin"

uninstall:
@rm /usr/local/bin/IO_Tester
@echo "${GREEN}[SUCCESS]${RESET} Uninstall : IO_Tester"
@echo "${GREEN}[SUCCESS]${RESET} IO_Tester has been uninstalled"

clean:
@for f in $(OBJ); do if [ -f $$f ]; then echo "${RED}[RM]${RESET}" $$f; fi; done;
@$(RM) $(OBJ)
@rm -rf build
@rm -rf build_tests

fclean: clean
@if [ -f $(NAME) ]; then echo "${RED}[RM]${RESET}" $(NAME); fi;
@$(RM) $(NAME)

re: fclean all
@rm -rf IO_Tester
@rm -rf unit_tests

.PHONY: all clean fclean re
.PHONY: all tests clean fclean install uninstall
Loading

0 comments on commit a68cc72

Please sign in to comment.