Skip to content

Commit

Permalink
Add CI & fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dantti committed Dec 29, 2023
1 parent fe57d2c commit 452d06d
Show file tree
Hide file tree
Showing 51 changed files with 547 additions and 383 deletions.
97 changes: 97 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# .clang-format for Cutelyst projects 2023-09-15
# Tries to be close to Qt coding style
# but meh for ASql lambdas which LambdaBodyIndentation ins't enough
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AllowShortEnumsOnASingleLine: true
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterEnum: false
AfterFunction: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: true
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: '4'
ContinuationIndentWidth: '4'
ColumnLimit: 100
Cpp11BracedListStyle: true
FixNamespaceComments: true
ForEachMacros:
- forever # avoids { wrapped to next line
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<Q.*'
Priority: 200
IncludeBlocks: Regroup
IndentAccessModifiers: false
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWidth: '4'
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: OuterScope
NamespaceIndentation: None
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
WhitespaceSensitiveMacros:
- C_ATTR
UseTab: Never

---
Language: Json
BasedOnStyle: llvm

...
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest

build_type:
- Debug

config:
- qt_version: "5.15"
- qt_version: "6.6.0"

steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.config.qt_version }}
cache: true

- name: Install ninja-build tool (must be after Qt due PATH changes)
uses: turtlesec-no/get-ninja@main

- name: Make sure MSVC is found when Ninja generator is in use
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive

- name: Configure project
run: >
cmake -S . -B ./build -G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DENABLE_MAINTAINER_CFLAGS=${{ matrix.build_type == 'Debug' }}
- name: Build project
run: cmake --build ./build
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: ^(cmake/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.4
hooks:
- id: clang-format
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include(GNUInstallDirs)
if (NOT DEFINED QT_VERSION_MAJOR)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Network REQUIRED)
endif ()
find_package(Qt${QT_VERSION_MAJOR} 5.5.0 COMPONENTS Core Network REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} 5.15.0 COMPONENTS Core Network REQUIRED)

set(CMAKE_AUTOMOC ON)

Expand All @@ -22,7 +22,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)

option(BUILD_SHARED_LIBS "Build in shared lib mode" ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down Expand Up @@ -52,7 +52,7 @@ option(BUILD_DEMOS "Build the demos" ON)
#
# Custom C flags
#
if (ENABLE_MAINTAINER_CFLAGS)
if (ENABLE_MAINTAINER_CFLAGS AND NOT MSVC)
set (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Wformat -Winit-self")
add_definitions(${MAINTAINER_CFLAGS}
-DQT_DEPRECATED_WARNINGS
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SimpleMail [![Build Status](https://travis-ci.org/cutelyst/simple-mail.svg?branch=master)](https://travis-ci.org/cutelyst/simple-mail)
=============================================

The SimpleMail is small library writen for Qt 5 or 6 (C++11) that allows applications to send complex emails (plain text, html, attachments, inline files, etc.) using the Simple Mail Transfer Protocol (SMTP).
The SimpleMail is small library writen for Qt 5 or 6 (C++14) that allows applications to send complex emails (plain text, html, attachments, inline files, etc.) using the Simple Mail Transfer Protocol (SMTP).

## Features:

Expand Down
2 changes: 1 addition & 1 deletion demos/async1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ add_executable(async1

target_link_libraries(async1
SimpleMail2Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Core
Qt::Core
)
9 changes: 6 additions & 3 deletions demos/async1/async1.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <QCoreApplication>
#include "../../src/SimpleMail"

#include <QCoreApplication>
#include <QDebug>

int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
Expand All @@ -19,7 +21,8 @@ int main(int argc, char *argv[])

// Now we create a MimeMessage object. This will be the email.
SimpleMail::MimeMessage message;
message.setSender(SimpleMail::EmailAddress(QLatin1String("your_email_address@gmail.com"), QLatin1String("Your Name")));
message.setSender(SimpleMail::EmailAddress(QLatin1String("your_email_address@gmail.com"),
QLatin1String("Your Name")));
message.addTo(SimpleMail::EmailAddress(QLatin1String("Recipient's Name <recipient@host.com>")));
message.setSubject(QLatin1String("Testing Subject"));

Expand All @@ -37,7 +40,7 @@ int main(int argc, char *argv[])
SimpleMail::ServerReply *reply = server->sendMail(message);
QObject::connect(reply, &SimpleMail::ServerReply::finished, [reply] {
qDebug() << "ServerReply finished" << reply->error() << reply->responseText();
reply->deleteLater();// Don't forget to delete it
reply->deleteLater(); // Don't forget to delete it

qApp->quit();
});
Expand Down
4 changes: 2 additions & 2 deletions demos/demo1/demo1.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QtCore>

#include "../../src/SimpleMail"

#include <QtCore>

using namespace SimpleMail;

int main(int argc, char *argv[])
Expand Down
4 changes: 2 additions & 2 deletions demos/demo2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ add_executable(demo2

target_link_libraries(demo2
SimpleMail2Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
Qt::Core
Qt::Widgets
)
7 changes: 3 additions & 4 deletions demos/demo2/demo2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
See the LICENSE file for more details.
*/

#include <QtWidgets/QApplication>

#include "sendemail.h"
#include "../../src/SimpleMail"
#include "sendemail.h"

#include <iostream>

#include <QtWidgets/QApplication>

using namespace std;

int main(int argc, char *argv[])
Expand All @@ -42,4 +42,3 @@ int main(int argc, char *argv[])

a.exec();
}

Loading

0 comments on commit 452d06d

Please sign in to comment.