mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Compare commits
2 Commits
v6.1.5
...
e7539da356
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7539da356 | ||
|
|
baa5973128 |
145
.github/workflows/build.yaml
vendored
145
.github/workflows/build.yaml
vendored
@@ -1,12 +1,10 @@
|
|||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# On new commits to main:
|
create:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
# On pull requests:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@@ -154,3 +152,144 @@ jobs:
|
|||||||
flags: ${{ runner.os }}
|
flags: ${{ runner.os }}
|
||||||
name: ${{ runner.os }}-coverage
|
name: ${{ runner.os }}-coverage
|
||||||
files: ./build/coverage.xml
|
files: ./build/coverage.xml
|
||||||
|
|
||||||
|
# Create a release on new v* tags
|
||||||
|
release:
|
||||||
|
needs:
|
||||||
|
- test_cmake
|
||||||
|
- test_bazel
|
||||||
|
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_compiled:
|
||||||
|
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: Get number of CPU cores
|
||||||
|
uses: SimenB/github-actions-cpu-cores@v1
|
||||||
|
id: cpu-cores
|
||||||
|
|
||||||
|
- name: "Checkout repository"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: "Install cmake"
|
||||||
|
uses: lukka/get-cmake@latest
|
||||||
|
|
||||||
|
- name: "Build packages"
|
||||||
|
run: >
|
||||||
|
mkdir build;
|
||||||
|
cd build;
|
||||||
|
cmake ..
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
|
||||||
|
-DFTXUI_BUILD_DOCS=OFF
|
||||||
|
-DFTXUI_BUILD_EXAMPLES=OFF
|
||||||
|
-DFTXUI_BUILD_TESTS=OFF
|
||||||
|
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
||||||
|
-DFTXUI_ENABLE_INSTALL=ON
|
||||||
|
-DFTXUI_DEV_WARNINGS=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
|
||||||
|
|
||||||
|
# Build "source" artifact for the release. This is the same as the github
|
||||||
|
# "source" archive, but with a stable URL. This is useful for the Bazel
|
||||||
|
# Central Repository.
|
||||||
|
package_source:
|
||||||
|
name: "Build source package"
|
||||||
|
needs: release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout repository"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: "Create source package"
|
||||||
|
run: >
|
||||||
|
git archive --format=tar.gz --prefix=ftxui/ -o source.tar.gz HEAD
|
||||||
|
|
||||||
|
- name: "Upload source package"
|
||||||
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
||||||
|
asset_path: source.tar.gz
|
||||||
|
overwrite: true
|
||||||
|
|
||||||
|
|
||||||
|
documentation:
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout repository"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- 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 ..
|
||||||
|
-DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DFTXUI_BUILD_DOCS=ON
|
||||||
|
-DFTXUI_BUILD_EXAMPLES=ON
|
||||||
|
-DFTXUI_BUILD_TESTS=OFF
|
||||||
|
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
||||||
|
-DFTXUI_ENABLE_INSTALL=OFF
|
||||||
|
-DFTXUI_DEV_WARNINGS=ON ;
|
||||||
|
cmake --build . --target doc;
|
||||||
|
cmake --build . ;
|
||||||
|
rsync -amv
|
||||||
|
--include='*/'
|
||||||
|
--include='*.html'
|
||||||
|
--include='*.css'
|
||||||
|
--include='*.mjs'
|
||||||
|
--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
|
||||||
|
|||||||
60
.github/workflows/documentation.yaml
vendored
60
.github/workflows/documentation.yaml
vendored
@@ -1,60 +0,0 @@
|
|||||||
name: Documentation
|
|
||||||
|
|
||||||
on:
|
|
||||||
# On new commits to main:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
documentation:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- 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 ..
|
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
|
||||||
-DFTXUI_BUILD_DOCS=ON
|
|
||||||
-DFTXUI_BUILD_EXAMPLES=ON
|
|
||||||
-DFTXUI_BUILD_TESTS=OFF
|
|
||||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
|
||||||
-DFTXUI_ENABLE_INSTALL=OFF
|
|
||||||
-DFTXUI_DEV_WARNINGS=ON ;
|
|
||||||
cmake --build . --target doc;
|
|
||||||
cmake --build . ;
|
|
||||||
rsync -amv
|
|
||||||
--include='*/'
|
|
||||||
--include='*.html'
|
|
||||||
--include='*.css'
|
|
||||||
--include='*.mjs'
|
|
||||||
--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
|
|
||||||
40
.github/workflows/publish.yaml
vendored
40
.github/workflows/publish.yaml
vendored
@@ -1,41 +1,27 @@
|
|||||||
name: "Publish to Bazel Central Registry"
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Manual kick-off (you type the tag)
|
# On new releases:
|
||||||
workflow_dispatch:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
tag_name:
|
tag_name:
|
||||||
description: "Tag to publish"
|
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
# Fire as soon as the Release workflow completes
|
# On manual trigger:
|
||||||
workflow_run:
|
workflow_dispatch:
|
||||||
workflows:
|
inputs:
|
||||||
- Release
|
tag_name:
|
||||||
types:
|
required: true
|
||||||
- completed
|
type: string
|
||||||
|
|
||||||
permissions:
|
|
||||||
|
|
||||||
attestations: write
|
|
||||||
contents: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.0.4
|
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.0.4
|
||||||
# Only run on manual dispatch, or when Release finishes successfully
|
|
||||||
if: |
|
|
||||||
github.event_name == 'workflow_dispatch' ||
|
|
||||||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
|
|
||||||
with:
|
with:
|
||||||
# If manual: use the input, otherwise grab the tag from the completed run
|
tag_name: ${{ inputs.tag_name }}
|
||||||
tag_name: ${{
|
|
||||||
github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name ||
|
|
||||||
github.event_name == 'workflow_run' && github.event.workflow_run.head_branch
|
|
||||||
}}
|
|
||||||
registry_fork: ArthurSonzogni/bazel-central-registry
|
registry_fork: ArthurSonzogni/bazel-central-registry
|
||||||
|
permissions:
|
||||||
|
attestations: write
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
secrets:
|
secrets:
|
||||||
publish_token: ${{ secrets.PUBLISH_TOKEN }}
|
publish_token: ${{ secrets.PUBLISH_TOKEN }}
|
||||||
|
|||||||
118
.github/workflows/release.yaml
vendored
118
.github/workflows/release.yaml
vendored
@@ -1,118 +0,0 @@
|
|||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
# On push to a tag:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
# On manual trigger:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
# Needed to mint attestations
|
|
||||||
id-token: write
|
|
||||||
attestations: write
|
|
||||||
# Needed to upload release assets
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
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_compiled:
|
|
||||||
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: Get number of CPU cores
|
|
||||||
uses: SimenB/github-actions-cpu-cores@v1
|
|
||||||
id: cpu-cores
|
|
||||||
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Install cmake"
|
|
||||||
uses: lukka/get-cmake@latest
|
|
||||||
|
|
||||||
- name: "Build packages"
|
|
||||||
run: >
|
|
||||||
mkdir build;
|
|
||||||
cd build;
|
|
||||||
cmake ..
|
|
||||||
-DCMAKE_BUILD_TYPE=Release
|
|
||||||
-DCMAKE_BUILD_PARALLEL_LEVEL=${{ steps.cpu-cores.outputs.count }}
|
|
||||||
-DFTXUI_BUILD_DOCS=OFF
|
|
||||||
-DFTXUI_BUILD_EXAMPLES=OFF
|
|
||||||
-DFTXUI_BUILD_TESTS=OFF
|
|
||||||
-DFTXUI_BUILD_TESTS_FUZZER=OFF
|
|
||||||
-DFTXUI_ENABLE_INSTALL=ON
|
|
||||||
-DFTXUI_DEV_WARNINGS=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
|
|
||||||
|
|
||||||
# Build "source" artifact for the release. This is the same as the github
|
|
||||||
# "source" archive, but with a stable URL. This is useful for the Bazel
|
|
||||||
# Central Repository.
|
|
||||||
package_source:
|
|
||||||
name: "Build source package"
|
|
||||||
needs: release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Checkout repository"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Create source package"
|
|
||||||
run: >
|
|
||||||
git archive --format=tar.gz -o source.tar.gz HEAD
|
|
||||||
|
|
||||||
- name: Generate source attestation
|
|
||||||
id: attest_source
|
|
||||||
uses: actions/attest-build-provenance@v2
|
|
||||||
with:
|
|
||||||
subject-path: source.tar.gz
|
|
||||||
|
|
||||||
- name: Write source.intoto.jsonl
|
|
||||||
run:
|
|
||||||
jq --compact-output < "${{ steps.attest_source.outputs.bundle-path }}" \
|
|
||||||
> source.tar.gz.intoto.jsonl
|
|
||||||
|
|
||||||
- name: "Upload source package"
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: source.tar.gz
|
|
||||||
overwrite: true
|
|
||||||
|
|
||||||
- name: "Upload source attestation"
|
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
||||||
asset_path: source.tar.gz.intoto.jsonl
|
|
||||||
overwrite: true
|
|
||||||
@@ -4,8 +4,8 @@ Changelog
|
|||||||
Future release
|
Future release
|
||||||
------------
|
------------
|
||||||
|
|
||||||
6.1.4 (2025-05-01)
|
6.1.0 (2025-04-29)
|
||||||
------------------
|
-----------------
|
||||||
|
|
||||||
### Build
|
### Build
|
||||||
- Feature: Support `bazel` build system. See #1032.
|
- Feature: Support `bazel` build system. See #1032.
|
||||||
@@ -15,7 +15,7 @@ Future release
|
|||||||
|
|
||||||
**MODULE.bazel**
|
**MODULE.bazel**
|
||||||
```bazel
|
```bazel
|
||||||
bazel_dep(name = "ftxui", version = "6.1.4")
|
bazel_dep(name = "ftxui", version = "6.1.0")
|
||||||
```
|
```
|
||||||
|
|
||||||
**BUILD.bazel**
|
**BUILD.bazel**
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
|
|||||||
|
|
||||||
project(ftxui
|
project(ftxui
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
VERSION 6.1.4
|
VERSION 6.1.0
|
||||||
DESCRIPTION "C++ Functional Terminal User Interface."
|
DESCRIPTION "C++ Functional Terminal User Interface."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# the LICENSE file.
|
# the LICENSE file.
|
||||||
|
|
||||||
# FTXUI Module.
|
# FTXUI Module.
|
||||||
module(name = "ftxui", version = "6.1.4")
|
module(name = "ftxui", version = "6.1.0")
|
||||||
|
|
||||||
# Build deps.
|
# Build deps.
|
||||||
bazel_dep(name = "rules_cc", version = "0.1.1")
|
bazel_dep(name = "rules_cc", version = "0.1.1")
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ include(FetchContent)
|
|||||||
|
|
||||||
FetchContent_Declare(ftxui
|
FetchContent_Declare(ftxui
|
||||||
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
||||||
GIT_TAG v6.1.4
|
GIT_TAG v6.1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_GetProperties(ftxui)
|
FetchContent_GetProperties(ftxui)
|
||||||
|
|||||||
@@ -48,25 +48,38 @@ Dimensions& FallbackSize() {
|
|||||||
return g_fallback_size;
|
return g_fallback_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Safe(const char* c) {
|
|
||||||
return (c != nullptr) ? c : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Contains(const std::string& s, const char* key) {
|
bool Contains(const std::string& s, const char* key) {
|
||||||
return s.find(key) != std::string::npos;
|
return s.find(key) != std::string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/gabime/spdlog/blob/885b5473e291833b148eeac3b7ce227e582cd88b/include/spdlog/details/os-inl.h#L566
|
||||||
|
std::string getenv_safe(const char *field) {
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#if defined(__cplusplus_winrt)
|
||||||
|
return std::string{}; // not supported under uwp
|
||||||
|
#else
|
||||||
|
size_t len = 0;
|
||||||
|
char buf[1024];
|
||||||
|
bool ok = ::getenv_s(&len, buf, sizeof(buf), field) == 0;
|
||||||
|
return ok ? buf : std::string{};
|
||||||
|
#endif
|
||||||
|
#else // revert to getenv
|
||||||
|
char *buf = ::getenv(field); // NOLINT(*-mt-unsafe)
|
||||||
|
return buf ? buf : std::string{};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
Terminal::Color ComputeColorSupport() {
|
Terminal::Color ComputeColorSupport() {
|
||||||
#if defined(__EMSCRIPTEN__)
|
#if defined(__EMSCRIPTEN__)
|
||||||
return Terminal::Color::TrueColor;
|
return Terminal::Color::TrueColor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string COLORTERM = Safe(std::getenv("COLORTERM")); // NOLINT
|
std::string COLORTERM = getenv_safe("COLORTERM");
|
||||||
if (Contains(COLORTERM, "24bit") || Contains(COLORTERM, "truecolor")) {
|
if (Contains(COLORTERM, "24bit") || Contains(COLORTERM, "truecolor")) {
|
||||||
return Terminal::Color::TrueColor;
|
return Terminal::Color::TrueColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TERM = Safe(std::getenv("TERM")); // NOLINT
|
std::string TERM = getenv_safe("TERM");
|
||||||
if (Contains(COLORTERM, "256") || Contains(TERM, "256")) {
|
if (Contains(COLORTERM, "256") || Contains(TERM, "256")) {
|
||||||
return Terminal::Color::Palette256;
|
return Terminal::Color::Palette256;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user