Skip to content

Commit

Permalink
Draft: CI: Use CMakePresets.json
Browse files Browse the repository at this point in the history
Move some of the CI setup into the CMakePresets.json setup.
This should make it more clear that there is no magic going, and
we are just testing many different CMake configurations with corrosion.
  • Loading branch information
jschwe committed Sep 16, 2023
1 parent 104266d commit 3914c10
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 10 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ jobs:
- i686
- aarch64
include:
- os: windows-2019
vs_version: vs-2019
- os: windows-2022
vs_version: vs-2022
- rust: 1.54.0
# Override rust version for x86_64
- arch: x86_64
Expand All @@ -152,6 +156,17 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install CMake
uses: corrosion-rs/install-cmake@v2
with:
cmake: ${{ matrix.cmake }}
ninja: 1.10.0
- name: Install Rust
id: install_rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
targets: ${{matrix.arch}}-pc-windows-msvc
# The initial configure for MSVC is quite slow, so we cache the build directory
# (including the build directories of the tests) since reconfiguring is
# significantly faster.
Expand All @@ -161,16 +176,8 @@ jobs:
with:
path: build
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.rust }}-msvc-build
- name: Setup Environment and Configure CMake
uses: "./.github/actions/setup_test"
with:
target_arch: ${{matrix.arch}}
abi: msvc
cmake: ${{matrix.cmake}}
rust: ${{matrix.rust}}
generator: default
build_dir: build
configure_params: "-DCORROSION_TESTS_KEEP_BUILDDIRS=ON"
- name: New configure
run: cmake -S. -Bbuild -DCORROSION_TESTS_KEEP_BUILDDIRS=ON "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "${{ matrix.vs_version }}-${{ matrix.arch }}"
- name: Run Tests
working-directory: build
run: ctest --output-on-failure --build-config Debug -j 3
Expand Down
179 changes: 179 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"patch": 0
},
"configurePresets": [
{
"name": "ninja",
"hidden": true,
"generator": "Ninja"
},
{
"name": "ninja-mc",
"hidden": true,
"generator": "Ninja Multi-Config"
},
{
"name": "make",
"hidden": true,
"generator": "Unix Makefiles"
},
{
"name": "vs-2019",
"hidden": true,
"generator": "Visual Studio 16 2019"
},
{
"name": "vs-2022",
"hidden": true,
"generator": "Visual Studio 17 2022"
},
{
"name": "windows-only",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "windows-10-cross",
"hidden": true,
"cacheVariables": {
"CMAKE_SYSTEM_NAME": "Windows",
"CMAKE_SYSTEM_VERSION": "10.0"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "x86_64-pc-windows-msvc",
"hidden": true,
"inherits": ["windows-only"],
"cacheVariables": {
"Rust_CARGO_TARGET": "x86_64-pc-windows-msvc"
}
},
{
"name": "i686-pc-windows-msvc",
"hidden": true,
"cacheVariables": {
"Rust_CARGO_TARGET": "i686-pc-windows-msvc"
}
},
{
"name": "aarch64-pc-windows-msvc",
"hidden": true,
"cacheVariables": {
"Rust_CARGO_TARGET": "aarch64-pc-windows-msvc"
}
},
{
"name": "x86_64-pc-windows-gnu",
"hidden": true,
"inherits": ["windows-only"],
"cacheVariables": {
"Rust_CARGO_TARGET": "x86_64-pc-windows-gnu"
}
},
{
"name": "vs-platform-arm64",
"hidden": true,
"inherits": ["aarch64-pc-windows-msvc","windows-10-cross"],
"architecture": {
"value": "ARM64"
}
},
{
"name": "vs-platform-x64",
"hidden": true,
"inherits": ["x86_64-pc-windows-msvc"],
"architecture": {
"value": "x64"
}
},
{
"name": "vs-platform-i686",
"hidden": true,
"inherits": ["i686-pc-windows-msvc", "windows-10-cross"],
"architecture": {
"value": "Win32"
}
},
{
"name": "vs-2019-x86_64",
"inherits": ["vs-platform-x64", "vs-2019"]
},
{
"name": "vs-2022-x86_64",
"inherits": ["vs-platform-x64", "vs-2022"]
},
{
"name": "vs-2019-i686",
"inherits": ["vs-platform-i686", "vs-2019"]
},
{
"name": "vs-2022-i686",
"inherits": ["vs-platform-i686", "vs-2022"]
},
{
"name": "vs-2019-aarch64",
"inherits": ["vs-platform-arm64", "vs-2019"]
},
{
"name": "vs-2022-aarch64",
"inherits": ["vs-platform-arm64", "vs-2022"]
},
{
"name": "_compiler",
"hidden": true,
"cacheVariables": {
"CMAKE_C_COMPILER": "${presetName}",
"CMAKE_CXX_COMPILER": "${presetName}"
}
},
{
"name": "clang",
"hidden": true,
"inherits": ["_compiler"]
},
{
"name": "clang-cl",
"hidden": true,
"inherits": ["_compiler"]
},
{
"name": "cl",
"hidden": true,
"inherits": ["_compiler"]
},
{
"name": "gcc",
"hidden": true,
"inherits": ["_compiler"]
},
{
"name": "ninja-x86_64-pc-windows-msvc-cl",
"inherits": ["ninja", "x86_64-pc-windows-msvc", "cl"]
},
{
"name": "ninja-x86_64-pc-windows-msvc-clang-cl",
"inherits": ["ninja", "x86_64-pc-windows-msvc", "clang-cl"]
},
{
"name": "ninja-x86_64-pc-windows-gnu-clang",
"inherits": ["ninja", "x86_64-pc-windows-gnu", "clang"]
},
{
"name": "ninja-x86_64-pc-windows-gnu-gcc",
"inherits": ["ninja", "x86_64-pc-windows-gnu", "gcc"]
}
]
}

0 comments on commit 3914c10

Please sign in to comment.