From a6a7f0a354042b7b2e1dcf15d39393bd35e4537d Mon Sep 17 00:00:00 2001 From: Arthur Sonzogni Date: Sat, 20 Mar 2021 22:45:21 +0100 Subject: [PATCH] Add CI on github action. (#76) --- .github/workflows/continuous-integration.yaml | 78 +++++++++++++++++++ src/ftxui/component/screen_interactive.cpp | 2 + 2 files changed, 80 insertions(+) create mode 100644 .github/workflows/continuous-integration.yaml diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml new file mode 100644 index 0000000..98c3254 --- /dev/null +++ b/.github/workflows/continuous-integration.yaml @@ -0,0 +1,78 @@ +name: Build and run tests + +on: + - push + - pull_request + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - name: "Windows Latest - MSVC" + os: windows-latest + cc: "cl" + cxx: "cl" + cmake: cmake + test: false + + - name: "Ubuntu Latest - GCC" + os: ubuntu-latest + cc: "gcc-9" + cxx: "g++-9" + cmake: "cmake" + test: true + + - name: "Ubuntu Latest - Clang" + os: ubuntu-latest + cc: "clang-9" + cxx: "clang++-9" + cmake: "cmake" + test: true + + - name: "Ubuntu Latest - Emscripten" + os: ubuntu-latest + cc: "emcc" + cxx: "em++" + cmake: "emcmake cmake" + test: false + + - name: "macOS Latest Clang" + os: macos-latest + artifact: "macos_clang.7z" + build_type: "Release" + cc: "clang" + cxx: "clang++" + cmake: cmake + test: true + + steps: + - uses: actions/checkout@v2 + - uses: seanmiddleditch/gha-setup-ninja@master + + - name: Set Windows ENV + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + + - name: Setup Emscripten + if: ${{ matrix.config.cc == 'emcc' }} + uses: mymindstorm/setup-emsdk@v7 + + - name: Build + run: > + mkdir build; + cd build; + ${{ matrix.config.cmake }} + .. + -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} + -DFTXUI_BUILD_TESTS=ON; + cmake --build . --config Release; + + - name: Tests + if: ${{ matrix.config.test }} + run: > + cd build; + ./tests diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp index 4c486bf..130ce34 100644 --- a/src/ftxui/component/screen_interactive.cpp +++ b/src/ftxui/component/screen_interactive.cpp @@ -92,6 +92,8 @@ void EventListener(std::atomic* quit, #else +#include + int CheckStdinReady(int usec_timeout) { timeval tv = {0, usec_timeout}; fd_set fds;