From 4188ee2c046ced00cd3accba4cde2318587f8c8a Mon Sep 17 00:00:00 2001 From: Arthur Sonzogni Date: Sun, 17 Oct 2021 16:03:18 +0200 Subject: [PATCH] Merge workflows. (#234) - Merge all the workflows into one file. - Produce Windows and MacOS artifact. --- .github/workflows/build.yaml | 161 ++++++++++++++++++++++++ .github/workflows/codeql-analysis.yml | 71 ----------- .github/workflows/linux-clang.yaml | 31 ----- .github/workflows/linux-emscripten.yaml | 51 -------- .github/workflows/linux-gcc.yaml | 30 ----- .github/workflows/mac-clang.yaml | 31 ----- .github/workflows/release.yaml | 39 ------ .github/workflows/windows-msvc.yaml | 32 ----- CHANGELOG.md | 10 +- CMakeLists.txt | 2 +- README.md | 20 +-- cmake/ftxui_package.cmake | 10 +- 12 files changed, 183 insertions(+), 305 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/linux-clang.yaml delete mode 100644 .github/workflows/linux-emscripten.yaml delete mode 100644 .github/workflows/linux-gcc.yaml delete mode 100644 .github/workflows/mac-clang.yaml delete mode 100644 .github/workflows/release.yaml delete mode 100644 .github/workflows/windows-msvc.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..429403e --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,161 @@ +name: Build + +on: + create: + tags: + -v* + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + name: "Tests" + strategy: + matrix: + include: + - name: Linux GCC + os: ubuntu-latest + compiler: g++-9 + test: true + + - name: Linux Clang + os: ubuntu-latest + compiler: clang++ + test: true + + - name: MacOS clang + os: macos-latest + compiler: clang++ + test: true + + - name: Windows MSVC + os: windows-latest + compiler: cl + test: false + + runs-on: ${{ matrix.os }} + steps: + - name: "Checkout repository" + uses: actions/checkout@v2 + + - name: "Enable MSVC command prompt" + if: matrix.os == 'windows-latest' + uses: ilammy/msvc-dev-cmd@v1 + + - name: "Install cmake" + uses: lukka/get-cmake@latest + + - name: "Build debug mode" + run: > + mkdir build; + cd build; + cmake .. + -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} + -DFTXUI_BUILD_DOCS=OFF + -DFTXUI_BUILD_EXAMPLES=ON + -DFTXUI_BUILD_TESTS=ON + -DFTXUI_BUILD_TESTS_FUZZER=OFF + -DFTXUI_ENABLE_INSTALL=ON ; + cmake --build . --config Debug; + + - name: "Run tests" + if: matrix.test + run: > + cd build; + ./tests + + # Create a release on new v* tags + release: + needs: test + if: ${{ github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') }} + name: "Create release" + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: "Create release" + uses: softprops/action-gh-release@v1 + id: create_release + with: + draft: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Build artifact for the release + package: + name: "Build packages" + needs: release + strategy: + matrix: + include: + - os: ubuntu-latest + asset_path: build/ftxui*Linux* + - os: macos-latest + asset_path: build/ftxui*Darwin* + - os: windows-latest + asset_path: build/ftxui*Win64* + runs-on: ${{ matrix.os }} + steps: + - name: "Checkout repository" + uses: actions/checkout@v2 + + - name: "Install cmake" + uses: lukka/get-cmake@latest + + - name: "Build packages" + run: > + mkdir build; + cd build; + cmake .. + -DCMAKE_BUILD_TYPE=Release + -DFTXUI_BUILD_DOCS=OFF + -DFTXUI_BUILD_EXAMPLES=OFF + -DFTXUI_BUILD_TESTS=OFF + -DFTXUI_BUILD_TESTS_FUZZER=OFF + -DFTXUI_ENABLE_INSTALL=ON; + cmake --build . --target package; + - uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ${{ matrix.asset_path }} + overwrite: true + + documentation: + needs: package + runs-on: ubuntu-latest + steps: + - name: "Checkout repository" + uses: actions/checkout@v2 + + - name: "Install cmake" + uses: lukka/get-cmake@latest + + - name: "Install emsdk" + uses: mymindstorm/setup-emsdk@v7 + + - name: "Install Doxygen/Graphviz" + run: > + sudo apt-get update; + sudo apt-get install doxygen graphviz; + + - name: "Build documentation" + run: > + mkdir build; + cd build; + emcmake cmake ..; + cmake --build . --target doc; + rsync -amv --include='*/' --include='*.html' --include='*.js' --include='*.wasm' --exclude='*' examples doc/doxygen/html; + + - name: "Deploy" + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: build/doc/doxygen/html/ + enable_jekyll: false + allow_empty_commit: false + force_orphan: true + publish_branch: gh-pages diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 33b47e3..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,71 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '38 7 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'cpp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/linux-clang.yaml b/.github/workflows/linux-clang.yaml deleted file mode 100644 index fffe994..0000000 --- a/.github/workflows/linux-clang.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: Linux Clang - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - name: Linux Clang - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: seanmiddleditch/gha-setup-ninja@master - - name: Build - run: > - mkdir build; - cd build; - cmake .. - -DCMAKE_CXX_COMPILER=clang++ - -DFTXUI_BUILD_TESTS=ON; - cmake --build . --config Release; - - - name: Tests - if: ${{ matrix.config.test }} - run: > - cd build; - ./tests diff --git a/.github/workflows/linux-emscripten.yaml b/.github/workflows/linux-emscripten.yaml deleted file mode 100644 index a55eddc..0000000 --- a/.github/workflows/linux-emscripten.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: Linux Emscripten - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - name: Linux Emscripten - runs-on: ubuntu-latest - env: - DOCUMENTATION: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - steps: - - uses: actions/checkout@v2 - - uses: seanmiddleditch/gha-setup-ninja@master - - uses: mymindstorm/setup-emsdk@v7 - - - name: Install Doxygen/Graphviz - if: fromJSON(env.DOCUMENTATION) - run: | - sudo apt-get update - sudo apt-get install doxygen graphviz - - - name: Build - run: | - emcmake cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S . -B build - cmake --build build - - - name: Build documentation - if: fromJSON(env.DOCUMENTATION) - run: | - cd build - cmake --build . --target doc - # Copy emscripten built examples to the doxygen output directory for deployment - rsync -amv --include='*/' --include='*.html' --include='*.js' --include='*.wasm' --exclude='*' examples doc/doxygen/html - - # Deploy the HTML documentation to GitHub Pages - - name: GH Pages Deployment - if: fromJSON(env.DOCUMENTATION) - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: build/doc/doxygen/html/ - enable_jekyll: false - allow_empty_commit: false - force_orphan: true - publish_branch: gh-pages diff --git a/.github/workflows/linux-gcc.yaml b/.github/workflows/linux-gcc.yaml deleted file mode 100644 index f978b0b..0000000 --- a/.github/workflows/linux-gcc.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Linux GCC - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - name: Linux GCC - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: seanmiddleditch/gha-setup-ninja@master - - name: Build - run: > - mkdir build; - cd build; - cmake .. - -DCMAKE_CXX_COMPILER=g++-9 - -DFTXUI_BUILD_TESTS=ON; - cmake --build . --config Release; - - - name: Tests - run: > - cd build; - ./tests diff --git a/.github/workflows/mac-clang.yaml b/.github/workflows/mac-clang.yaml deleted file mode 100644 index bca5633..0000000 --- a/.github/workflows/mac-clang.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: MacOS Clang - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - name: MacOS Clang - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - uses: seanmiddleditch/gha-setup-ninja@master - - name: Build - run: > - mkdir build; - cd build; - cmake .. - -DCMAKE_CXX_COMPILER=clang++ - -DFTXUI_BUILD_TESTS=ON; - cmake --build . --config Release; - - - name: Tests - if: ${{ matrix.config.test }} - run: > - cd build; - ./tests diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index d241cbd..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Release - -on: - create: - tags: - -v* - -jobs: - build: - name: Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - uses: seanmiddleditch/gha-setup-ninja@master - - - name: Build - run: > - mkdir build; - cd build; - cmake .. - -DCMAKE_CXX_COMPILER=clang++ - -DFTXUI_BUILD_DOCS=OFF - -DFTXUI_BUILD_EXAMPLES=OFF - -DFTXUI_BUILD_TESTS=OFF - -DFTXUI_BUILD_TESTS_FUZZER=OFF - -DFTXUI_ENABLE_INSTALL=ON; - cmake --build . --config Release; - make package; - - - name: Upload - uses: softprops/action-gh-release@v1 - with: - files: build/ftxui-* - draft: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/windows-msvc.yaml b/.github/workflows/windows-msvc.yaml deleted file mode 100644 index d2b08de..0000000 --- a/.github/workflows/windows-msvc.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Windows MSVC - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - name: Windows MSVC - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: seanmiddleditch/gha-setup-ninja@master - - uses: ilammy/msvc-dev-cmd@v1 - - name: Build - run: > - mkdir build; - cd build; - cmake .. - -DCMAKE_CXX_COMPILER="cl" - -DFTXUI_BUILD_TESTS=ON; - cmake --build . --config Release; - - - name: Tests - if: ${{ matrix.config.test }} - run: > - cd build; - ./tests.exe diff --git a/CHANGELOG.md b/CHANGELOG.md index fd47c94..76cc0bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,20 @@ Changelog ========= -Unreleased (development) +released (development) ------------------------ +0.11 +---- + +## github workflow +- Add Windows ad MacOS artefacts. +- Merge all the workflows. + ## Bug - On Unix system, fallback to {80,25} screen dimension on failure. ## CMake -Added: - Support for shared library, via `BUILD_SHARED_LIBS` option. - Add library version and symlinks. diff --git a/CMakeLists.txt b/CMakeLists.txt index be086d8..166fb39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ include(cmake/ftxui_git_version.cmake) project(ftxui LANGUAGES CXX - VERSION 0.10.${git_version} + VERSION 0.11.${git_version} ) option(FTXUI_BUILD_DOCS "Set to ON to build tests" ON) diff --git a/README.md b/README.md index 1890d28..2895e15 100644 --- a/README.md +++ b/README.md @@ -35,23 +35,11 @@ A simple C++ library for terminal based user interface. * Keyboard & mouse navigation. ## Operating systems -- [![linux-emscripten][badge.linux-emscripten]][link.linux-emscripten] -- [![linux-gcc][badge.linux-gcc]][link.linux-gcc] -[![linux-clang][badge.linux-clang]][link.linux-clang] -- [![windows-msvc][badge.windows-msvc]][link.windows-msvc] -- [![mac-clang][badge.mac-clang]][link.mac-clang] -[badge.linux-gcc]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/linux-gcc.yaml/badge.svg?branch=master -[badge.linux-clang]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/linux-clang.yaml/badge.svg?branch=master -[badge.linux-emscripten]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/linux-emscripten.yaml/badge.svg?branch=master -[badge.windows-msvc]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/windows-msvc.yaml/badge.svg?branch=master -[badge.mac-clang]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/mac-clang.yaml/badge.svg?branch=master - -[link.linux-gcc]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/linux-gcc.yaml -[link.linux-clang]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/linux-clang.yaml -[link.linux-emscripten]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/linux-emscripten.yaml -[link.windows-msvc]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/windows-msvc.yaml -[link.mac-clang]: https://github.com/ArthurSonzogni/FTXUI/actions/workflows/mac-clang.yaml +- Webassembly +- Linux +- MacOS +- Windows ## Example ~~~cpp diff --git a/cmake/ftxui_package.cmake b/cmake/ftxui_package.cmake index c5e5250..cc20cb3 100644 --- a/cmake/ftxui_package.cmake +++ b/cmake/ftxui_package.cmake @@ -1,4 +1,12 @@ -set(CPACK_GENERATOR "DEB;External;RPM;STGZ;TBZ2;TGZ;TXZ;TZ;TZST;ZIP") +if (UNIX AND NOT APPLE) + set(CPACK_GENERATOR "DEB;External;RPM;STGZ;TBZ2;TGZ;TXZ;TZ;TZST;ZIP") +elseif (UNIX AND APPLE) + set(CPACK_GENERATOR "DragNDrop;NuGet;TGZ;ZIP") +elseif (WIN32) + set(CPACK_GENERATOR "DEB;NuGet;TGZ;ZIP") +else() + set(CPACK_GENERATOR "ZIP") +endif() set(CPACK_DEBIAN_PACKAGE_DEPENDS " ") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE_URL "https://github.com/ArthurSonzogni/FTXUI/") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Arthur Sonzogni")