Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade main-check github action #12

Merged
merged 18 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b2f4190
use predefine action for formatting
NikolaDucak Aug 23, 2023
d513696
fixup! use predefine action for formatting
NikolaDucak Aug 23, 2023
e204f93
apply formatting
NikolaDucak Aug 23, 2023
44ad5d5
execute build and test using matrix strategy
NikolaDucak Aug 23, 2023
aedc1e1
fixup! execute build and test using matrix strategy
NikolaDucak Aug 23, 2023
048a4f4
fixup! fixup! execute build and test using matrix strategy
NikolaDucak Aug 23, 2023
d72c40b
fixup! fixup! fixup! execute build and test using matrix strategy
NikolaDucak Aug 23, 2023
a923034
fixup! fixup! fixup! fixup! execute build and test using matrix strategy
NikolaDucak Aug 23, 2023
ed9ae91
fixup! fixup! fixup! fixup! fixup! execute build and test using matri…
NikolaDucak Aug 23, 2023
bcec63b
fixup! fixup! fixup! fixup! fixup! fixup! execute build and test usin…
NikolaDucak Aug 23, 2023
50403d3
fixup! fixup! fixup! fixup! fixup! fixup! fixup! execute build and te…
NikolaDucak Aug 23, 2023
bd763ac
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! execute build…
NikolaDucak Aug 23, 2023
732f552
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! execut…
NikolaDucak Aug 23, 2023
5e1e2a1
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
NikolaDucak Aug 24, 2023
17aa6f4
update ftxui version
NikolaDucak Aug 24, 2023
937c8fc
fixup! update ftxui version
NikolaDucak Aug 24, 2023
795c0c9
fixup! fixup! update ftxui version
NikolaDucak Aug 24, 2023
3ef58d6
fixup! fixup! fixup! update ftxui version
NikolaDucak Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 85 additions & 16 deletions .github/workflows/main-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,99 @@ env:
BUILD_TYPE: Release

jobs:

# both tests and static analysis depend on build artifact so
# they are grouped under the same job as it's simpler than cahing
# or artifact upload/download. Rith now the tests are pretty fast
# so not much would be gained from parallel run of test & analysis
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: ['clang','msvc','gcc']
os: ['ubuntu-latest', 'windows-latest']
exclude:
- os: 'ubuntu-latest'
compiler: 'msvc'
- os: 'windows-latest'
# temporary exclude everything
# compiler: 'gcc'

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

steps:
- uses: actions/checkout@v3

- name: Cache
uses: actions/cache@v3
with:
path: |
~/vcpkg
./build/vcpkg_installed
${{ env.CONAN_USER_HOME }}
~/.cache/pip
${{ env.HOME }}/.cache/vcpkg/archives
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
${{ env.LOCALAPPDATA }}\vcpkg\archives
${{ env.APPDATA }}\vcpkg\archives
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}

- name: Prepare environment
run: sudo apt-get update && sudo apt-get install libboost-program-options-dev clang-tidy
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
ninja: true
conan: false
vcpkg: false
ccache: false
clangtidy: false
cppcheck: false
gcovr: false
opencppcoverage: false

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON
- name: Setup vcpkg and install Boost (Windows)
if: steps.cache-step.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'

run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat
./vcpkg install boost

- name: Get boost
if: matrix.os != 'windows-latest'
run: sudo apt-get update && sudo apt-get install libboost-program-options-dev

- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake

- name: Configure CMake (Windows)
if: matrix.os != 'windows-latest'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build ${{github.workspace}}/build --config Release

- name: Test
working-directory: ${{github.workspace}}/build
working-directory: ${{ github.workspace }}/build
# Exclude LocalLogRepository test as they write to the filesystem
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure -E "LocalLogRepository"


static-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Prepare environment
run: sudo apt-get update && sudo apt-get install libboost-program-options-dev clang-tidy

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=Off

- name: Build
run: cmake --build ${{github.workspace}}/build --config Release

- name: Static Analysis
if: always()
run: ln -s ./build/compile_commands.json && run-clang-tidy ./source/

code-formatting:
Expand All @@ -45,5 +111,8 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: clang-format
run: find ./source ./test -iname '*.cpp' -o -iname '*.hpp' | xargs clang-format -n -Werror --ferror-limit=1
- uses: DoozyX/[email protected]
with:
source: 'source test'
extensions: 'hpp,cpp'
clangFormatVersion: 16
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG v3.0.0
GIT_TAG v5.0.0
)
FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
Expand Down
Binary file added caps-log_0.1_arm64.snap
Binary file not shown.
4 changes: 2 additions & 2 deletions source/app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class App : public InputHandlerBase {
App(std::shared_ptr<YearViewBase> view, std::shared_ptr<LogRepositoryBase> repo,
std::shared_ptr<EditorBase> editor, bool skipFirstLine = true)
: m_displayedYear(Date::getToday().year), m_view{std::move(view)}, m_repo{std::move(repo)},
m_editor{std::move(editor)}, m_data{YearOverviewData::collect(
m_repo, date::Date::getToday().year, skipFirstLine)},
m_editor{std::move(editor)},
m_data{YearOverviewData::collect(m_repo, date::Date::getToday().year, skipFirstLine)},
m_skipFirstLine{skipFirstLine} {
m_view->setInputHandler(this);
m_view->setAvailableLogsMap(&m_data.logAvailabilityMap);
Expand Down
1 change: 1 addition & 0 deletions source/model/log_repository_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <regex>
#include <sstream>

Expand Down
8 changes: 4 additions & 4 deletions source/view/windowed_menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class WindowedMenu : public ComponentBase {
int m_selected;

public:
WindowedMenu(std::string title, std::vector<std::string> *items, Ref<MenuOption> option) {
auto menu = Menu(items, &m_selected, std::move(option));
WindowedMenu(std::string title, MenuOption option) {
auto menu = Menu(std::move(option));
auto menuRenderer = Renderer(menu, [title = std::move(title), menu = std::move(menu)]() {
if (not menu->Focused())
return window(text(title), menu->Render() | frame) | size(WIDTH, LESS_THAN, 25) |
Expand All @@ -32,8 +32,8 @@ class WindowedMenu : public ComponentBase {
}
auto &selected() { return m_selected; }

static auto make(std::string title, std::vector<std::string> *items, Ref<MenuOption> option) {
return std::make_shared<WindowedMenu>(std::move(title), items, std::move(option));
static auto make(std::string title, MenuOption option) {
return std::make_shared<WindowedMenu>(std::move(title), std::move(option));
}
};

Expand Down
32 changes: 20 additions & 12 deletions source/view/yearly_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ namespace clog::view {
YearView::YearView(const date::Date &today, bool sundayStart)
: m_screen{ScreenInteractive::Fullscreen()},
m_calendarButtons{Calendar::make(today, makeCalendarOptions(today, sundayStart))},
m_tagsMenu{makeTagsMenu()}, m_sectionsMenu{makeSectionsMenu()}, m_rootComponent{
makeFullUIComponent()} {}
m_tagsMenu{makeTagsMenu()}, m_sectionsMenu{makeSectionsMenu()},
m_rootComponent{makeFullUIComponent()} {}

void YearView::run() { m_screen.Loop(m_rootComponent); }

Expand Down Expand Up @@ -104,18 +104,26 @@ CalendarOption YearView::makeCalendarOptions(const Date &today, bool sundayStart
}

std::shared_ptr<WindowedMenu> YearView::makeTagsMenu() {
MenuOption option{.on_change = [this] {
m_handler->handleInputEvent(
{UIEvent::FOCUSED_TAG_CHANGE, std::to_string(m_tagsMenu->selected())});
}};
return WindowedMenu::make("Tags", &m_tagMenuItems, option);
MenuOption option{
.entries = &m_tagMenuItems,
.on_change =
[this] {
m_handler->handleInputEvent(
{UIEvent::FOCUSED_TAG_CHANGE, std::to_string(m_tagsMenu->selected())});
},
};
return WindowedMenu::make("Tags", option);
}

std::shared_ptr<WindowedMenu> YearView::makeSectionsMenu() {
MenuOption option = {.on_change = [this] {
m_handler->handleInputEvent(
{UIEvent::FOCUSED_SECTION_CHANGE, std::to_string(m_sectionsMenu->selected())});
}};
return WindowedMenu::make("Sections", &m_sectionMenuItems, option);
MenuOption option = {
.entries = &m_sectionMenuItems,
.on_change =
[this] {
m_handler->handleInputEvent(
{UIEvent::FOCUSED_SECTION_CHANGE, std::to_string(m_sectionsMenu->selected())});
},
};
return WindowedMenu::make("Sections", option);
}
} // namespace clog::view
Loading