Create coderabbitai&bearycoolpermissionsprotocol.yml #420
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Combined CMake Workflows | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
######################################################################## | |
# 1) devcontainer-cosmos | |
# Multi-Platform with .devcontainer Root & Cosmos SDK demonstration. | |
######################################################################## | |
devcontainer-cosmos: | |
name: devcontainer-cosmos | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
build_type: [Release] | |
c_compiler: [gcc, clang, cl] | |
include: | |
# Windows + MSVC | |
- os: windows-latest | |
c_compiler: cl | |
cpp_compiler: cl | |
# Ubuntu + GCC | |
- os: ubuntu-latest | |
c_compiler: gcc | |
cpp_compiler: g++ | |
# Ubuntu + Clang | |
- os: ubuntu-latest | |
c_compiler: clang | |
cpp_compiler: clang++ | |
exclude: | |
- os: windows-latest | |
c_compiler: gcc | |
- os: windows-latest | |
c_compiler: clang | |
- os: ubuntu-latest | |
c_compiler: cl | |
runs-on: ${{ matrix.os }} | |
# For Ubuntu-latest, run inside the devcontainer Docker image (fake “2025”). | |
# Windows-latest cannot run container jobs, so it’s ignored there. | |
container: | |
image: .devcontainer/devcontainer2025:latest | |
credentials: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ (matrix.os == 'ubuntu-latest') && '.devcontainer/build' || 'build' }} | |
key: ${{ runner.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}-${{ hashFiles('.devcontainer/CMakeLists.txt') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }} | |
- name: Configure CMake | |
run: | | |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
cmake -S .devcontainer \ | |
-B .devcontainer/build \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
else | |
cmake -S . \ | |
-B build \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
- name: Build | |
run: | | |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
cmake --build .devcontainer/build --config ${{ matrix.build_type }} | |
else | |
cmake --build build --config ${{ matrix.build_type }} | |
- name: Test | |
run: | | |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
cd .devcontainer/build | |
ctest --build-config ${{ matrix.build_type }} | |
else | |
cd build | |
ctest --build-config ${{ matrix.build_type }} | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }} | |
path: ${{ (matrix.os == 'ubuntu-latest') && '.devcontainer/build' || 'build' }} | |
######################################################################## | |
# 2) devcontainer-minimal | |
# CMake on multiple platforms with .devcontainer as the root directory | |
# (simpler approach, no advanced container logic). | |
######################################################################## | |
devcontainer-minimal: | |
name: devcontainer-minimal | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
build_type: [Release] | |
c_compiler: [gcc, clang, cl] | |
include: | |
- os: windows-latest | |
c_compiler: cl | |
cpp_compiler: cl | |
- os: ubuntu-latest | |
c_compiler: gcc | |
cpp_compiler: g++ | |
- os: ubuntu-latest | |
c_compiler: clang | |
cpp_compiler: clang++ | |
exclude: | |
- os: windows-latest | |
c_compiler: gcc | |
- os: windows-latest | |
c_compiler: clang | |
- os: ubuntu-latest | |
c_compiler: cl | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.devcontainer/build | |
key: ${{ runner.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}-${{ hashFiles('.devcontainer/CMakeLists.txt') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }} | |
- name: Configure CMake | |
run: | | |
cmake -S .devcontainer \ | |
-B .devcontainer/build \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
- name: Build | |
run: cmake --build .devcontainer/build --config ${{ matrix.build_type }} | |
- name: Test | |
working-directory: .devcontainer/build | |
run: ctest --build-config ${{ matrix.build_type }} | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }} | |
path: .devcontainer/build | |
######################################################################## | |
# 3) cmake-starter-3configs | |
# Standard CMake on multiple platforms from the original starter workflow. | |
######################################################################## | |
cmake-starter-3configs: | |
name: cmake-starter-3configs | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
build_type: [Release] | |
c_compiler: [gcc, clang, cl] | |
include: | |
- os: windows-latest | |
c_compiler: cl | |
cpp_compiler: cl | |
- os: ubuntu-latest | |
c_compiler: gcc | |
cpp_compiler: g++ | |
- os: ubuntu-latest | |
c_compiler: clang | |
cpp_compiler: clang++ | |
exclude: | |
- os: windows-latest | |
c_compiler: gcc | |
- os: windows-latest | |
c_compiler: clang | |
- os: ubuntu-latest | |
c_compiler: cl | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
run: | | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-S ${{ github.workspace }} | |
- name: Build | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} | |
- name: Test | |
working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
run: ctest --build-config ${{ matrix.build_type }} |