From 0cd9b899507561150e2a62be01dce8a0ccee218b Mon Sep 17 00:00:00 2001 From: Alex Tsvetanov Date: Tue, 29 Apr 2025 23:28:16 +0300 Subject: [PATCH 1/4] Trying to improve CI --- .github/workflows/ci.yaml | 195 ++++++++++++++++++++++---------------- .gitignore | 2 +- 2 files changed, 116 insertions(+), 81 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e240f92..f0456c1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,96 +2,131 @@ name: CI on: push: - branches: - - main + branches: [main] pull_request: - branches: - - main + branches: [main] jobs: - build: + + linux: strategy: fail-fast: false matrix: - os: - [ - ubuntu-22.04, - ubuntu-24.04, - macos-13, - macos-14, - macos-15, - windows-2019, - windows-2022, - ] - c_compiler: [gcc, clang] + os: [ubuntu-22.04, ubuntu-24.04] + compiler: [gcc, clang] generator: [Ninja, "Unix Makefiles"] - include: - # MSVC is only available on Windows - - os: windows-2019 - c_compiler: cl - cxx_compiler: cl - generator: "Visual Studio 17 2022" - generator-code: vs2022 - - os: windows-2022 - c_compiler: cl - cxx_compiler: cl - generator: "Visual Studio 17 2022" - generator-code: vs2022 - - c_compiler: clang - cxx_compiler: clang++ - - c_compiler: gcc - cxx_compiler: g++ - - generator: Ninja - generator-code: ninja - - generator: "Unix Makefiles" - generator-code: make runs-on: ${{ matrix.os }} - name: ${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.generator-code }} - + name: Linux-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.generator }} steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install dependencies (Ubuntu) - if: ${{ startsWith(matrix.os, 'ubuntu') }} - run: | - sudo apt-get install -y software-properties-common - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get update - sudo apt-get install -y cmake ninja-build gcc-12 g++-12 llvm - - # Set gcc and g++ version 12 as default - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 60 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 60 - - - name: Install dependencies (macOS) - if: ${{ startsWith(matrix.os, 'macos') }} - run: | - brew install llvm ninja cmake - - - name: Install dependencies (Windows) - if: ${{ startsWith(matrix.os, 'windows') }} - run: | - choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y - choco install mingw llvm ninja -y + - uses: actions/checkout@v4 + - run: | + sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" 17 all + sudo apt install -y cmake ninja-build ccache libomp-17-dev + echo "CC=${{ matrix.compiler }}" >> $GITHUB_ENV + if [[ "${{ matrix.compiler }}" == "gcc" ]]; then + echo "CXX=g++" >> $GITHUB_ENV + else + echo "CXX=clang++" >> $GITHUB_ENV + fi + echo "LDFLAGS=-L/usr/lib/llvm-17/lib" >> $GITHUB_ENV + echo "CPPFLAGS=-I/usr/lib/llvm-17/include" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + path: build + key: linux-${{ matrix.compiler }}-${{ matrix.generator }}-build-${{ github.sha }} + restore-keys: linux-${{ matrix.compiler }}-${{ matrix.generator }}-build- + - uses: actions/cache@v4 + with: + path: ~/.ccache + key: linux-${{ matrix.compiler }}-${{ matrix.generator }}-ccache-${{ github.sha }} + restore-keys: linux-${{ matrix.compiler }}-${{ matrix.generator }}-ccache- + - run: | + cmake -S . -B build -G "${{ matrix.generator }}" \ + -DCMAKE_C_COMPILER=${{ env.CC }} \ + -DCMAKE_CXX_COMPILER=${{ env.CXX }} \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + - run: cmake --build build --config Release --verbose + - run: ctest --test-dir build --output-on-failure - - name: Configure CMake - if: ${{ matrix.cxx_compiler == 'cl' }} - run: | - cmake -S . -B build -A x64 -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + mac: + strategy: + fail-fast: false + matrix: + os: [macos-13, macos-14, macos-15] + generator: [Ninja, "Unix Makefiles"] + runs-on: ${{ matrix.os }} + name: macOS-${{ matrix.os }}-${{ matrix.generator }} + steps: + - uses: actions/checkout@v4 + - run: | + brew install llvm libomp cmake ninja ccache + echo "PATH=/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/ccache/libexec:$PATH" >> $GITHUB_ENV + echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV + echo "CPPFLAGS=-I/opt/homebrew/opt/libomp/include -I/opt/homebrew/opt/llvm/include" >> $GITHUB_ENV + echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp;/opt/homebrew/opt/llvm" >> $GITHUB_ENV + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + path: build + key: mac-${{ matrix.generator }}-build-${{ github.sha }} + restore-keys: mac-${{ matrix.generator }}-build- + - uses: actions/cache@v4 + with: + path: ~/.ccache + key: mac-${{ matrix.generator }}-ccache-${{ github.sha }} + restore-keys: mac-${{ matrix.generator }}-ccache- + - run: | + cmake -S . -B build -G "${{ matrix.generator }}" \ + -DCMAKE_C_COMPILER=${{ env.CC }} \ + -DCMAKE_CXX_COMPILER=${{ env.CXX }} \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + - run: cmake --build build --config Release --verbose + - run: ctest --test-dir build --output-on-failure - - name: Configure CMake - if: ${{ matrix.cxx_compiler != 'cl' }} - run: | - cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + windows: + strategy: + fail-fast: false + matrix: + os: [windows-2019, windows-2022] + runs-on: ${{ matrix.os }} + name: Windows-${{ matrix.os }}-MSVC + steps: + - uses: actions/checkout@v4 + - run: choco install cmake ninja ccache -y + - run: cmake -S . -B build -A x64 + - run: cmake --build build --config Release --verbose + - run: ctest --test-dir build --output-on-failure - - name: Build Project - id: build_project - continue-on-error: true - run: | - cmake --build build --config Release > compile.log 2>&1 + windows-alt: + strategy: + fail-fast: false + matrix: + os: [windows-2019, windows-2022] + compiler: [mingw, llvm] + generator: [Ninja, "Unix Makefiles"] + runs-on: ${{ matrix.os }} + name: Windows-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.generator }} + steps: + - uses: actions/checkout@v4 + - run: | + choco install cmake ninja ccache llvm mingw -y + echo "CC=${{ matrix.compiler }}" >> $GITHUB_ENV + if [[ "${{ matrix.compiler }}" == "mingw" ]]; then + echo "CXX=g++" >> $GITHUB_ENV + else + echo "CXX=clang++" >> $GITHUB_ENV + fi + shell: bash + - run: | + cmake -S . -B build -G "${{ matrix.generator }}" \ + -DCMAKE_C_COMPILER=${{ env.CC }} \ + -DCMAKE_CXX_COMPILER=${{ env.CXX }} \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + shell: bash + - run: cmake --build build --config Release --verbose + - run: ctest --test-dir build --output-on-failure - - name: Run tests - if: ${{ steps.build_project.outcome == 'success' }} - run: | - ctest -C Release --test-dir build/tests diff --git a/.gitignore b/.gitignore index ef39239..b102568 100644 --- a/.gitignore +++ b/.gitignore @@ -363,7 +363,7 @@ MigrationBackup/ FodyWeavers.xsd # build folder -build/ +build*/ # VSCode config .vscode/ From faff908c4413bdafa1e8f31cd1a205f86fd515d3 Mon Sep 17 00:00:00 2001 From: Alex Tsvetanov Date: Tue, 29 Apr 2025 23:32:06 +0300 Subject: [PATCH 2/4] Update ci.yaml --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f0456c1..7f7efce 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v4 - run: | sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" 17 all - sudo apt install -y cmake ninja-build ccache libomp-17-dev + sudo apt install -y cmake ninja-build ccache libomp-dev echo "CC=${{ matrix.compiler }}" >> $GITHUB_ENV if [[ "${{ matrix.compiler }}" == "gcc" ]]; then echo "CXX=g++" >> $GITHUB_ENV From c64d1b6a605b674c0e28b44e364e8b9853c90e97 Mon Sep 17 00:00:00 2001 From: Alex Tsvetanov Date: Wed, 30 Apr 2025 00:26:52 +0300 Subject: [PATCH 3/4] Update ci.yaml --- .github/workflows/ci.yaml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7f7efce..22069d6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -61,10 +61,11 @@ jobs: - uses: actions/checkout@v4 - run: | brew install llvm libomp cmake ninja ccache - echo "PATH=/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/ccache/libexec:$PATH" >> $GITHUB_ENV - echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/llvm/lib" >> $GITHUB_ENV - echo "CPPFLAGS=-I/opt/homebrew/opt/libomp/include -I/opt/homebrew/opt/llvm/include" >> $GITHUB_ENV - echo "CMAKE_PREFIX_PATH=/opt/homebrew/opt/libomp;/opt/homebrew/opt/llvm" >> $GITHUB_ENV + HOMEBREW_PREFIX=$(brew --prefix) + echo "PATH=${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/opt/llvm/bin:$PATH" >> $GITHUB_ENV + echo "LDFLAGS=-L${HOMEBREW_PREFIX}/opt/libomp/lib -L${HOMEBREW_PREFIX}/opt/llvm/lib" >> $GITHUB_ENV + echo "CPPFLAGS=-I${HOMEBREW_PREFIX}/opt/libomp/include -I${HOMEBREW_PREFIX}/opt/llvm/include" >> $GITHUB_ENV + echo "CMAKE_PREFIX_PATH=${HOMEBREW_PREFIX}/opt/libomp;${HOMEBREW_PREFIX}/opt/llvm" >> $GITHUB_ENV echo "CC=clang" >> $GITHUB_ENV echo "CXX=clang++" >> $GITHUB_ENV - uses: actions/cache@v4 @@ -112,7 +113,8 @@ jobs: steps: - uses: actions/checkout@v4 - run: | - choco install cmake ninja ccache llvm mingw -y + choco install cmake ninja ccache llvm -y + choco install mingw --version=12.2.0 echo "CC=${{ matrix.compiler }}" >> $GITHUB_ENV if [[ "${{ matrix.compiler }}" == "mingw" ]]; then echo "CXX=g++" >> $GITHUB_ENV @@ -127,6 +129,12 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache shell: bash + - name: Add MinGW to PATH (Windows) + shell: bash + run: | + echo "C:/mingw64/bin" >> $GITHUB_PATH + echo "C:/mingw64/lib" >> $GITHUB_PATH + cp "C:/mingw64/bin/libgomp-1.dll" build/tests/ - run: cmake --build build --config Release --verbose - run: ctest --test-dir build --output-on-failure From 91c30ef57e95b6bfb0f6343152776cf1920f66b4 Mon Sep 17 00:00:00 2001 From: Alex Tsvetanov Date: Wed, 30 Apr 2025 00:51:44 +0300 Subject: [PATCH 4/4] Update ci.yaml --- .github/workflows/ci.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 22069d6..f11b00b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,6 +55,8 @@ jobs: matrix: os: [macos-13, macos-14, macos-15] generator: [Ninja, "Unix Makefiles"] + exclude: + - os: macos-13 runs-on: ${{ matrix.os }} name: macOS-${{ matrix.os }}-${{ matrix.generator }} steps: @@ -91,7 +93,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2019, windows-2022] + os: [windows-2022] runs-on: ${{ matrix.os }} name: Windows-${{ matrix.os }}-MSVC steps: @@ -108,6 +110,9 @@ jobs: os: [windows-2019, windows-2022] compiler: [mingw, llvm] generator: [Ninja, "Unix Makefiles"] + exclude: + - os: windows-2019 + compiler: mingw runs-on: ${{ matrix.os }} name: Windows-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.generator }} steps: @@ -135,6 +140,10 @@ jobs: echo "C:/mingw64/bin" >> $GITHUB_PATH echo "C:/mingw64/lib" >> $GITHUB_PATH cp "C:/mingw64/bin/libgomp-1.dll" build/tests/ - - run: cmake --build build --config Release --verbose + - name: Build + shell: bash + run: | + export PATH="/c/mingw64/bin:$PATH" + cmake --build build --config Release --verbose - run: ctest --test-dir build --output-on-failure