From 801dd49839046d8b252d53de1bb57142dcd270a4 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Tue, 1 Oct 2024 20:10:57 +0200 Subject: [PATCH 1/2] ci: fix a few things format all build files add --no-install-recommends to all apt-get install calls --- .github/workflows/build.yml | 51 ++++++++++++++++++------------------- .github/workflows/test.yml | 45 ++++++++++++++++---------------- 2 files changed, 47 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4ac4c5..83722f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build CI on: push: - branches: ["main"] + branches: ['main'] pull_request: workflow_dispatch: @@ -26,14 +26,14 @@ jobs: os-version: 2022 environment: mingw architecture: x86_64 - shell: "msys2 {0}" + shell: 'msys2 {0}' - name: Windows UCRT Release os: windows os-version: 2022 environment: ucrt architecture: ucrt-x86_64 - shell: "msys2 {0}" + shell: 'msys2 {0}' - name: Linux Release os: ubuntu @@ -74,17 +74,17 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: "0" + fetch-depth: '0' - uses: actions/checkout@v4 - name: Checkout OOPetris main repo + name: Checkout OOPetris main repo with: - fetch-depth: "0" + fetch-depth: '0' repository: OpenBrickProtocolFoundation/oopetris ref: main path: ./oopetris submodules: false - + - name: Setup MSVC (Windows) if: matrix.config.os == 'windows' && matrix.config.environment == 'msvc' uses: TheMrMilchmann/setup-msvc-dev@v3 @@ -107,26 +107,25 @@ jobs: mingw-w64-${{matrix.config.architecture}}-ca-certificates mingw-w64-${{matrix.config.architecture}}-cmake git - + - name: Setup Clang (Linux) if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 18 - sudo apt-get install libc++-18* libc++abi*18* -y + sudo apt-get install libc++-18* libc++abi*18* -y --no-install-recommends echo "CC=clang-18" >> "$GITHUB_ENV" echo "CXX=clang++-18" >> "$GITHUB_ENV" echo "OBJC=clang-18" >> "$GITHUB_ENV" - - + - name: Setup GCC (Linux) if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == false uses: egor-tensin/setup-gcc@v1 with: version: 14 platform: x64 - + - name: Setup Clang (MacOS) if: matrix.config.os == 'macos' run: | @@ -143,11 +142,11 @@ jobs: echo "OBJC_LD=lld" >> "$GITHUB_ENV" - name: Setup meson (MacOS) - if: matrix.config.os == 'macos' + if: matrix.config.os == 'macos' run: | brew update brew install meson - + # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup meson if: matrix.config.os != 'macos' @@ -158,7 +157,7 @@ jobs: if: matrix.config.os == 'ubuntu' run: | sudo apt-get update - sudo apt-get install ninja-build libreadline-dev -y + sudo apt-get install ninja-build libreadline-dev -y --no-install-recommends sudo pip install meson --break-system-packages - name: Fix pkg-config (Windows MSVC) @@ -169,23 +168,23 @@ jobs: echo "PKG_CONFIG_PATH=C:/lib/pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Configure - run: | - cd oopetris - meson setup build -Dbuildtype=release -Ddefault_library=static -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }} -Donly_build_libs=true ${{ matrix.config.os == 'windows' && '-Db_vscrt=from_buildtype' || '' }} ${{ (matrix.config.os == 'windows' && ( matrix.config.environment == 'mingw' || matrix.config.environment == 'ucrt' )) && '-Dprefix=$RUNNER_TEMP/msys64${MINGW_PREFIX}/' || ''}} + run: | + cd oopetris + meson setup build -Dbuildtype=release -Ddefault_library=static -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }} -Donly_build_libs=true ${{ matrix.config.os == 'windows' && '-Db_vscrt=from_buildtype' || '' }} ${{ (matrix.config.os == 'windows' && ( matrix.config.environment == 'mingw' || matrix.config.environment == 'ucrt' )) && '-Dprefix=$RUNNER_TEMP/msys64${MINGW_PREFIX}/' || ''}} - name: Build and install Libs if: matrix.config.os != 'ubuntu' - run: | - cd oopetris - meson install -C build + run: | + cd oopetris + meson install -C build - name: Build and install Libs (Linux) if: matrix.config.os == 'ubuntu' - run: | - cd oopetris - sudo meson install -C build + run: | + cd oopetris + sudo meson install -C build - name: Build Wrapper - run: | - meson setup -Dtests=false -Dexample=true build -Dbuildtype=release -Ddefault_library=static -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }} ${{ matrix.config.os == 'windows' && '-Db_vscrt=from_buildtype' || '' }} + run: | + meson setup -Dtests=false -Dexample=true build -Dbuildtype=release -Ddefault_library=static -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }} ${{ matrix.config.os == 'windows' && '-Db_vscrt=from_buildtype' || '' }} meson compile -C build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 659354e..38c644f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,23 +2,23 @@ name: Test CI on: push: - branches: ["main"] + branches: ['main'] pull_request: workflow_dispatch: jobs: test: - name: Run Tests + name: Run Tests runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 with: - fetch-depth: "0" + fetch-depth: '0' - uses: actions/checkout@v4 name: Checkout OOPetris main repo with: - fetch-depth: "0" + fetch-depth: '0' repository: OpenBrickProtocolFoundation/oopetris ref: main path: ./oopetris @@ -29,10 +29,10 @@ jobs: wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 18 - sudo apt-get install libc++-18* libc++abi*18* llvm-18 -y + sudo apt-get install libc++-18* libc++abi*18* llvm-18 -y --no-install-recommends echo "CC=clang-18" >> "$GITHUB_ENV" echo "CXX=clang++-18" >> "$GITHUB_ENV" - + # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup meson run: | @@ -41,20 +41,20 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install ninja-build valgrind gcovr libcriterion-dev libreadline-dev -y + sudo apt-get install ninja-build valgrind gcovr libcriterion-dev libreadline-dev -y --no-install-recommends - name: Configure - run: | - cd oopetris - meson setup build -Db_coverage=true -Dbuildtype=debugoptimized -Ddefault_library=shared -Dclang_libcpp=enabled -Donly_build_libs=true -Dprefix=/usr + run: | + cd oopetris + meson setup build -Db_coverage=true -Dbuildtype=debugoptimized -Ddefault_library=shared -Dclang_libcpp=enabled -Donly_build_libs=true -Dprefix=/usr - name: Build and install Libs run: | - cd oopetris - sudo meson install -C build + cd oopetris + sudo meson install -C build - name: Build Wrapper - run: | + run: | meson setup build -Db_coverage=true -Dbuildtype=debugoptimized -Ddefault_library=shared -Dclang_libcpp=enabled -Dtests=true -Dexample=true -Dprefix=/usr meson compile -C build @@ -70,20 +70,19 @@ jobs: path: ./build/meson-logs/coverage.xml fail: true publish: true - coverage-summary-title: "Code Coverage Summary" + coverage-summary-title: 'Code Coverage Summary' togglable-report: true - name: Upload test coverage artifacts uses: actions/upload-artifact@v4 with: - name: Tests coverage artifacts - path: | - ./build/meson-logs/coverage.xml - ./build/meson-logs/coveragereport/ - + name: Tests coverage artifacts + path: | + ./build/meson-logs/coverage.xml + ./build/meson-logs/coveragereport/ - name: Test for leaks with valgrind (Linux) - run: | - valgrind --tool=memcheck --leak-check=full --error-exitcode=1 ./build/example/example r ./tests/files/correct.rec - valgrind --tool=memcheck --leak-check=full --error-exitcode=1 cat ./tests/files/example.rec_text | ./build/example/example w ./test.rec - valgrind --tool=memcheck --leak-check=full --error-exitcode=1 ./build/example/example r ./test.rec + run: | + valgrind --tool=memcheck --leak-check=full --error-exitcode=1 ./build/example/example r ./tests/files/correct.rec + valgrind --tool=memcheck --leak-check=full --error-exitcode=1 cat ./tests/files/example.rec_text | ./build/example/example w ./test.rec + valgrind --tool=memcheck --leak-check=full --error-exitcode=1 ./build/example/example r ./test.rec From 0632e9045ec5f911cf6ae0798946627e43657490 Mon Sep 17 00:00:00 2001 From: Totto16 Date: Tue, 1 Oct 2024 20:18:44 +0200 Subject: [PATCH 2/2] ci: update to llvm 19 also fix macos error in CI --- .github/patches/gcc_14_2.diff | 47 +++++++++++++++++++++++++++++++++++ .github/workflows/build.yml | 44 +++++++++++++++++++++++++------- .github/workflows/test.yml | 10 ++++---- 3 files changed, 87 insertions(+), 14 deletions(-) create mode 100644 .github/patches/gcc_14_2.diff diff --git a/.github/patches/gcc_14_2.diff b/.github/patches/gcc_14_2.diff new file mode 100644 index 0000000..9a81651 --- /dev/null +++ b/.github/patches/gcc_14_2.diff @@ -0,0 +1,47 @@ +From c9e05b03c18e898be604ab90401476e9c473cc52 Mon Sep 17 00:00:00 2001 +From: Jonathan Wakely +Date: Thu, 16 May 2024 17:15:55 +0100 +Subject: [PATCH] libstdc++: Fix typo in _Grapheme_cluster_view::_Iterator + [PR115119] + +libstdc++-v3/ChangeLog: + + PR libstdc++/115119 + * include/bits/unicode.h (_Iterator::operator++(int)): Fix typo + in increment expression. + * testsuite/ext/unicode/grapheme_view.cc: Check post-increment + on view's iterator. + + Source: https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=c9e05b03c18e898be604ab90401476e9c473cc52 + Modified paths, to make it work +--- + bits/unicode.h | 6 ++++-- + 1 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/bits/unicode.h b/bits/unicode.h +index 46238143fb61..a14a17c5dfcf 100644 +--- a/bits/unicode.h ++++ b/bits/unicode.h +@@ -34,10 +34,12 @@ + #include + #include // bit_width + #include // __detail::__from_chars_alnum_to_val_table ++#include + #include + #include + #include +-#include ++#include // iterator_t, sentinel_t, input_range, etc. ++#include // view_interface + + namespace std _GLIBCXX_VISIBILITY(default) + { +@@ -802,7 +804,7 @@ inline namespace __v15_1_0 + operator++(int) + { + auto __tmp = *this; +- ++this; ++ ++*this; + return __tmp; + } + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83722f2..b2e88da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -108,16 +108,31 @@ jobs: mingw-w64-${{matrix.config.architecture}}-cmake git - - name: Setup Clang (Linux) - if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true + - name: Setup Clang (Linux) (libc++) + if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 18 - sudo apt-get install libc++-18* libc++abi*18* -y --no-install-recommends - echo "CC=clang-18" >> "$GITHUB_ENV" - echo "CXX=clang++-18" >> "$GITHUB_ENV" - echo "OBJC=clang-18" >> "$GITHUB_ENV" + sudo ./llvm.sh 19 + sudo apt-get install libc++-19* libc++abi*19* -y --no-install-recommends + echo "CC=clang-19" >> "$GITHUB_ENV" + echo "CXX=clang++-19" >> "$GITHUB_ENV" + echo "OBJC=clang-19" >> "$GITHUB_ENV" + + - name: Setup Clang (Linux) (libstdc++) + if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && (! matrix.config.use-clang_stdlib) + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 19 + echo "CC=clang-19" >> "$GITHUB_ENV" + echo "CXX=clang++-19" >> "$GITHUB_ENV" + echo "OBJC=clang-19" >> "$GITHUB_ENV" + # Patch the libstd++ library, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115119 + # This is a dirty workaround, but it is needed, since gcc 14.2 (where this was patched usptream) is not easily available + # If we use the oracular (Ubuntu 24.10) repos, we could install gcc 14.2, but clang-19 isn't compatible with that + # TODO: remove this, after it works again + sudo patch -p1 /usr/include/c++/14/bits/unicode.h .github/patches/gcc_14_2.diff - name: Setup GCC (Linux) if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == false @@ -130,7 +145,8 @@ jobs: if: matrix.config.os == 'macos' run: | brew update - brew install llvm@18 + # TODO annotate with lld@19, after that is accepted, we don't want to use lld@20 without manually updating it ! + brew install llvm@19 lld echo "$(brew --prefix)/opt/llvm/bin" >> $GITHUB_PATH echo "LDFLAGS=-L$(brew --prefix)/opt/llvm/lib -L$(brew --prefix)/opt/llvm/lib/c++ -Wl,-rpath,$(brew --prefix)/opt/llvm/lib/c++" >> "$GITHUB_ENV" echo "CPPFLAGS=-I$(brew --prefix)/opt/llvm/include" >> "$GITHUB_ENV" @@ -141,6 +157,16 @@ jobs: echo "CXX_LD=lld" >> "$GITHUB_ENV" echo "OBJC_LD=lld" >> "$GITHUB_ENV" + - name: Unbreak Python in GHA (MacOS 13 image) + if: matrix.config.os == 'macos' && matrix.config.os-version == 13 + run: | + # TODO: remove this, after it works again + # A workaround for "The `brew link` step did not complete successfully" error. + # See e.g. https://github.com/Homebrew/homebrew-core/issues/165793#issuecomment-1991817938 + find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete + sudo rm -rf /Library/Frameworks/Python.framework/ + brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3 + - name: Setup meson (MacOS) if: matrix.config.os == 'macos' run: | @@ -167,7 +193,7 @@ jobs: choco install pkgconfiglite echo "PKG_CONFIG_PATH=C:/lib/pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append - - name: Configure + - name: Configure OOPetris run: | cd oopetris meson setup build -Dbuildtype=release -Ddefault_library=static -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }} -Donly_build_libs=true ${{ matrix.config.os == 'windows' && '-Db_vscrt=from_buildtype' || '' }} ${{ (matrix.config.os == 'windows' && ( matrix.config.environment == 'mingw' || matrix.config.environment == 'ucrt' )) && '-Dprefix=$RUNNER_TEMP/msys64${MINGW_PREFIX}/' || ''}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 38c644f..791f23b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,10 +28,10 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 18 - sudo apt-get install libc++-18* libc++abi*18* llvm-18 -y --no-install-recommends - echo "CC=clang-18" >> "$GITHUB_ENV" - echo "CXX=clang++-18" >> "$GITHUB_ENV" + sudo ./llvm.sh 19 + sudo apt-get install libc++-19* libc++abi*19* llvm-19 -y --no-install-recommends + echo "CC=clang-19" >> "$GITHUB_ENV" + echo "CXX=clang++-19" >> "$GITHUB_ENV" # NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! - name: Setup meson @@ -43,7 +43,7 @@ jobs: sudo apt-get update sudo apt-get install ninja-build valgrind gcovr libcriterion-dev libreadline-dev -y --no-install-recommends - - name: Configure + - name: Configure OOPetris run: | cd oopetris meson setup build -Db_coverage=true -Dbuildtype=debugoptimized -Ddefault_library=shared -Dclang_libcpp=enabled -Donly_build_libs=true -Dprefix=/usr