diff --git a/.github/workflows/cortex-cpp-quality-gate.yml b/.github/workflows/cortex-cpp-quality-gate.yml index 85050581a..5e34392e2 100644 --- a/.github/workflows/cortex-cpp-quality-gate.yml +++ b/.github/workflows/cortex-cpp-quality-gate.yml @@ -102,7 +102,7 @@ jobs: cd engine echo "huggingFaceToken: ${{ secrets.HUGGINGFACE_TOKEN_READ }}" > ~/.cortexrc echo "gitHubToken: ${{ secrets.PAT_SERVICE_ACCOUNT }}" >> ~/.cortexrc - ./build/cortex + # ./build/cortex cat ~/.cortexrc - name: Run unit tests @@ -115,10 +115,10 @@ jobs: - name: Run setup config run: | cd engine - echo "huggingFaceToken: ${{ secrets.HUGGINGFACE_TOKEN_READ }}" > ~/.cortexrc + echo "apiServerPort: 3928" > ~/.cortexrc + echo "huggingFaceToken: ${{ secrets.HUGGINGFACE_TOKEN_READ }}" >> ~/.cortexrc echo "gitHubToken: ${{ secrets.PAT_SERVICE_ACCOUNT }}" >> ~/.cortexrc - echo "apiServerPort: 3928" >> ~/.cortexrc - ./build/cortex + # ./build/cortex cat ~/.cortexrc - name: Run e2e tests diff --git a/engine/cli/utils/download_progress.cc b/engine/cli/utils/download_progress.cc index e085a660e..37920e516 100644 --- a/engine/cli/utils/download_progress.cc +++ b/engine/cli/utils/download_progress.cc @@ -8,6 +8,10 @@ #include "utils/format_utils.h" #include "utils/json_helper.h" #include "utils/logging_utils.h" +#if !defined(WIN32) && !defined(WIN64) +#include +#include +#endif namespace { std::string Repo2Engine(const std::string& r) { @@ -20,6 +24,20 @@ std::string Repo2Engine(const std::string& r) { } return r; }; + +int GetColumns() { +#if defined(WIN32) || defined(WIN64) + CONSOLE_SCREEN_BUFFER_INFO csbi; + int columns; + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); + columns = csbi.srWindow.Right - csbi.srWindow.Left + 1; + return columns; +#else + struct winsize w; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + return w.ws_col; +#endif +} } // namespace bool DownloadProgress::Connect(const std::string& host, int port) { if (ws_) { @@ -97,7 +115,7 @@ bool DownloadProgress::Handle( items[i.id] = std::pair( idx, std::make_unique( - indicators::option::BarWidth{50}, + indicators::option::BarWidth{GetColumns() / 6}, indicators::option::Start{"["}, indicators::option::Fill{"="}, indicators::option::Lead{">"}, indicators::option::End{"]"}, indicators::option::PrefixText{pad_string(Repo2Engine(i.id))}, diff --git a/engine/e2e-test/test_api_engine_list.py b/engine/e2e-test/test_api_engine_list.py index 974fbbf8e..71b9ea8b4 100644 --- a/engine/e2e-test/test_api_engine_list.py +++ b/engine/e2e-test/test_api_engine_list.py @@ -8,6 +8,9 @@ class TestApiEngineList: @pytest.fixture(autouse=True) def setup_and_teardown(self): # Setup + # Not sure why but on macOS amd, the first start server timeouts with CI + start_server() + stop_server() success = start_server() if not success: raise Exception("Failed to start server")