diff --git a/.github/workflows/clang-libcpp.yml b/.github/workflows/clang-libcpp.yml new file mode 100644 index 0000000..9516ddc --- /dev/null +++ b/.github/workflows/clang-libcpp.yml @@ -0,0 +1,47 @@ +name: Clang (libc++) + +on: + push: + paths-ignore: + - 'doc/**' + branches: [ main ] + pull_request: + paths-ignore: + - 'doc/**' + branches: [ main ] + +jobs: + build: + name: Clang 21 libc++ -x- ${{ matrix.config }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + config: [Debug, Release] + + steps: + - uses: actions/checkout@v4 + + - name: Install Clang 21 and libc++ + run: | + # https://github.com/actions/runner-images/issues/7192 + echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates + sudo apt-get update && sudo apt-get -y upgrade --fix-missing + sudo apt-get install -y build-essential cmake ninja-build + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc + sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-21 main" + sudo apt-get update + sudo apt-get install -y clang-21 libc++-21-dev libc++abi-21-dev + + - name: Configure + run: > + cmake -S . -B build -G Ninja + -DCMAKE_CXX_COMPILER=clang++-21 + -DCMAKE_BUILD_TYPE=${{ matrix.config }} + -DCMAKE_CXX_FLAGS=-stdlib=libc++ + + - name: Build + run: cmake --build build --parallel --config ${{ matrix.config }} + + - name: Test + run: ctest --test-dir build --output-on-failure diff --git a/.github/workflows/clang-libstdcpp.yml b/.github/workflows/clang-libstdcpp.yml new file mode 100644 index 0000000..b3dfdda --- /dev/null +++ b/.github/workflows/clang-libstdcpp.yml @@ -0,0 +1,46 @@ +name: Clang (libstdc++) + +on: + push: + paths-ignore: + - 'doc/**' + branches: [ main ] + pull_request: + paths-ignore: + - 'doc/**' + branches: [ main ] + +jobs: + build: + name: Clang 21 libstdc++ -x- ${{ matrix.config }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + config: [Debug, Release] + + steps: + - uses: actions/checkout@v4 + + - name: Install Clang 21 + run: | + # https://github.com/actions/runner-images/issues/7192 + echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates + sudo apt-get update && sudo apt-get -y upgrade --fix-missing + sudo apt-get install -y build-essential cmake ninja-build + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc + sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-21 main" + sudo apt-get update + sudo apt-get install -y clang-21 + + - name: Configure + run: > + cmake -S . -B build -G Ninja + -DCMAKE_CXX_COMPILER=clang++-21 + -DCMAKE_BUILD_TYPE=${{ matrix.config }} + + - name: Build + run: cmake --build build --parallel --config ${{ matrix.config }} + + - name: Test + run: ctest --test-dir build --output-on-failure diff --git a/.github/workflows/clang-macos.yml b/.github/workflows/clang-macos.yml new file mode 100644 index 0000000..7865514 --- /dev/null +++ b/.github/workflows/clang-macos.yml @@ -0,0 +1,41 @@ +name: Clang (macOS) + +on: + push: + paths-ignore: + - 'doc/**' + branches: [ main ] + pull_request: + paths-ignore: + - 'doc/**' + branches: [ main ] + +jobs: + build: + name: Clang (Homebrew) -x- ${{ matrix.config }} + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + config: [Debug, Release] + + steps: + - uses: actions/checkout@v4 + + - name: Install LLVM and CMake + run: | + brew install llvm cmake ninja + echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH + + - name: Configure + run: > + cmake -S . -B build -G Ninja + -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ + -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) + -DCMAKE_BUILD_TYPE=${{ matrix.config }} + + - name: Build + run: cmake --build build --parallel --config ${{ matrix.config }} + + - name: Test + run: ctest --test-dir build --output-on-failure diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml new file mode 100644 index 0000000..1619e43 --- /dev/null +++ b/.github/workflows/gcc.yml @@ -0,0 +1,45 @@ +name: GCC + +on: + push: + paths-ignore: + - 'doc/**' + branches: [ main ] + pull_request: + paths-ignore: + - 'doc/**' + branches: [ main ] + +jobs: + build: + name: GCC 15 -x- ${{ matrix.config }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + config: [Debug, Release] + + steps: + - uses: actions/checkout@v4 + + - name: Install GCC 15 + run: | + # https://github.com/actions/runner-images/issues/7192 + echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates + sudo apt-get update && sudo apt-get -y upgrade --fix-missing + sudo apt-get install -y build-essential cmake ninja-build + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install -y g++-15 + + - name: Configure + run: > + cmake -S . -B build -G Ninja + -DCMAKE_CXX_COMPILER=g++-15 + -DCMAKE_BUILD_TYPE=${{ matrix.config }} + + - name: Build + run: cmake --build build --parallel --config ${{ matrix.config }} + + - name: Test + run: ctest --test-dir build --output-on-failure diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 6648ae0..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,141 +0,0 @@ -name: Build & Test - -on: - push: - paths-ignore: - - 'doc/**' - branches: [ main ] - pull_request: - paths-ignore: - - 'doc/**' - branches: [ main ] - -jobs: - # For linux runners - build-on-linux: - name: Linux -x- ${{ matrix.name }} -x- ${{ matrix.config }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - config: [Debug, Release] - name: [gcc-15, clang-21-libstdc++, clang-21-libc++] - include: - - name: gcc-15 - compiler: g++-15 - install: | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install -y g++-15 - cmake_extra: "" - - name: clang-21-libstdc++ - compiler: clang++-21 - install: | - wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-21 main" - sudo apt-get update - sudo apt-get install -y clang-21 - cmake_extra: "" - - name: clang-21-libc++ - compiler: clang++-21 - install: | - wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-21 main" - sudo apt-get update - sudo apt-get install -y clang-21 libc++-21-dev libc++abi-21-dev - cmake_extra: "-DCMAKE_CXX_FLAGS=-stdlib=libc++" - - steps: - - uses: actions/checkout@v4 - - - name: Install C++ compilers and tools - run: | - # https://github.com/actions/runner-images/issues/7192 - echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates - sudo apt-get update && sudo apt-get -y upgrade --fix-missing - sudo apt-get install -y build-essential cmake ninja-build - ${{ matrix.install }} - - - name: Configure - run: > - cmake -S . -B build -G Ninja - -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} - -DCMAKE_BUILD_TYPE=${{ matrix.config }} - ${{ matrix.cmake_extra }} - - - name: Build - run: cmake --build build --parallel --config ${{ matrix.config }} - - - name: Test - run: ctest --test-dir build --output-on-failure - - # For macOS runners - build-on-macos: - name: macOS -x- Clang (Homebrew) -x- ${{ matrix.config }} - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - config: [Debug, Release] - - steps: - - uses: actions/checkout@v4 - - - name: Install LLVM and CMake - run: | - brew install llvm cmake ninja - echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH - - - name: Configure - run: > - cmake -S . -B build -G Ninja - -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ - -DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) - -DCMAKE_BUILD_TYPE=${{ matrix.config }} - - - name: Build - run: cmake --build build --parallel --config ${{ matrix.config }} - - - name: Test - run: ctest --test-dir build --output-on-failure - - # For Windows runners - build-on-windows: - name: Windows -x- MSVC Preview -x- ${{ matrix.config }} - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - config: [Debug, Release] - - steps: - - uses: actions/checkout@v4 - - - name: Install MSVC Build Tools Preview - shell: pwsh - run: | - $url = "https://aka.ms/vs/18/insiders/vs_buildtools.exe" - Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\vs_buildtools.exe" -UseBasicParsing - $process = Start-Process -Wait -PassThru -FilePath "$env:TEMP\vs_buildtools.exe" ` - -ArgumentList "--quiet --wait --norestart --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.26100 --add Microsoft.VisualStudio.Component.VC.CMake.Project --includeRecommended" - $exitCode = $process.ExitCode - Write-Output "VS installer exit code: $exitCode" - if ($exitCode -notin 0,3010,3015) { throw "VS Installer failed: $exitCode" } - - - name: Set up MSVC environment - uses: ilammy/msvc-dev-cmd@v1 - with: - vsversion: '18' - - - name: Configure - shell: pwsh - run: > - cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.config }} - - - name: Build - shell: pwsh - run: cmake --build build --parallel --config ${{ matrix.config }} - - - name: Test - shell: pwsh - run: ctest --test-dir build --output-on-failure diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml new file mode 100644 index 0000000..d260a7f --- /dev/null +++ b/.github/workflows/msvc.yml @@ -0,0 +1,52 @@ +name: MSVC + +on: + push: + paths-ignore: + - 'doc/**' + branches: [ main ] + pull_request: + paths-ignore: + - 'doc/**' + branches: [ main ] + +jobs: + build: + name: MSVC Preview -x- ${{ matrix.config }} + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + config: [Debug, Release] + + steps: + - uses: actions/checkout@v4 + + - name: Install MSVC Build Tools Preview + shell: pwsh + run: | + $url = "https://aka.ms/vs/18/insiders/vs_buildtools.exe" + Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\vs_buildtools.exe" -UseBasicParsing + $process = Start-Process -Wait -PassThru -FilePath "$env:TEMP\vs_buildtools.exe" ` + -ArgumentList "--quiet --wait --norestart --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.26100 --add Microsoft.VisualStudio.Component.VC.CMake.Project --includeRecommended" + $exitCode = $process.ExitCode + Write-Output "VS installer exit code: $exitCode" + if ($exitCode -notin 0,3010,3015) { throw "VS Installer failed: $exitCode" } + + - name: Set up MSVC environment + uses: ilammy/msvc-dev-cmd@v1 + with: + vsversion: '18' + + - name: Configure + shell: pwsh + run: > + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.config }} + + - name: Build + shell: pwsh + run: cmake --build build --parallel --config ${{ matrix.config }} + + - name: Test + shell: pwsh + run: ctest --test-dir build --output-on-failure diff --git a/README.md b/README.md index ddfe0aa..dfa0c64 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -![Build & Test](https://github.com/GabrielDosReis/ipr/actions/workflows/main.yml/badge.svg) +![MSVC](https://github.com/GabrielDosReis/ipr/actions/workflows/msvc.yml/badge.svg) +![GCC](https://github.com/GabrielDosReis/ipr/actions/workflows/gcc.yml/badge.svg) +![Clang (libstdc++)](https://github.com/GabrielDosReis/ipr/actions/workflows/clang-libstdcpp.yml/badge.svg) +![Clang (libc++)](https://github.com/GabrielDosReis/ipr/actions/workflows/clang-libcpp.yml/badge.svg) +![Clang (macOS)](https://github.com/GabrielDosReis/ipr/actions/workflows/clang-macos.yml/badge.svg) ![Analysis](https://github.com/GabrielDosReis/ipr/actions/workflows/analysis.yml/badge.svg) ![Docs](https://github.com/GabrielDosReis/ipr/actions/workflows/docs.yaml/badge.svg)