diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 1b62c43..cbe1efe 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -4,15 +4,40 @@ on: [push, pull_request] jobs: test: - name: Compile + name: Compile (${{ matrix.sys }}) runs-on: windows-latest + strategy: + matrix: + include: + - { sys: mingw64, env: x86_64 } + - { sys: mingw32, env: i686 } + - { sys: ucrt64, env: ucrt-x86_64 } + - { sys: clang64, env: clang-x86_64 } + defaults: + run: + shell: msys2 {0} steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: msys2/setup-msys2@v2 with: update: true - msystem: mingw64 - install: mingw-w64-x86_64-llvm + cache: true + msystem: ${{ matrix.sys }} + install: >- + mingw-w64-${{ matrix.env }}-toolchain + mingw-w64-${{ matrix.env }}-clang + mingw-w64-${{ matrix.env }}-make + make + + - name: Add environment variables + run: | + echo "export PATH=/${{ matrix.sys }}/bin:$PATH" >> $GITHUB_ENV + echo "export CC=clang" >> $GITHUB_ENV + echo "export CXX=clang++" >> $GITHUB_ENV + - name: Compile source code run: | echo "::group::Clang++ version" @@ -21,3 +46,13 @@ jobs: echo "::group::Compiling" make echo "::endgroup::" + + - name: Export artifacts + uses: actions/upload-artifact@v2 + with: + name: build-artifacts-${{ matrix.env }} + path: | + ./transf_server.exe + ./transf_client.exe + if-no-files-found: warn + retention-days: 30 diff --git a/include/network.h b/include/network.h index 9f6f6ba..91cbbaf 100644 --- a/include/network.h +++ b/include/network.h @@ -12,6 +12,7 @@ #include #include #include +#include typedef uint8_t ip_version; typedef int ip_family; @@ -176,7 +177,7 @@ class BasicSocket { class SocketPeer : public BasicSocket { protected: BasicSocket* m_p_bsock_from; - mutable std::list m_pCloseHandlers; + mutable std::list m_pCloseHandlers; public: SocketPeer() = default; @@ -241,9 +242,9 @@ class SocketClient : public BasicSocket { class SocketServer : public BasicSocket { protected: std::map m_clients; // TODO: unused - mutable std::list m_pStreamHandlers; - mutable std::list m_pMessageHandlers; - mutable std::list m_pCloseHandlers; + mutable std::list m_pStreamHandlers; + mutable std::list m_pMessageHandlers; + mutable std::list m_pCloseHandlers; int m_max_clients = SOMAXCONN; mutable bool m_serving = false; mutable std::vector m_threads; diff --git a/src/ansi.tpp b/src/ansi.tpp index d3668d3..d19567b 100644 --- a/src/ansi.tpp +++ b/src/ansi.tpp @@ -26,6 +26,7 @@ //===----------------------------------------------------------------------===// */ +#include #include #include diff --git a/transf_client.cpp b/transf_client.cpp index cf6f4fc..c3cca11 100644 --- a/transf_client.cpp +++ b/transf_client.cpp @@ -114,13 +114,13 @@ int send_file(SocketClient& remote, const std::string& fp, char* buf, int buf_si rate, "%)", ansi::reset); } - auto print_fail = [&fp, &ANSI_PREV_LINE, &IS_DEBUG]() { + auto print_fail = [&fp, &IS_DEBUG]() { logger.print(IS_DEBUG ? "" : ansi::clear_line + ansi::cursor_prev_line(1) + ansi::cursor_pos_x(fp.size() + 6), ansi::rgb_fg(139, 0, 0), " (Failed)", ansi::reset); }; - auto print_success = [&fp, &ANSI_PREV_LINE, &IS_DEBUG]() { + auto print_success = [&fp, &IS_DEBUG]() { logger.print(IS_DEBUG ? "" : ansi::clear_line + ansi::cursor_prev_line(1) + ansi::clear_line +