Skip to content

Commit

Permalink
Merge pull request #8 from levalup/workflows
Browse files Browse the repository at this point in the history
add gcc multi version test.
levalup authored Jun 19, 2024
2 parents ec0807c + 6948267 commit 2718660
Showing 4 changed files with 61 additions and 4 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build-gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# build witch multi version gcc to test gcc and C++ standard compatibility

name: Build in GCC

on:
push:
branches: [ "master" ]
tags:
- 'r*'
pull_request:
branches: [ "master" ]

jobs:
build-gcc:
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
gcc_version: [9, 10, 11, 12]
build_type: [Release]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Install GCC ${{ matrix.gcc_version }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-${{ matrix.gcc_version }} g++-${{ matrix.gcc_version }}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc_version }} 60 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc_version }}
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc_version }}
-DCMAKE_C_COMPILER=gcc-${{ matrix.gcc_version }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ matrix.build_type }}
6 changes: 4 additions & 2 deletions include/uvcxx/cxx/except.h
Original file line number Diff line number Diff line change
@@ -32,11 +32,13 @@ namespace uvcxx {
explicit errcode(int errcode, const Args &...args)
: supper(Message(errcode, args...)), m_errcode(errcode) {}

template<typename I, typename=typename std::enable_if_t<std::is_convertible_v<int, I>>>
template<typename I, typename=typename std::enable_if_t<
!std::is_same_v<int, I> && std::is_convertible_v<int, I>>>
explicit errcode(I errcode)
: self(int(errcode)) {}

template<typename I, typename ...Args, typename=typename std::enable_if_t<std::is_convertible_v<int, I>>>
template<typename I, typename ...Args, typename=typename std::enable_if_t<
!std::is_same_v<int, I> && std::is_convertible_v<int, I>>>
explicit errcode(I errcode, const Args &...args)
: self(int(errcode), args...) {}

2 changes: 1 addition & 1 deletion include/uvcxx/handle.h
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ namespace uv {
});
}

[[nodiscard("use close(nullptr) instead")]]
[[nodiscard]]
uvcxx::promise<> close() {
return close_for_promise([&](void (*cb)(raw_t *)) {
uv_close(*this, cb);
2 changes: 1 addition & 1 deletion include/uvcxx/tcp.h
Original file line number Diff line number Diff line change
@@ -123,7 +123,7 @@ namespace uv {
});
}

[[nodiscard("use close_reset(nullptr) instead")]]
[[nodiscard]]
uvcxx::promise<> close_reset() {
return close_for_promise([&](void (*cb)(uv_handle_t *)) {
uv_tcp_close_reset(*this, cb);

0 comments on commit 2718660

Please sign in to comment.