Skip to content

Commit

Permalink
Use C++20 formatting API rather than fmtlib
Browse files Browse the repository at this point in the history
Other changes:

- [crispy] App: Changes log timestamps to print time in local time
- Drop Ubuntu 20.04 and Ubuntu 22.04 CI pipline building and tests

Signed-off-by: Christian Parpart <christian@parpart.family>
  • Loading branch information
christianparpart committed Sep 29, 2024
1 parent fae1f25 commit 87bde6b
Show file tree
Hide file tree
Showing 130 changed files with 1,181 additions and 1,390 deletions.
2 changes: 0 additions & 2 deletions .github/fedora/contour.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Source0: %{name}-%{version}.tar.gz

BuildRequires: cmake
BuildRequires: extra-cmake-modules
# Don't use system-dep of fmt-devel for now as we need a newer one
# BuildRequires: fmt-devel
BuildRequires: fontconfig-devel
BuildRequires: freetype-devel
BuildRequires: gcc-c++
Expand Down
220 changes: 37 additions & 183 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,114 +572,6 @@ jobs:
if-no-files-found: error
retention-days: 7
# }}}
# {{{ Ubuntu 22.04 CC matrix
ubuntu_2204_cc_matrix:
strategy:
fail-fast: false
matrix:
cxx: [20]
build_type: ["RelWithDebInfo"]
compiler:
[
"GCC 10",
"Clang 15",
]
qt_version: [6]
name: "Ubuntu Linux 22.04 (${{ matrix.compiler }}, C++${{ matrix.cxx }}, Qt${{ matrix.qt_version }})"
runs-on: ubuntu-22.04
outputs:
id: "${{ matrix.compiler }} (C++${{ matrix.cxx }}, ${{ matrix.build_type }}, ${{ matrix.qt_version }})"
steps:
- uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: "ccache-ubuntu2204-${{ matrix.compiler }}-${{ matrix.cxx }}-${{ matrix.build_type }}-${{ matrix.qt_version }}"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update
- name: Installing xmllint for ci-set-vars
run: sudo apt -qy install libxml2-utils
- name: set environment variables
id: set_vars
run: ./scripts/ci-set-vars.sh
env:
REPOSITORY: ${{ github.event.repository.name }}
- name: "Set up output var: CC_VERSION"
id: extract_matrix
run: |
CC_VERSION=$( echo "${{ matrix.compiler }}" | awk '{ print $2; }')
echo "CC_VERSION=${CC_VERSION}" >> "$GITHUB_OUTPUT"
- name: "Set up QTVER var"
id: set_qtver
run: |
if [[ ${{ matrix.qt_version }} = "5" ]]; then
echo "QTVER=5" >> "$GITHUB_OUTPUT"
else
echo "QTVER=6" >> "$GITHUB_OUTPUT"
fi
- name: "install dependencies"
run: sudo env QTVER="${{ matrix.qt_version }}" SYSDEP_ASSUME_YES=ON ./scripts/install-deps.sh
- name: "Post-fix embedded dependency permissions."
run: sudo find _deps/sources -exec chown $UID {} \;
- name: Install GCC
if: ${{ startsWith(matrix.compiler, 'GCC') }}
run: sudo apt install -y g++-${{ steps.extract_matrix.outputs.CC_VERSION }}
- name: Install Clang
if: ${{ startsWith(matrix.compiler, 'Clang') }}
run: sudo apt install -y clang-${{ steps.extract_matrix.outputs.CC_VERSION }} #libc++-dev libc++abi-dev
- name: Install Clang-Tidy
if: ${{ startsWith(matrix.compiler, 'Clang') }}
run: sudo apt install -y clang-tidy-${{ steps.extract_matrix.outputs.CC_VERSION }}

- name: Install CMake
uses: ssrobins/install-cmake@v1
- name: "create build directory"
run: mkdir build
- name: CMake version
run: cmake --version
- name: "cmake"
run: |
CC_NAME=$(echo "${{ matrix.compiler }}" | awk '{ print tolower($1); }')
CC_VER=$( echo "${{ matrix.compiler }}" | awk '{ print $2; }')
test "${{ matrix.compiler }}" = "GCC 8" && EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DPEDANTIC_COMPILER_WERROR=ON"
test "${CC_NAME}" = "gcc" && CC_EXE="g++"
if [[ "${CC_NAME}" = "clang" ]]; then
CC_EXE="clang++"
# CMAKE_CXX_FLAGS="-stdlib=libc++"
# CMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -lc++abi"
# EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DENABLE_TIDY=ON"
# EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DPEDANTIC_COMPILER_WERROR=OFF"
fi
cmake \
$EXTRA_CMAKE_FLAGS \
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx }} \
-DCMAKE_CXX_COMPILER="${CC_EXE}-${CC_VER}" \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCONTOUR_QT_VERSION=${{ matrix.qt_version }} \
-DLIBUNICODE_UCD_BASE_DIR=$PWD/_ucd \
--preset linux-debug
- name: "build"
run: cmake --build --preset linux-debug -- -j3
- name: "tests"
run: cmake --build --preset linux-debug --target test
- name: "Upload unit tests"
if: ${{ matrix.compiler == 'GCC 10' && matrix.cxx == '20' && matrix.qt_version == '6' }}
uses: actions/upload-artifact@v4
with:
name: contour-ubuntu2204-tests
path: |
build/linux-debug/src/crispy/crispy_test
build/linux-debug/src/vtparser/vtparser_test
build/linux-debug/src/vtbackend/vtbackend_test
build/linux-debug/src/vtbackend/bench-headless
build/linux-debug/src/vtrasterizer/vtrasterizer_test
test/images
retention-days: 1
# }}}
# {{{ Ubuntu 24.04 CC matrix
ubuntu_2404_cc_matrix:
strategy:
Expand Down Expand Up @@ -773,10 +665,10 @@ jobs:
- name: "tests"
run: cmake --build --preset linux-debug --target test
- name: "Upload unit tests"
if: ${{ matrix.compiler == 'GCC 10' && matrix.cxx == '20' && matrix.qt_version == '6' }}
if: ${{ matrix.compiler == 'GCC 14' && matrix.cxx == '20' && matrix.qt_version == '6' }}
uses: actions/upload-artifact@v4
with:
name: contour-ubuntu2204-tests
name: contour-ubuntu2404-tests
path: |
build/linux-debug/src/crispy/crispy_test
build/linux-debug/src/vtparser/vtparser_test
Expand Down Expand Up @@ -858,13 +750,13 @@ jobs:
if-no-files-found: error
retention-days: 7
# }}}
# {{{ Ubuntu 20.04 / 22.04 / 24.04
# {{{ Ubuntu 24.04
package_for_Ubuntu:
name: "Packaging for Ubuntu ${{ matrix.os_version }}"
strategy:
fail-fast: false
matrix:
os_version: ['20.04', '22.04', '24.04']
os_version: ['24.04']
runs-on: ubuntu-${{ matrix.os_version }}
steps:
- name: Checkout code
Expand All @@ -883,15 +775,6 @@ jobs:
with:
key: "ccache-ubuntu-${{ matrix.os_version }}"
max-size: 256M
- name: set QTVER
id: set_qtver
run: |
if [[ ${{ matrix.os_version }} = "20.04" ]]; then
echo "QTVER=5" >> "$GITHUB_OUTPUT"
fi
- name: "Install gcc-10 on 20.04"
if: matrix.os_version == '20.04'
run: sudo apt -y install gcc-10
- name: "install dependencies"
run: sudo env QTVER="${{ steps.set_qtver.outputs.QTVER }}" ./scripts/install-deps.sh
- name: "Post-fix embedded dependency permissions."
Expand All @@ -907,15 +790,8 @@ jobs:
run: |
# TODO: turn on -Werror again, that requires some code changes.
CMAKE_CXX_STANDARD=20
if [[ "${{ matrix.os_version }}" = "20.04" ]]; then
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_QT_VERSION=5 -DCMAKE_CXX_COMPILER=g++-10"
else
# use Qt6 for 22.04
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_QT_VERSION=6"
fi
if [[ "${{ matrix.os_version }}" = "24.04" ]]; then
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_PACKAGE_TERMINFO=OFF"
fi
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_QT_VERSION=6"
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_PACKAGE_TERMINFO=OFF"
BUILD_DIR="build" \
CMAKE_BUILD_TYPE=RelWithDebInfo \
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS \
Expand Down Expand Up @@ -953,35 +829,28 @@ jobs:
sudo dpkg --install "contour-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.deb"
sudo dpkg --install "contour-dbgsym-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu${{ matrix.os_version }}-amd64.ddeb"
# }}}
# {{{ Ubuntu 22.04: test via valgrind
test_ubuntu2204_valgrind:
# {{{ Ubuntu 24.04: test via valgrind
test_ubuntu2404_valgrind:
name: "Run tests via valgrind"
runs-on: ubuntu-22.04
needs: [ubuntu_2204_cc_matrix]
runs-on: ubuntu-24.04
needs: [ubuntu_2404_cc_matrix]
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts
- name: "download artifact"
uses: actions/download-artifact@v4
with:
name: contour-ubuntu2204-tests
name: contour-ubuntu2404-tests
- name: "update APT database"
run: sudo apt -q update
- name: "fix unit test permissions"
run: |
find . -name '*_test' -exec chmod 0755 {} \;
find . -name 'bench-headless' -exec chmod 0755 {} \;
- name: "install dependencies"
run: |
set -ex
ls -hlR
sudo apt install -y \
libfontconfig1 \
libfreetype6 \
libharfbuzz0b \
libqt5gui5 \
libqt5opengl5 \
libyaml-cpp0.7 \
ncurses-bin \
valgrind
run: ./scripts/ci-install-run-deps.sh valgrind
- name: "test: crispy (via valgrind)"
run: valgrind --error-exitcode=64 ./build/linux-debug/src/crispy/crispy_test
- name: "test: vtparser (via valgrind)"
Expand All @@ -991,8 +860,8 @@ jobs:
- name: "test: vtrasterizer (via valgrind)"
run: valgrind --error-exitcode=64 ./build/linux-debug/src/vtrasterizer/vtrasterizer_test
# }}}
# {{{ Ubuntu 22.04: Test bench-headless
test_ubuntu2204_bench_headless:
# {{{ Ubuntu 24.04: Test bench-headless
test_ubuntu2404_bench_headless:
strategy:
matrix:
test_case:
Expand All @@ -1001,60 +870,53 @@ jobs:
"grid long"
]
name: "Run bench-headless"
runs-on: ubuntu-22.04
needs: [ubuntu_2204_cc_matrix]
runs-on: ubuntu-24.04
needs: [ubuntu_2404_cc_matrix]
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts
- name: "download artifact"
uses: actions/download-artifact@v4
with:
name: contour-ubuntu2204-tests
name: contour-ubuntu2404-tests
- name: "update APT database"
run: sudo apt -q update
- name: "fix unit test permissions"
run: |
find . -name '*_test' -exec chmod 0755 {} \;
find . -name 'bench-headless' -exec chmod 0755 {} \;
- name: "install dependencies"
run: |
set -ex
ls -hlR
sudo apt install -y \
libfontconfig1 \
libfreetype6 \
libharfbuzz0b \
libqt5gui5 \
libqt5opengl5 \
libyaml-cpp0.7 \
ncurses-bin \
valgrind
run: ./scripts/ci-install-run-deps.sh valgrind
- name: "bench-headless: ${{ matrix.test_case }}"
run: valgrind --error-exitcode=64 ./build/linux-debug/src/vtbackend/bench-headless ${{ matrix.test_case }} size 1
# }}}
# {{{ Ubuntu check matrix
check_ubuntu2204_matrix_test_matrix:
check_ubuntu2404_matrix_test_matrix:
if: ${{ always() }}
runs-on: ubuntu-latest
name: "Ubuntu Linux 22.04 post-check"
name: "Ubuntu Linux 24.04 post-check"
needs:
- package_for_Ubuntu
- ubuntu_2204_cc_matrix
- test_ubuntu2204_valgrind
- test_ubuntu2204_bench_headless
- ubuntu_2404_cc_matrix
- test_ubuntu2404_valgrind
- test_ubuntu2404_bench_headless
steps:
- name: Print matrix status
run: |
echo "Result (CC matrix) : ${{ needs.ubuntu_2204_cc_matrix.result }}"
echo "Result (CC matrix) : ${{ needs.ubuntu_2404_cc_matrix.result }}"
echo "Result (packaging matrix) : ${{ needs.package_for_Ubuntu.result }}"
- name: Check build matrix status
if: ${{ needs.ubuntu_2204_cc_matrix.result != 'success' && needs.ubuntu_2204_cc_matrix.result != 'skipped' }}
if: ${{ needs.ubuntu_2404_cc_matrix.result != 'success' && needs.ubuntu_2404_cc_matrix.result != 'skipped' }}
run: exit 1
- name: Check package_for_Ubuntu matrix status
if: ${{ needs.package_for_Ubuntu.result != 'success' && needs.package_for_Ubuntu.result != 'skipped' }}
run: exit 1
- name: "Delete artifact: contour-ubuntu2204-tests"
- name: "Delete artifact: contour-ubuntu2404-tests"
uses: geekyeggo/delete-artifact@v2
with:
name: contour-ubuntu2204-tests
name: contour-ubuntu2404-tests
# }}}
# {{{ GUI: test: contour quick shell exit
test_quick_exit:
Expand All @@ -1063,7 +925,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os_version: ['20.04', '22.04', '24.04']
os_version: ['24.04']
runs-on: ubuntu-${{ matrix.os_version }}
env:
# I'm giving up on eliminating all leaks for now.
Expand Down Expand Up @@ -1233,7 +1095,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os_version: ['20.04', '22.04', '24.04']
os_version: ['24.04']
runs-on: ubuntu-${{ matrix.os_version}}
needs: [package_for_Ubuntu]
steps:
Expand Down Expand Up @@ -1304,14 +1166,6 @@ jobs:
REPOSITORY: ${{ github.event.repository.name }}

# {{{ fetch release artifacts
- name: "fetch artifact: Ubuntu 20.04"
uses: actions/download-artifact@v4
with:
name: contour-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu20.04-amd64.deb
- name: "fetch artifact: Ubuntu 22.04"
uses: actions/download-artifact@v4
with:
name: contour-${{ steps.set_vars.outputs.VERSION_STRING }}-ubuntu22.04-amd64.deb
- name: "fetch artifact: Ubuntu 24.04"
uses: actions/download-artifact@v4
with:
Expand Down
7 changes: 2 additions & 5 deletions cmake/ContourThirdParties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ message(STATUS "================================================================
message(STATUS " Contour ThirdParties: ${ContourThirdParties}")

set(LIBUNICODE_MINIMAL_VERSION "0.4.0")
set(BOXED_CPP_MINIMAL_VERSION "1.4.2")
set(TERMBENCH_PRO_COMMIT_HASH "96c6bb7897af4110d1b99a93b982f8ec10e71183")
set(FMT_VERSION "10.0.0")
set(BOXED_CPP_MINIMAL_VERSION "1.4.3")
set(TERMBENCH_PRO_COMMIT_HASH "f6c37988e6481b48a8b8acaf1575495e018e9747")
set(CATCH_VERSION "3.4.0")
set(RANGE_V3_VERSION "0.12.0")
set(YAML_CPP_VERSION "0.8.0")
Expand Down Expand Up @@ -89,7 +88,6 @@ endif()
if(CONTOUR_TESTING)
HandleThirdparty(Catch2 "gh:catchorg/Catch2@${CATCH_VERSION}")
endif()
HandleThirdparty(fmt "gh:fmtlib/fmt#${FMT_VERSION}")
HandleThirdparty(range-v3 "gh:ericniebler/range-v3#${RANGE_V3_VERSION}")
HandleThirdparty(yaml-cpp "gh:jbeder/yaml-cpp#${YAML_CPP_VERSION}")
HandleThirdparty(Freetype "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.gz")
Expand Down Expand Up @@ -137,7 +135,6 @@ macro(ContourThirdPartiesSummary2)
message(STATUS "------------------------------------------------------------------------------")
message(STATUS "Catch2 ${THIRDPARTY_BUILTIN_Catch2}")
message(STATUS "GSL ${THIRDPARTY_BUILTIN_GSL}")
message(STATUS "fmt ${THIRDPARTY_BUILTIN_fmt}")
message(STATUS "freetype ${THIRDPARTY_BUILTIN_Freetype}")
message(STATUS "harfbuzz ${THIRDPARTY_BUILTIN_HarfBuzz}")
message(STATUS "range-v3 ${THIRDPARTY_BUILTIN_range-v3}")
Expand Down
1 change: 1 addition & 0 deletions cmake/presets/os-macos.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"rhs": "Darwin"
},
"cacheVariables": {
"LIBTERMINAL_BUILD_BENCH_HEADLESS": "OFF",
"CODE_SIGN_CERTIFICATE_ID": "Developer ID Application: Christian Parpart (6T525MU9UR)",
"CMAKE_PREFIX_PATH": "/opt/homebrew/opt/qt"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if(LIBTERMINAL_TESTING)
if(UNIX)
add_executable(watch-mouse-events watch-mouse-events.cpp)
target_link_libraries(watch-mouse-events fmt::fmt-header-only vtbackend)
target_link_libraries(watch-mouse-events vtbackend)
endif()
endif()
Loading

0 comments on commit 87bde6b

Please sign in to comment.