From 38d5537be1e991a8b630881912682a06fdfaab79 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 19:13:18 +0800 Subject: [PATCH 01/15] update test workflows and related codes. --- .github/workflows/build-gcc.yml | 62 ++++++++++++++ .github/workflows/build-macos.yml | 61 ++++++++++++++ .github/workflows/build-mingw.yml | 74 ++++++++++++++++ .github/workflows/build.yml | 125 +++++++++------------------- .github/workflows/single-header.yml | 62 ++++++++++++++ README.md | 9 ++ include/uvcxx.h | 22 +++++ include/uvcxx/os.h | 4 +- tests/attch.cpp | 6 +- tests/bufs.cpp | 4 +- tests/callback.cpp | 4 +- tests/close_handle.cpp | 3 +- tests/move-base-1.cpp | 3 +- tests/move-base-2.cpp | 3 +- tests/move-base-3/struct.h | 3 +- tests/mutex.cpp | 6 +- tests/promise.cpp | 3 +- tests/ref.cpp | 7 +- tests/strings.cpp | 3 +- tests/tuple_value.cpp | 3 +- 20 files changed, 345 insertions(+), 122 deletions(-) create mode 100644 .github/workflows/build-gcc.yml create mode 100644 .github/workflows/build-macos.yml create mode 100644 .github/workflows/build-mingw.yml create mode 100644 .github/workflows/single-header.yml diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml new file mode 100644 index 0000000..4d3a51c --- /dev/null +++ b/.github/workflows/build-gcc.yml @@ -0,0 +1,62 @@ +name: Build Multi-GCC + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + build-gcc: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + matrix: + gcc_version: ['latest', '12', '11', '10', '9', '8', '7', '6', '5', '4.8.5'] + build_type: [Release] + + name: "In Container GCC ${{matrix.gcc_version}} ${{matrix.build_type}}" + + container: + image: gcc:${{matrix.gcc_version}} + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure + run: >- + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: >- + cmake --build ${{ steps.strings.outputs.build-output-dir }} + --config ${{ matrix.build_type }} + -- -j ${{steps.cores.outputs.count}} + + - name: Test + working-directory: ${{ steps.strings.outputs.build-output-dir }} + run: ctest --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 0000000..fd17e6d --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,61 @@ +name: Build MacOS + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + build-macos: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ${{matrix.os}} + + strategy: + matrix: + os: [ 'macos-14.5' ] + xcode: [ '15.4' ] + build_type: [ Release ] + + env: + DEVELOPER_DIR: /Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer + + name: "On ${{matrix.os}} Xcode ${{matrix.xcode}} ${{matrix.build_type}}" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure + run: >- + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: >- + cmake --build ${{ steps.strings.outputs.build-output-dir }} + --config ${{ matrix.build_type }} + -- -j ${{steps.cores.outputs.count}} + + - name: Test + working-directory: ${{ steps.strings.outputs.build-output-dir }} + run: ctest --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/.github/workflows/build-mingw.yml b/.github/workflows/build-mingw.yml new file mode 100644 index 0000000..d4cd5c8 --- /dev/null +++ b/.github/workflows/build-mingw.yml @@ -0,0 +1,74 @@ +name: Build MinGW + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + build-mingw: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ${{matrix.os}} + + defaults: + run: + shell: msys2 {0} + + strategy: + fail-fast: false + + matrix: + os: [ windows-latest ] + build_type: [ Release ] + config: + - msystem: "MINGW64" + install: >- + git mingw-w64-x86_64-cmake + mingw-w64-x86_64-gcc mingw-w64-x86_64-g++ + mingw-w64-x86_64-ninja + + name: "On ${{matrix.os}} ${{matrix.config.msystem}} ${{matrix.build_type}}" + + env: + CMAKE_GENERATOR: 'Ninja' + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: msys2/setup-msys2@v2 + with: + update: true + msystem: ${{matrix.config.msystem}} + install: ${{matrix.config.install}} + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure + run: >- + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -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 --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bccd9d0..a8d8581 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,138 +4,91 @@ name: Build on: push: - branches: [ "master" ] - tags: - - 'r*' + branches: + - master + - develop + pull_request: - branches: [ "master" ] + branches: + - master + - develop jobs: build: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + runs-on: ${{ matrix.os }} strategy: # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. fail-fast: false - # Set up a matrix to run the following 4 configurations: - # 1. - # 2. - # 3. - # 4. + # Set up a matrix to run the following 3 configurations: + # 1. + # 2. + # 3. # # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. matrix: os: [ubuntu-latest, windows-latest] - c_compiler: [gcc, clang, cl] build_type: [Release] + c_compiler: [gcc, clang, cl] include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl - os: ubuntu-latest c_compiler: gcc cpp_compiler: g++ - cmake_generator: '' - os: ubuntu-latest c_compiler: clang cpp_compiler: clang++ - cmake_generator: '' - - os: windows-latest - c_compiler: cl - cpp_compiler: cl - cmake_generator: '' + exclude: - os: windows-latest c_compiler: gcc - cpp_compiler: g++ - cmake_generator: 'MinGW Makefiles' - exclude: - os: windows-latest c_compiler: clang - os: ubuntu-latest c_compiler: cl - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Set reusable strings - # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. - id: strings - shell: bash - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - - name: Install MinGW (Windows) - if: matrix.os == 'windows-latest' && matrix.cmake_generator == 'MinGW Makefiles' - run: | - choco install mingw --force -y - echo "C:\tools\mingw64\bin" >> $GITHUB_PATH - - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - if: matrix.cmake_generator == '' - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S ${{ github.workspace }} - - - name: Configure CMake With Generator - if: matrix.cmake_generator != '' - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -G "${{ matrix.cmake_generator }}" - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S ${{ github.workspace }} - - - name: Build - # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - - - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} - # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest --build-config ${{ matrix.build_type }} - - build-gcc: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - - matrix: - gcc_version: [9, 10, 11, 12] - build_type: [Release] + name: "On ${{matrix.os}} ${{matrix.c_compiler}} ${{matrix.build_type}}" steps: - uses: actions/checkout@v4 with: submodules: recursive - - name: Set reusable strings + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings shell: bash run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - name: Install GCC ${{ matrix.gcc_version }} - run: | - sudo apt-get update - sudo apt-get install -y gcc-${{ matrix.gcc_version }} g++-${{ matrix.gcc_version }} - - - name: Configure CMake + - name: Configure + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > cmake -B ${{ steps.strings.outputs.build-output-dir }} - -DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc_version }} - -DCMAKE_C_COMPILER=gcc-${{ matrix.gcc_version }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -S ${{ github.workspace }} - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: >- + cmake --build ${{ steps.strings.outputs.build-output-dir }} + --config ${{ matrix.build_type }} + -- -j ${{steps.cores.outputs.count}} - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} - run: ctest --build-config ${{ matrix.build_type }} + # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/.github/workflows/single-header.yml b/.github/workflows/single-header.yml new file mode 100644 index 0000000..15ac7fa --- /dev/null +++ b/.github/workflows/single-header.yml @@ -0,0 +1,62 @@ +name: Single Header + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + single-header: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ${{matrix.os}} + + strategy: + fail-fast: false + + matrix: + os: [ubuntu-latest] + build_type: [Release] + + name: "Generate Single Header ${{matrix.build_type}}" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Generate single header + run: python3 scripts/merge.py include/uvcxx.h + + - name: Configure + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: >- + cmake --build ${{ steps.strings.outputs.build-output-dir }} + --config ${{ matrix.build_type }} + -- -j ${{steps.cores.outputs.count}} + + - name: Test + working-directory: ${{ steps.strings.outputs.build-output-dir }} + run: ctest --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/README.md b/README.md index c2849bb..2ba8670 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,15 @@ [![Build](https://github.com/levalup/libuvcxx/actions/workflows/build.yml/badge.svg)]( https://github.com/levalup/libuvcxx/actions/workflows/build.yml) +[![Build Multi-GCC](https://github.com/levalup/libuvcxx/actions/workflows/build-gcc.yml/badge.svg)]( + https://github.com/levalup/libuvcxx/actions/workflows/build-gcc.yml) +[![Build MacOS](https://github.com/levalup/libuvcxx/actions/workflows/build-macos.yml/badge.svg)]( + https://github.com/levalup/libuvcxx/actions/workflows/build-macos.yml) +[![Build MinGW](https://github.com/levalup/libuvcxx/actions/workflows/build-mingw.yml/badge.svg)]( + https://github.com/levalup/libuvcxx/actions/workflows/build-mingw.yml) +[![Single Header](https://github.com/levalup/libuvcxx/actions/workflows/single-header.yml/badge.svg)]( + https://github.com/levalup/libuvcxx/actions/workflows/single-header.yml) + [![Release](https://github.com/levalup/libuvcxx/actions/workflows/release.yml/badge.svg)]( https://github.com/levalup/libuvcxx/actions/workflows/release.yml) diff --git a/include/uvcxx.h b/include/uvcxx.h index 738e099..68a4c7b 100644 --- a/include/uvcxx.h +++ b/include/uvcxx.h @@ -6,6 +6,28 @@ #ifndef LIBUVCXX_UVCXX_H #define LIBUVCXX_UVCXX_H +#include "uvcxx/utils/apply.h" +#include "uvcxx/utils/assert.h" +#include "uvcxx/utils/callback.h" +#include "uvcxx/utils/defer.h" +#include "uvcxx/utils/detach.h" +#include "uvcxx/utils/pencil_box.h" +#include "uvcxx/utils/platform.h" +#include "uvcxx/utils/promise.h" +#include "uvcxx/utils/queue.h" +#include "uvcxx/utils/standard.h" +#include "uvcxx/utils/tuple.h" + +#include "uvcxx/cxx/buffer.h" +#include "uvcxx/cxx/except.h" +#include "uvcxx/cxx/ref.h" +#include "uvcxx/cxx/string.h" +#include "uvcxx/cxx/to_string.h" +#include "uvcxx/cxx/version.h" +#include "uvcxx/cxx/wrapper.h" + +#include "uvcxx/inner/base.h" + #include "uvcxx/async.h" #include "uvcxx/barrier.h" #include "uvcxx/buf.h" diff --git a/include/uvcxx/os.h b/include/uvcxx/os.h index f8e26d0..f6b8bf2 100644 --- a/include/uvcxx/os.h +++ b/include/uvcxx/os.h @@ -247,11 +247,11 @@ namespace uv { }); } - int setenv(uvcxx::string name, uvcxx::string value) { + inline int setenv(uvcxx::string name, uvcxx::string value) { UVCXX_PROXY(uv_os_setenv(name, value), "can not setenv['", name.c_str, "']='", value.c_str, "'"); } - int unsetenv(uvcxx::string name) { + inline int unsetenv(uvcxx::string name) { UVCXX_PROXY(uv_os_unsetenv(name), "can not unsetenv['", name.c_str, "']"); } diff --git a/tests/attch.cpp b/tests/attch.cpp index c190aea..06b3d6f 100644 --- a/tests/attch.cpp +++ b/tests/attch.cpp @@ -3,9 +3,7 @@ // L.eval: Let programmer get rid of only work jobs. // -#include "uvcxx/idle.h" -#include "uvcxx/cxx/to_string.h" -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" int loop_handle_count(uv::loop_t &loop) { int count = 0; @@ -90,4 +88,4 @@ int main() { uvcxx_assert(loop_handle_count(loop) == 1); return 0; -} \ No newline at end of file +} diff --git a/tests/bufs.cpp b/tests/bufs.cpp index 15d22d4..e151580 100644 --- a/tests/bufs.cpp +++ b/tests/bufs.cpp @@ -5,9 +5,7 @@ #include -#include "uvcxx/cxx/buffer.h" -#include "uvcxx/utils/assert.h" -#include "uvcxx/buf.h" +#include "uvcxx.h" void init_buffer(void *data, size_t size) { int c = 0; diff --git a/tests/callback.cpp b/tests/callback.cpp index 49609a9..3728ff6 100644 --- a/tests/callback.cpp +++ b/tests/callback.cpp @@ -9,9 +9,7 @@ #include -#include "uvcxx/utils/assert.h" -#include "uvcxx/utils/callback.h" - +#include "uvcxx.h" class Copyable { public: diff --git a/tests/close_handle.cpp b/tests/close_handle.cpp index 2ef74f0..3d1e88b 100644 --- a/tests/close_handle.cpp +++ b/tests/close_handle.cpp @@ -3,8 +3,7 @@ // L.eval: Let programmer get rid of only work jobs. // -#include "uvcxx/idle.h" -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" int main() { int v = 0; diff --git a/tests/move-base-1.cpp b/tests/move-base-1.cpp index 4041c6c..69cbc38 100644 --- a/tests/move-base-1.cpp +++ b/tests/move-base-1.cpp @@ -5,8 +5,7 @@ #include -#include "uvcxx/inner//base.h" -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" static int count = 0; static int copy = 0; diff --git a/tests/move-base-2.cpp b/tests/move-base-2.cpp index be7c3bc..4e502bc 100644 --- a/tests/move-base-2.cpp +++ b/tests/move-base-2.cpp @@ -5,8 +5,7 @@ #include -#include "uvcxx/inner/base.h" -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" static int count = 0; static int copy = 0; diff --git a/tests/move-base-3/struct.h b/tests/move-base-3/struct.h index 51a3d15..63f8866 100644 --- a/tests/move-base-3/struct.h +++ b/tests/move-base-3/struct.h @@ -8,8 +8,7 @@ #include -#include "uvcxx/inner/base.h" -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" struct V { static int count; diff --git a/tests/mutex.cpp b/tests/mutex.cpp index 5740392..03359f7 100644 --- a/tests/mutex.cpp +++ b/tests/mutex.cpp @@ -5,11 +5,7 @@ #include -#include "uvcxx/mutex.h" -#include "uvcxx/thread.h" -#include "uvcxx/utilities.h" - -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" int main() { uv::mutex_t mutex = nullptr; diff --git a/tests/promise.cpp b/tests/promise.cpp index 5a4ad3a..2a04f9e 100644 --- a/tests/promise.cpp +++ b/tests/promise.cpp @@ -7,8 +7,7 @@ #pragma warning(disable: 4702) #endif -#include "uvcxx/utils/assert.h" -#include "uvcxx/utils/promise.h" +#include "uvcxx.h" class Copyable { diff --git a/tests/ref.cpp b/tests/ref.cpp index 0bae68e..32b0029 100644 --- a/tests/ref.cpp +++ b/tests/ref.cpp @@ -3,10 +3,7 @@ // L.eval: Let programmer get rid of only work jobs. // -#include "uvcxx/idle.h" -#include "uvcxx/cxx/ref.h" -#include "uvcxx/cxx/to_string.h" -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" int main() { uv::loop_t loop; @@ -37,4 +34,4 @@ int main() { uvcxx_assert(before == 1 && after == 0 && idle_times == 0); return 0; -} \ No newline at end of file +} diff --git a/tests/strings.cpp b/tests/strings.cpp index 703d92b..cce6998 100644 --- a/tests/strings.cpp +++ b/tests/strings.cpp @@ -5,8 +5,7 @@ #include -#include "uvcxx/cxx/string.h" -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" std::string fs(uvcxx::string s) { std::cout << "|" << s.c_str << "|" << std::endl; diff --git a/tests/tuple_value.cpp b/tests/tuple_value.cpp index 164da97..59b3c7e 100644 --- a/tests/tuple_value.cpp +++ b/tests/tuple_value.cpp @@ -5,8 +5,7 @@ #include -#include "uvcxx/utils/tuple.h" -#include "uvcxx/utils/assert.h" +#include "uvcxx.h" class Moveable { public: From b37f76760eda33594b4a6edce757a3707200091f Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 19:44:57 +0800 Subject: [PATCH 02/15] fix ci failed. --- .github/workflows/build-gcc.yml | 4 ++++ .github/workflows/build-macos.yml | 4 ++-- .github/workflows/build-mingw.yml | 2 +- .github/workflows/build.yml | 1 - scripts/merge.py | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index 4d3a51c..29e4b32 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -30,6 +30,7 @@ jobs: container: image: gcc:${{matrix.gcc_version}} + options: -v /usr/local:/host_usr_local steps: - uses: actions/checkout@v4 @@ -45,6 +46,9 @@ jobs: run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + - name: CMake + run: echo "/host_usr_local/bin" >> $GITHUB_PATH + - name: Configure run: >- cmake -B ${{ steps.strings.outputs.build-output-dir }} diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index fd17e6d..2b70457 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -21,8 +21,8 @@ jobs: strategy: matrix: - os: [ 'macos-14.5' ] - xcode: [ '15.4' ] + os: [ 'macos-12' ] + xcode: [ '14.1' ] build_type: [ Release ] env: diff --git a/.github/workflows/build-mingw.yml b/.github/workflows/build-mingw.yml index d4cd5c8..5537de8 100644 --- a/.github/workflows/build-mingw.yml +++ b/.github/workflows/build-mingw.yml @@ -33,7 +33,7 @@ jobs: - msystem: "MINGW64" install: >- git mingw-w64-x86_64-cmake - mingw-w64-x86_64-gcc mingw-w64-x86_64-g++ + mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja name: "On ${{matrix.os}} ${{matrix.config.msystem}} ${{matrix.build_type}}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8d8581..979d73b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,7 +85,6 @@ jobs: run: >- cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - -- -j ${{steps.cores.outputs.count}} - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} diff --git a/scripts/merge.py b/scripts/merge.py index e1b0c2d..655dd8b 100644 --- a/scripts/merge.py +++ b/scripts/merge.py @@ -168,6 +168,7 @@ def list_header_files(): headers = ['uvcxx/utils/standard.h'] # < first header should be standard for d in dirs: files = os.listdir(os.path.join(uvcxx, d)) + files.sort() for file in files: ext = os.path.splitext(file)[-1] if ext.lower() != '.h': From 49bf3874d7015347a0b5bd5f15e01d23e9a3d8f2 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 19:53:15 +0800 Subject: [PATCH 03/15] fix ci not map workspace in container will. --- .github/workflows/build-gcc.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index 29e4b32..f004d34 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -30,10 +30,12 @@ jobs: container: image: gcc:${{matrix.gcc_version}} - options: -v /usr/local:/host_usr_local + options: >- + -v /usr/local:/host_usr_local + -v "${{ github.workspace }}":/workspace steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v1 with: submodules: recursive @@ -51,16 +53,16 @@ jobs: - name: Configure run: >- - cmake -B ${{ steps.strings.outputs.build-output-dir }} + cmake -B /workspace/build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S ${{ github.workspace }} + -S /workspace - name: Build run: >- - cmake --build ${{ steps.strings.outputs.build-output-dir }} + cmake --build /workspace/build --config ${{ matrix.build_type }} -- -j ${{steps.cores.outputs.count}} - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} + working-directory: /workspace/build run: ctest --output-on-failure --build-config ${{ matrix.build_type }} From 5cff201090163709fb0c871386ecfc87bc62adb3 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 19:55:30 +0800 Subject: [PATCH 04/15] try fix dealing \ not well. --- .github/workflows/build-mingw.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-mingw.yml b/.github/workflows/build-mingw.yml index 5537de8..c1512d4 100644 --- a/.github/workflows/build-mingw.yml +++ b/.github/workflows/build-mingw.yml @@ -60,15 +60,15 @@ jobs: - name: Configure run: >- - cmake -B ${{ steps.strings.outputs.build-output-dir }} + cmake -B "${{ steps.strings.outputs.build-output-dir }}" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S ${{ github.workspace }} + -S "${{ github.workspace }}" - name: Build run: >- - cmake --build ${{ steps.strings.outputs.build-output-dir }} + cmake --build "${{ steps.strings.outputs.build-output-dir }}" --config ${{ matrix.build_type }} - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} + working-directory: "${{ steps.strings.outputs.build-output-dir }}" run: ctest --output-on-failure --build-config ${{ matrix.build_type }} From 267d10be209c81da0d078dc08a526ecf02d34348 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 20:07:13 +0800 Subject: [PATCH 05/15] fix gcc:4.8.5 can not get cores. --- .github/workflows/build-gcc.yml | 2 ++ .github/workflows/build.yml | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index f004d34..1be7985 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -33,6 +33,7 @@ jobs: options: >- -v /usr/local:/host_usr_local -v "${{ github.workspace }}":/workspace + --workdir /workspace steps: - uses: actions/checkout@v1 @@ -41,6 +42,7 @@ jobs: - uses: friendlyanon/fetch-core-count@v1 id: cores + if: matrix.gcc_version != '4.8.5' - name: Set output id: strings diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 979d73b..bf199c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,20 +74,20 @@ jobs: # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} + cmake -B "${{ steps.strings.outputs.build-output-dir }}" -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S ${{ github.workspace }} + -S "${{ github.workspace }}" - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: >- - cmake --build ${{ steps.strings.outputs.build-output-dir }} + cmake --build "${{ steps.strings.outputs.build-output-dir }}" --config ${{ matrix.build_type }} - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} + working-directory: "${{ steps.strings.outputs.build-output-dir }}" # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --output-on-failure --build-config ${{ matrix.build_type }} From 0230cb3eda7b27c36c5e6c37ae34b0f8cb462019 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 20:25:13 +0800 Subject: [PATCH 06/15] using local workdir. down running os. --- .github/workflows/build-gcc.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index 1be7985..303c271 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -17,7 +17,7 @@ jobs: ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && ! contains(toJSON(github.event.commits.*.message), '[skip github]') - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -30,10 +30,7 @@ jobs: container: image: gcc:${{matrix.gcc_version}} - options: >- - -v /usr/local:/host_usr_local - -v "${{ github.workspace }}":/workspace - --workdir /workspace + options: -v /usr/local:/host_usr_local steps: - uses: actions/checkout@v1 @@ -55,16 +52,16 @@ jobs: - name: Configure run: >- - cmake -B /workspace/build + cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S /workspace + -S . - name: Build run: >- - cmake --build /workspace/build + cmake --build build --config ${{ matrix.build_type }} -- -j ${{steps.cores.outputs.count}} - name: Test - working-directory: /workspace/build + working-directory: build run: ctest --output-on-failure --build-config ${{ matrix.build_type }} From 50d0cace73d643025864b54d52cd6f760ae814e1 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 20:50:32 +0800 Subject: [PATCH 07/15] down os to ubuntu18.04, try to fix compile in gcc4.8.5 --- .github/workflows/build-gcc.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index 303c271..6bea492 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -17,7 +17,7 @@ jobs: ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && ! contains(toJSON(github.event.commits.*.message), '[skip github]') - runs-on: ubuntu-20.04 + runs-on: ubuntu-18.04 strategy: fail-fast: false @@ -47,8 +47,12 @@ jobs: run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - name: CMake - run: echo "/host_usr_local/bin" >> $GITHUB_PATH + - name: CMake & GCC + run: | + echo "/host_usr_local/bin" >> $GITHUB_PATH + cmake --version + gcc --version + g++ --version - name: Configure run: >- From 6cdf789b0f89ff0c3fd5ca721b5f59af3bd082c2 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 21:16:01 +0800 Subject: [PATCH 08/15] split gcc 4.8.5 to another single workflow. --- .github/workflows/build-classic.yml | 65 +++++++++++++++++++++++++++++ .github/workflows/build-gcc.yml | 5 +-- 2 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build-classic.yml diff --git a/.github/workflows/build-classic.yml b/.github/workflows/build-classic.yml new file mode 100644 index 0000000..c263d1f --- /dev/null +++ b/.github/workflows/build-classic.yml @@ -0,0 +1,65 @@ +name: Build Classic GCC 4.8.5 + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + build-classic: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ${{matrix.os}} + + strategy: + fail-fast: false + + matrix: + os: [ 'centos-7' ] + gcc_version: [ '4.8.5' ] + build_type: [ Release ] + + name: "On ${{matrix.os}} gcc-${{matrix.gcc_version}} ${{matrix.build_type}}" + + steps: + - uses: actions/checkout@v1 + with: + submodules: recursive + + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: CMake & GCC + run: | + cmake --version + gcc --version + g++ --version + + - name: Configure + run: >- + cmake -B "${{ steps.strings.outputs.build-output-dir }}" + -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 --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index 6bea492..a252297 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -17,13 +17,13 @@ jobs: ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && ! contains(toJSON(github.event.commits.*.message), '[skip github]') - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: - gcc_version: ['latest', '12', '11', '10', '9', '8', '7', '6', '5', '4.8.5'] + gcc_version: ['latest', '12', '11', '10', '9', '8', '7', '6', '5'] build_type: [Release] name: "In Container GCC ${{matrix.gcc_version}} ${{matrix.build_type}}" @@ -39,7 +39,6 @@ jobs: - uses: friendlyanon/fetch-core-count@v1 id: cores - if: matrix.gcc_version != '4.8.5' - name: Set output id: strings From 6e1b49cc5bbb1387c9b430cfe76c37c8f49ae2f6 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 21:51:50 +0800 Subject: [PATCH 09/15] download cmake in container gcc:4.8.5 classic --- .github/workflows/build-classic.yml | 36 ++++++++++++++++++----------- .github/workflows/build-gcc.yml | 10 ++++---- .github/workflows/build.yml | 6 ++--- .github/workflows/single-header.yml | 4 ++-- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-classic.yml b/.github/workflows/build-classic.yml index c263d1f..b92ccda 100644 --- a/.github/workflows/build-classic.yml +++ b/.github/workflows/build-classic.yml @@ -1,4 +1,4 @@ -name: Build Classic GCC 4.8.5 +name: Build Classic on: push: @@ -17,33 +17,43 @@ jobs: ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && ! contains(toJSON(github.event.commits.*.message), '[skip github]') - runs-on: ${{matrix.os}} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - os: [ 'centos-7' ] gcc_version: [ '4.8.5' ] + cmake_version: [ '3.29.6' ] build_type: [ Release ] - name: "On ${{matrix.os}} gcc-${{matrix.gcc_version}} ${{matrix.build_type}}" + name: "In Container GCC ${{matrix.gcc_version}} ${{matrix.build_type}}" + + container: + image: gcc:${{matrix.gcc_version}} steps: - uses: actions/checkout@v1 with: submodules: recursive - - uses: friendlyanon/fetch-core-count@v1 - id: cores - - name: Set output id: strings shell: bash run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - name: CMake & GCC + - name: Download CMake + run: >- + wget --no-check-certificate + https://github.com/Kitware/CMake/releases/download/v${{matrix.cmake_version}}/cmake-${{matrix.cmake_version}}-linux-x86_64.tar.gz + + - name: Install CMake + run: | + tar -xvf cmake-${{matrix.cmake_version}}-linux-x86_64.tar.gz + echo "`pwd`/cmake-${{matrix.cmake_version}}-Linux-x86_64/bin" >> $GITHUB_PATH + + - name: CMake & GCC Information run: | cmake --version gcc --version @@ -51,15 +61,15 @@ jobs: - name: Configure run: >- - cmake -B "${{ steps.strings.outputs.build-output-dir }}" + cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S "${{ github.workspace }}" + -S . - name: Build run: >- - cmake --build "${{ steps.strings.outputs.build-output-dir }}" + cmake --build build --config ${{ matrix.build_type }} - name: Test - working-directory: "${{ steps.strings.outputs.build-output-dir }}" - run: ctest --output-on-failure --build-config ${{ matrix.build_type }} + working-directory: build + run: ctest --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index a252297..9d1e07e 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -23,8 +23,8 @@ jobs: fail-fast: false matrix: - gcc_version: ['latest', '12', '11', '10', '9', '8', '7', '6', '5'] - build_type: [Release] + gcc_version: [ 'latest', '12', '11', '10', '9', '8', '7', '6', '5' ] + build_type: [ Release ] name: "In Container GCC ${{matrix.gcc_version}} ${{matrix.build_type}}" @@ -46,9 +46,11 @@ jobs: run: | echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - name: CMake & GCC + - name: Mount CMake + run: echo "/host_usr_local/bin" >> $GITHUB_PATH + + - name: CMake & GCC Information run: | - echo "/host_usr_local/bin" >> $GITHUB_PATH cmake --version gcc --version g++ --version diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf199c5..0907e7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,9 +32,9 @@ jobs: # # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. matrix: - os: [ubuntu-latest, windows-latest] - build_type: [Release] - c_compiler: [gcc, clang, cl] + os: [ ubuntu-latest, windows-latest ] + build_type: [ Release ] + c_compiler: [ gcc, clang, cl ] include: - os: windows-latest c_compiler: cl diff --git a/.github/workflows/single-header.yml b/.github/workflows/single-header.yml index 15ac7fa..a10dd3d 100644 --- a/.github/workflows/single-header.yml +++ b/.github/workflows/single-header.yml @@ -23,8 +23,8 @@ jobs: fail-fast: false matrix: - os: [ubuntu-latest] - build_type: [Release] + os: [ ubuntu-latest ] + build_type: [ Release ] name: "Generate Single Header ${{matrix.build_type}}" From 62ef12d6dfcaac106fe13c47a0682007e839a2cf Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 21:58:10 +0800 Subject: [PATCH 10/15] fix cmake version. --- .github/workflows/build-classic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-classic.yml b/.github/workflows/build-classic.yml index b92ccda..436b675 100644 --- a/.github/workflows/build-classic.yml +++ b/.github/workflows/build-classic.yml @@ -24,7 +24,7 @@ jobs: matrix: gcc_version: [ '4.8.5' ] - cmake_version: [ '3.29.6' ] + cmake_version: [ '3.9.6' ] build_type: [ Release ] name: "In Container GCC ${{matrix.gcc_version}} ${{matrix.build_type}}" From af9051df58e7884678e8c48348ba0acfe7e6bfab Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 22:13:26 +0800 Subject: [PATCH 11/15] add std test. --- .github/workflows/build-classic.yml | 14 +++---- .github/workflows/build-gcc-std.yml | 60 ++++++++++++++++++++++++++ .github/workflows/build-msvc-std.yml | 63 ++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build-gcc-std.yml create mode 100644 .github/workflows/build-msvc-std.yml diff --git a/.github/workflows/build-classic.yml b/.github/workflows/build-classic.yml index 436b675..90c083f 100644 --- a/.github/workflows/build-classic.yml +++ b/.github/workflows/build-classic.yml @@ -60,15 +60,15 @@ jobs: g++ --version - name: Configure - run: >- - cmake -B build - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -S . + run: | + mkdir -p build + pushd build + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSTD=11 .. + popd - name: Build - run: >- - cmake --build build - --config ${{ matrix.build_type }} + run: | + cmake --build build --config ${{ matrix.build_type }} - name: Test working-directory: build diff --git a/.github/workflows/build-gcc-std.yml b/.github/workflows/build-gcc-std.yml new file mode 100644 index 0000000..f610cf6 --- /dev/null +++ b/.github/workflows/build-gcc-std.yml @@ -0,0 +1,60 @@ +name: Build GCC-std + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + build-gcc-std: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [ ubuntu-latest ] + build_type: [ Release ] + std: [ '17', '14', '11' ] + + name: "On ${{matrix.os}} gcc -std=c++${{matrix.std}}" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure + run: > + cmake -B "${{ steps.strings.outputs.build-output-dir }}" + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S "${{ github.workspace }}" + + - name: Build + run: >- + cmake --build "${{ steps.strings.outputs.build-output-dir }}" + -DSTD=${{ matrix.std }} + --config ${{ matrix.build_type }} + + - name: Test + working-directory: "${{ steps.strings.outputs.build-output-dir }}" + run: ctest --output-on-failure --build-config ${{ matrix.build_type }} diff --git a/.github/workflows/build-msvc-std.yml b/.github/workflows/build-msvc-std.yml new file mode 100644 index 0000000..abd62de --- /dev/null +++ b/.github/workflows/build-msvc-std.yml @@ -0,0 +1,63 @@ +name: Build MSVC-std + +on: + push: + branches: + - master + - develop + + pull_request: + branches: + - master + - develop + +jobs: + build-msvc-std: + if: >- + ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && + ! contains(toJSON(github.event.commits.*.message), '[skip github]') + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [ windows-latest ] + build_type: [ Release ] + cl: [ cl ] + std: [ '17', '14', '11' ] + + name: "On ${{matrix.os}} cl -std=c++${{matrix.std}}" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: friendlyanon/fetch-core-count@v1 + id: cores + + - name: Set output + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure + run: > + cmake -B "${{ steps.strings.outputs.build-output-dir }}" + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S "${{ github.workspace }}" + + - name: Build + run: >- + cmake --build "${{ steps.strings.outputs.build-output-dir }}" + -DSTD=${{ matrix.std }} + -DCMAKE_CXX_COMPILER=${{ matrix.cl }} + -DCMAKE_C_COMPILER=${{ matrix.cl }} + --config ${{ matrix.build_type }} + + - name: Test + working-directory: "${{ steps.strings.outputs.build-output-dir }}" + run: ctest --output-on-failure --build-config ${{ matrix.build_type }} From d0331ac9c7d95598deb3d9eeda72c169ea5ac664 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 22:21:19 +0800 Subject: [PATCH 12/15] fix std ci error. remove develop branch trigger. --- .github/workflows/build-classic.yml | 6 ++---- .github/workflows/build-gcc-std.yml | 4 +--- .github/workflows/build-gcc.yml | 2 -- .github/workflows/build-macos.yml | 2 -- .github/workflows/build-mingw.yml | 2 -- .github/workflows/build-msvc-std.yml | 4 +--- .github/workflows/build.yml | 2 -- .github/workflows/single-header.yml | 2 -- 8 files changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-classic.yml b/.github/workflows/build-classic.yml index 90c083f..9bb2f38 100644 --- a/.github/workflows/build-classic.yml +++ b/.github/workflows/build-classic.yml @@ -4,12 +4,10 @@ on: push: branches: - master - - develop pull_request: branches: - master - - develop jobs: build-classic: @@ -62,9 +60,9 @@ jobs: - name: Configure run: | mkdir -p build - pushd build + cd build cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSTD=11 .. - popd + cd .. - name: Build run: | diff --git a/.github/workflows/build-gcc-std.yml b/.github/workflows/build-gcc-std.yml index f610cf6..cc8d82d 100644 --- a/.github/workflows/build-gcc-std.yml +++ b/.github/workflows/build-gcc-std.yml @@ -4,12 +4,10 @@ on: push: branches: - master - - develop pull_request: branches: - master - - develop jobs: build-gcc-std: @@ -47,12 +45,12 @@ jobs: run: > cmake -B "${{ steps.strings.outputs.build-output-dir }}" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DSTD=${{ matrix.std }} -S "${{ github.workspace }}" - name: Build run: >- cmake --build "${{ steps.strings.outputs.build-output-dir }}" - -DSTD=${{ matrix.std }} --config ${{ matrix.build_type }} - name: Test diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index 9d1e07e..44a38b1 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -4,12 +4,10 @@ on: push: branches: - master - - develop pull_request: branches: - master - - develop jobs: build-gcc: diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2b70457..d3f638e 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -4,12 +4,10 @@ on: push: branches: - master - - develop pull_request: branches: - master - - develop jobs: build-macos: diff --git a/.github/workflows/build-mingw.yml b/.github/workflows/build-mingw.yml index c1512d4..67c2715 100644 --- a/.github/workflows/build-mingw.yml +++ b/.github/workflows/build-mingw.yml @@ -4,12 +4,10 @@ on: push: branches: - master - - develop pull_request: branches: - master - - develop jobs: build-mingw: diff --git a/.github/workflows/build-msvc-std.yml b/.github/workflows/build-msvc-std.yml index abd62de..b25a0e8 100644 --- a/.github/workflows/build-msvc-std.yml +++ b/.github/workflows/build-msvc-std.yml @@ -4,12 +4,10 @@ on: push: branches: - master - - develop pull_request: branches: - master - - develop jobs: build-msvc-std: @@ -48,12 +46,12 @@ jobs: run: > cmake -B "${{ steps.strings.outputs.build-output-dir }}" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DSTD=${{ matrix.std }} -S "${{ github.workspace }}" - name: Build run: >- cmake --build "${{ steps.strings.outputs.build-output-dir }}" - -DSTD=${{ matrix.std }} -DCMAKE_CXX_COMPILER=${{ matrix.cl }} -DCMAKE_C_COMPILER=${{ matrix.cl }} --config ${{ matrix.build_type }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0907e7b..70d8dda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,12 +6,10 @@ on: push: branches: - master - - develop pull_request: branches: - master - - develop jobs: build: diff --git a/.github/workflows/single-header.yml b/.github/workflows/single-header.yml index a10dd3d..4bf83d2 100644 --- a/.github/workflows/single-header.yml +++ b/.github/workflows/single-header.yml @@ -4,12 +4,10 @@ on: push: branches: - master - - develop pull_request: branches: - master - - develop jobs: single-header: From 044050055c1ebff3c76676df56aeb21f9f47a094 Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 22:33:09 +0800 Subject: [PATCH 13/15] fix std compile failed. add check on classic gcc 4.8.5. --- .github/workflows/build-classic.yml | 9 +++++++++ .github/workflows/build-msvc-std.yml | 4 ++-- include/uvcxx/utils/apply.h | 14 ++++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-classic.yml b/.github/workflows/build-classic.yml index 9bb2f38..4d5f7e8 100644 --- a/.github/workflows/build-classic.yml +++ b/.github/workflows/build-classic.yml @@ -24,6 +24,9 @@ jobs: gcc_version: [ '4.8.5' ] cmake_version: [ '3.9.6' ] build_type: [ Release ] + include: + - gcc_version: '4.8.5' + libuv_version: '1.44.2' name: "In Container GCC ${{matrix.gcc_version}} ${{matrix.build_type}}" @@ -57,6 +60,12 @@ jobs: gcc --version g++ --version + - name: Checkout libuv + run: | + cd libuv + git checkout "v${{matrix.libuv_version}}" + cd .. + - name: Configure run: | mkdir -p build diff --git a/.github/workflows/build-msvc-std.yml b/.github/workflows/build-msvc-std.yml index b25a0e8..543ecd0 100644 --- a/.github/workflows/build-msvc-std.yml +++ b/.github/workflows/build-msvc-std.yml @@ -45,6 +45,8 @@ jobs: - name: Configure run: > cmake -B "${{ steps.strings.outputs.build-output-dir }}" + -DCMAKE_CXX_COMPILER=${{ matrix.cl }} + -DCMAKE_C_COMPILER=${{ matrix.cl }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DSTD=${{ matrix.std }} -S "${{ github.workspace }}" @@ -52,8 +54,6 @@ jobs: - name: Build run: >- cmake --build "${{ steps.strings.outputs.build-output-dir }}" - -DCMAKE_CXX_COMPILER=${{ matrix.cl }} - -DCMAKE_C_COMPILER=${{ matrix.cl }} --config ${{ matrix.build_type }} - name: Test diff --git a/include/uvcxx/utils/apply.h b/include/uvcxx/utils/apply.h index 33cd94b..60d211e 100644 --- a/include/uvcxx/utils/apply.h +++ b/include/uvcxx/utils/apply.h @@ -12,10 +12,12 @@ namespace uvcxx { #if UVCXX_STD_APPLY - template + + template inline decltype(auto) proxy_apply(F &&f, T &&t) { return std::apply(std::forward(f), std::forward(t)); } + #else namespace inner { template @@ -26,11 +28,6 @@ namespace uvcxx { public: using Ret = decltype(std::declval()(std::declval()...)); - template - Ret operator()(F &&f, T &&t) { - return apply(std::forward(f), std::forward(t)); - } - template::type = 0> Ret apply(F &&f, T &&) { return f(); @@ -130,6 +127,11 @@ namespace uvcxx { std::get<8>(std::forward(t)), std::get<9>(std::forward(t))); } + + template + Ret operator()(F &&f, T &&t) { + return this->apply(std::forward(f), std::forward(t)); + } }; } From bb0fe75a447a0f60d53a7146729b3fca91c202ce Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 22:37:37 +0800 Subject: [PATCH 14/15] fix header missing in apply for size_t. --- include/uvcxx/utils/apply.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uvcxx/utils/apply.h b/include/uvcxx/utils/apply.h index 60d211e..6f473c0 100644 --- a/include/uvcxx/utils/apply.h +++ b/include/uvcxx/utils/apply.h @@ -6,6 +6,7 @@ #ifndef LIBUVCXX_APPLY_H #define LIBUVCXX_APPLY_H +#include #include #include "standard.h" From cd7286ddf6fc914871ada043205d813bd779e24a Mon Sep 17 00:00:00 2001 From: levalup Date: Mon, 1 Jul 2024 22:49:35 +0800 Subject: [PATCH 15/15] add new build workflows' status --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2ba8670..c8466b0 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,32 @@ LICENSE) [![libuv](https://img.shields.io/badge/libuv-v1.48.0-green?logo=libuv&logoColor=green)]( https://github.com/libuv/libuv) -[![C++](https://img.shields.io/badge/C++-11-%23512BD4.svg?logo=C%2B%2B&logoColor=%23512BD4)]( - https://en.cppreference.com/w/cpp/17) [![CMake](https://img.shields.io/badge/CMake-v3.9-%23064F8C?logo=cmake&logoColor=%23064F8C)]( https://cmake.org) +[![C++](https://img.shields.io/badge/C++-11-%23512BD4.svg?logo=C%2B%2B&logoColor=%23512BD4)]( + https://en.cppreference.com/w/cpp/11) +[![C++](https://img.shields.io/badge/C++-14-%23512BD4.svg?logo=C%2B%2B&logoColor=%23512BD4)]( + https://en.cppreference.com/w/cpp/14) +[![C++](https://img.shields.io/badge/C++-17-%23512BD4.svg?logo=C%2B%2B&logoColor=%23512BD4)]( + https://en.cppreference.com/w/cpp/17) [![Build](https://github.com/levalup/libuvcxx/actions/workflows/build.yml/badge.svg)]( https://github.com/levalup/libuvcxx/actions/workflows/build.yml) +[![Build Classic](https://github.com/levalup/libuvcxx/actions/workflows/build-classic.yml/badge.svg)]( + https://github.com/levalup/libuvcxx/actions/workflows/build-classic.yml) [![Build Multi-GCC](https://github.com/levalup/libuvcxx/actions/workflows/build-gcc.yml/badge.svg)]( https://github.com/levalup/libuvcxx/actions/workflows/build-gcc.yml) +[![Build GCC-std](https://github.com/levalup/libuvcxx/actions/workflows/build-gcc-std.yml/badge.svg)]( + https://github.com/levalup/libuvcxx/actions/workflows/build-gcc-std.yml) [![Build MacOS](https://github.com/levalup/libuvcxx/actions/workflows/build-macos.yml/badge.svg)]( https://github.com/levalup/libuvcxx/actions/workflows/build-macos.yml) [![Build MinGW](https://github.com/levalup/libuvcxx/actions/workflows/build-mingw.yml/badge.svg)]( https://github.com/levalup/libuvcxx/actions/workflows/build-mingw.yml) +[![Build MSVC-std](https://github.com/levalup/libuvcxx/actions/workflows/build-msvc-std.yml/badge.svg)]( + https://github.com/levalup/libuvcxx/actions/workflows/build-msvc-std.yml) + [![Single Header](https://github.com/levalup/libuvcxx/actions/workflows/single-header.yml/badge.svg)]( https://github.com/levalup/libuvcxx/actions/workflows/single-header.yml) - [![Release](https://github.com/levalup/libuvcxx/actions/workflows/release.yml/badge.svg)]( https://github.com/levalup/libuvcxx/actions/workflows/release.yml)