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

Add CI #3

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

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

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
build_type:
- Debug
config:
- qt_version: "6.4.2"

steps:
- name: Install Qt with options and default aqtversion
uses: jurplel/install-qt-action@v4
with:
aqtversion: null # use whatever the default is
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' }}
-DBUILD_SHARED_LIBS=${{ matrix.build_type == 'Debug' }}

- name: Build project
run: cmake --build ./build

- name: Run tests
id: ctest
if: ${{ matrix.build_type == 'Debug' }}
run: ctest --test-dir ./build -C ${{ matrix.build_type }} --output-on-failure

- name: Read tests log when it fails
uses: andstor/file-reader-action@v1
if: ${{ steps.ctest.conclusion == 'failure' }}
with:
path: "./build/Testing/Temporary/LastTest.log"
46 changes: 46 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI Nightly

on:
workflow_dispatch:

schedule:
- cron: '0 3 * * *'

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

config:
- name: clang-tidy
cmake_arg: '-DCMAKE_CXX_CLANG_TIDY=clang-tidy'
qt_version: "6.8"

- name: clazy
cmake_arg: '-DCMAKE_CXX_COMPILER=clazy'
qt_version: "6.8"

steps:
- name: Install Qt ${{ matrix.config.qt_version }} with options and default aqtversion
uses: jurplel/install-qt-action@v4
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

- uses: actions/checkout@v4

- name: Configure project
run: >
cmake -S . -B ./build -G Ninja ${{ matrix.config.cmake_arg }}
-DCMAKE_BUILD_TYPE=Debug
--warn-uninitialized -Werror=dev

- name: Build Project
run: cmake --build ./build
35 changes: 29 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,34 @@
#
# Custom C flags
#
if (ENABLE_MAINTAINER_CFLAGS)
set (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Wformat -Winit-self")
add_definitions(${MAINTAINER_CFLAGS}
-DQT_DEPRECATED_WARNINGS
)
endif ()
macro(set_compiler_flags targetName)
if(ENABLE_MAINTAINER_CFLAGS)
target_compile_definitions(${targetName} PRIVATE QT_DEPRECATED_WARNINGS)

if(NOT MSVC)
target_compile_options(${targetName} PRIVATE
-Wall
-Wextra
-Wcast-align
-Wno-uninitialized
-Wempty-body
-Wformat-security
-Wformat
-Winit-self
-Wunused-variable
)
endif()

if(APPLE)
target_compile_options(${targetName} PRIVATE -Wweak-vtables)
endif()
endif()

# Enable -Werror
if(NOT MSVC OR IS_CLANG_BUILD) # clang-cl accepts these too
target_compile_options(${targetName} PRIVATE -Werror -Wundef -Wno-error=deprecated-declarations)
endif()
endmacro()

add_definitions(
-DQT_NO_KEYWORDS
Expand Down Expand Up @@ -53,6 +75,7 @@ add_library(${target}
${firebase_admin_HEADERS}
${firebase_admin_HEADERS_PRIVATE}
)
set_compiler_flags(${target})

#Add an alias so that library can be used inside the build tree, e.g. when testing
add_library(FirebaseAdminQt::Core ALIAS ${target})
Expand Down
2 changes: 1 addition & 1 deletion src/firebaseadminexports.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <QtCore/QtGlobal>

#if defined(FirebaseAdminQt5_EXPORTS)
#if defined(FirebaseAdminQt6_EXPORTS)
#define FIREBASE_ADMIN_QT_EXPORT Q_DECL_EXPORT
#else
#define FIREBASE_ADMIN_QT_EXPORT Q_DECL_IMPORT
Expand Down
Loading