Skip to content

Commit 9a9de09

Browse files
authored
Merge pull request #1 from NuiCpp/feat/actions
Added github workflows
2 parents 40aa753 + d36ac9d commit 9a9de09

File tree

4 files changed

+148
-8
lines changed

4 files changed

+148
-8
lines changed

.github/workflows/macos.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: MacOS
2+
3+
on:
4+
push:
5+
branches: ["main", "devel"]
6+
pull_request:
7+
branches: ["main", "devel"]
8+
9+
env:
10+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11+
BUILD_TYPE: Debug
12+
13+
jobs:
14+
macos:
15+
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
16+
# You can convert this to a matrix build if you need cross-platform coverage.
17+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
18+
runs-on: macos-latest
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Install Brew Dependencies
24+
run: brew install llvm@19 git googletest
25+
26+
- name: Tool Version Dump
27+
run: |
28+
clang++ --version
29+
cmake --version
30+
ninja --version
31+
32+
- name: Configure CMake
33+
run: cmake -B ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DTRAITS_LIBRARY_ENABLE_TESTS=on -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_EXTENSIONS=off -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm@19/bin/clang++ -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm@19/bin/clang -DCMAKE_CXX_STANDARD=20
34+
env:
35+
LDFLAGS: "-L/opt/homebrew/opt/llvm@19/lib/c++ -L/opt/homebrew/opt/llvm@19/lib/unwind -lunwind"
36+
CPPFLAGS: "-I/opt/homebrew/opt/llvm@19/include -I/opt/homebrew/include"
37+
38+
- name: Build
39+
run: cmake --build ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}}
40+
41+
- name: Test
42+
working-directory: ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}}
43+
run: ./tests/traits-tests

.github/workflows/ubuntu.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Ubuntu
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- devel
8+
- 'feat/*'
9+
- 'fix/*'
10+
pull_request:
11+
branches: ["main", "devel"]
12+
13+
env:
14+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
15+
BUILD_TYPE: Release
16+
17+
jobs:
18+
compiler_matrix:
19+
runs-on: ubuntu-24.04
20+
strategy:
21+
matrix:
22+
cxx_standard: [20, 23]
23+
clang_version: ["17", "18", "19", "20"]
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: awalsh128/cache-apt-pkgs-action@latest
28+
with:
29+
packages: ninja-build libgtest-dev libgmock-dev
30+
31+
- name: Install clang
32+
run: |
33+
wget https://apt.llvm.org/llvm.sh
34+
chmod +x llvm.sh
35+
sudo ./llvm.sh ${{ matrix.clang_version }}
36+
sudo apt-get install -y clang-${{ matrix.clang_version }}
37+
38+
- name: Tool Version Dump
39+
run: |
40+
clang++ --version
41+
cmake --version
42+
ninja --version
43+
44+
- name: Symlink xlocale
45+
run: sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
46+
47+
- name: Configure CMake
48+
run: cmake -B ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DTRAITS_LIBRARY_ENABLE_TESTS=on -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_EXTENSIONS=on -DCMAKE_CXX_COMPILER=clang++-${{ matrix.clang_version }} -DCMAKE_C_COMPILER=clang-${{ matrix.clang_version }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }}
49+
env:
50+
Boost_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
51+
52+
- name: Build
53+
run: cmake --build ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}}
54+
55+
- name: Test
56+
working-directory: ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}}
57+
run: ./tests/traits-tests

.github/workflows/windows.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Windows
2+
3+
on:
4+
push:
5+
branches: ["main", "devel"]
6+
pull_request:
7+
branches: ["main", "devel"]
8+
9+
env:
10+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11+
BUILD_TYPE: Debug
12+
13+
jobs:
14+
windows-msys2:
15+
runs-on: windows-latest
16+
defaults:
17+
run:
18+
shell: msys2 {0}
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: msys2/setup-msys2@v2
23+
with:
24+
msystem: clang64
25+
release: true
26+
install: mingw-w64-clang-x86_64-clang make unzip mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-gtest
27+
28+
- name: Workspace Path Fixup
29+
run: echo "WSPACE=$(cygpath '${{github.workspace}}')" >> $GITHUB_ENV
30+
31+
- name: Configure CMake
32+
run: cmake -B ${{env.WSPACE}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DTRAITS_LIBRARY_ENABLE_TESTS=on -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_EXTENSIONS=off -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=lld -DCMAKE_CXX_STANDARD=20
33+
34+
- name: Build
35+
run: cmake --build ${{env.WSPACE}}/build/clang_${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}}
36+
37+
- name: Test
38+
working-directory: ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}}
39+
run: ./tests/traits-tests.exe

include/traits/functions.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ namespace Traits
9696
* @tparam Args
9797
*/
9898
template <typename ReturnT, typename... Args>
99-
struct FunctionTraitsImpl<ReturnT (*)(Args...)> : public FunctionTraitsCommon<ReturnT, {}, Args...>
99+
struct FunctionTraitsImpl<ReturnT (*)(Args...)>
100+
: public FunctionTraitsCommon<ReturnT, FunctionQualifiers{}, Args...>
100101
{};
101102
template <typename ReturnT, typename... Args>
102103
struct FunctionTraitsImpl<ReturnT (*)(Args...) noexcept>
103-
: public FunctionTraitsCommon<ReturnT, {.isNoexcept = true}, Args...>
104+
: public FunctionTraitsCommon<ReturnT, FunctionQualifiers{.isNoexcept = true}, Args...>
104105
{};
105106

106107
#define TRAITS_LIB_CREATE_SPECIALIZATION(QUALIFIER, QUALIFIER_OBJECT) \
@@ -160,21 +161,21 @@ namespace Traits
160161
.isNoexcept = true};
161162
}
162163

163-
TRAITS_LIB_CREATE_SPECIALIZATION(, {})
164-
TRAITS_LIB_CREATE_SPECIALIZATION(const, {.isConst = true})
165-
TRAITS_LIB_CREATE_SPECIALIZATION(volatile, {.isVolatile = true})
164+
TRAITS_LIB_CREATE_SPECIALIZATION(, FunctionQualifiers{})
165+
TRAITS_LIB_CREATE_SPECIALIZATION(const, FunctionQualifiers{.isConst = true})
166+
TRAITS_LIB_CREATE_SPECIALIZATION(volatile, FunctionQualifiers{.isVolatile = true})
166167
TRAITS_LIB_CREATE_SPECIALIZATION(const volatile, Detail::cvQualified)
167168

168-
TRAITS_LIB_CREATE_SPECIALIZATION(&, {.isReferenceQualified = true})
169+
TRAITS_LIB_CREATE_SPECIALIZATION(&, FunctionQualifiers{.isReferenceQualified = true})
169170
TRAITS_LIB_CREATE_SPECIALIZATION(const&, Detail::constRef)
170171
TRAITS_LIB_CREATE_SPECIALIZATION(volatile&, Detail::volatileRef)
171172
TRAITS_LIB_CREATE_SPECIALIZATION(const volatile&, Detail::cvRef)
172-
TRAITS_LIB_CREATE_SPECIALIZATION(&&, {.isRvalueReferenceQualified = true})
173+
TRAITS_LIB_CREATE_SPECIALIZATION(&&, FunctionQualifiers{.isRvalueReferenceQualified = true})
173174
TRAITS_LIB_CREATE_SPECIALIZATION(const&&, Detail::constRvalueRef)
174175
TRAITS_LIB_CREATE_SPECIALIZATION(volatile&&, Detail::volatileRvalueRef)
175176
TRAITS_LIB_CREATE_SPECIALIZATION(const volatile&&, Detail::cvRvalueRef)
176177

177-
TRAITS_LIB_CREATE_SPECIALIZATION(noexcept, {.isNoexcept = true})
178+
TRAITS_LIB_CREATE_SPECIALIZATION(noexcept, FunctionQualifiers{.isNoexcept = true})
178179
TRAITS_LIB_CREATE_SPECIALIZATION(const noexcept, Detail::constNoexcept)
179180
TRAITS_LIB_CREATE_SPECIALIZATION(volatile noexcept, Detail::volatileNoexcept)
180181
TRAITS_LIB_CREATE_SPECIALIZATION(const volatile noexcept, Detail::cvNoexcept)

0 commit comments

Comments
 (0)