CI: Use CMakePresets.json and toolchain files #1029
Workflow file for this run
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: Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- 'master' | |
- 'stable/**' | |
jobs: | |
# test: | |
# name: Test Corrosion | |
# runs-on: ${{ matrix.os }} | |
# continue-on-error: ${{ matrix.rust == 'nightly' }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# os: | |
# - windows-2022 | |
# - ubuntu-latest | |
# - macos-13 | |
# arch: | |
# - x86_64 | |
# - i686 | |
# - aarch64 | |
# - powerpc64le | |
# abi: | |
# - gnu | |
# - darwin | |
# - msvc | |
# cmake: | |
# - 3.22.6 | |
# rust: | |
# - "stable" | |
# generator: | |
# - default # This is just whatever the platform default is | |
# - ninja | |
# compiler: [default] | |
# include: | |
# - rust: nightly | |
# cmake: 3.22.6 | |
# generator: ninja | |
# arch: x86_64 | |
# abi: msvc | |
# os: windows-2022 | |
# - rust: nightly | |
# cmake: 3.22.6 | |
# generator: ninja | |
# arch: x86_64 | |
# abi: gnu | |
# os: ubuntu-latest | |
# - rust: nightly | |
# cmake: 3.22.6 | |
# generator: ninja | |
# arch: x86_64 | |
# abi: darwin | |
# os: macos-13 | |
# - rust: 1.54 | |
# cmake: 3.22.6 | |
# generator: ninja | |
# arch: x86_64 | |
# abi: msvc | |
# os: windows-2019 | |
# compiler: clang | |
# - os: ubuntu-latest | |
# arch: x86_64 | |
# abi: gnu | |
# cmake: 3.22.6 | |
# rust: 1.54 | |
# generator: ninja-multiconfig | |
# | |
# exclude: | |
# | |
# # We have a separate test Matrix for the Visual Studio Generator | |
# - os: windows-2022 | |
# generator: default # Default generator is Visual Studio | |
# | |
# # ARCH | |
# - os: windows-2022 | |
# arch: i686 | |
# abi: gnu | |
# - os: windows-2022 | |
# arch: aarch64 | |
# abi: gnu | |
# - os: windows-2022 | |
# arch: i686 | |
# generator: ninja | |
# - os: windows-2022 | |
# arch: aarch64 | |
# generator: ninja | |
# - os: windows-2022 | |
# arch: powerpc64le | |
# - os: macos-13 | |
# arch: i686 | |
# - os: macos-13 | |
# arch: aarch64 | |
# - os: macos-13 | |
# arch: powerpc64le | |
# | |
# # ABI | |
# - os: ubuntu-latest | |
# abi: msvc | |
# - os: ubuntu-latest | |
# abi: darwin | |
# - os: windows-2022 | |
# abi: darwin | |
# - os: macos-13 | |
# abi: msvc | |
# - os: macos-13 | |
# abi: gnu | |
# | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Setup Environment and Configure CMake | |
# uses: "./.github/actions/setup_test" | |
# with: | |
# target_arch: ${{matrix.arch}} | |
# abi: ${{matrix.abi}} | |
# cmake: ${{matrix.cmake}} | |
# rust: ${{matrix.rust}} | |
# generator: ${{matrix.generator}} | |
# build_dir: build | |
# compiler: ${{matrix.compiler}} | |
# - name: Run Tests | |
# id: run_tests | |
# working-directory: build | |
# run: ctest --output-on-failure --build-config Debug -j 3 | |
visual_studio_base: | |
name: Test Visual Studio (base) | |
uses: ./.github/workflows/visual_studio.yaml | |
with: | |
vs_version: "2022" | |
rust: 1.46.0 | |
visual_studio_stage2: | |
name: Test Visual Studio | |
uses: ./.github/workflows/visual_studio.yaml | |
needs: | |
- visual_studio_base | |
strategy: | |
matrix: | |
vs_version: | |
- "2019" | |
- "2022" | |
arch: | |
- x86_64 | |
- i686 | |
- aarch64 | |
with: | |
vs_version: "${{ matrix.vs_version}}" | |
rust: 1.54.0 | |
target_arch: "${{ matrix.arch}}" | |
windows_ninja_cl: | |
name: Test Windows Ninja MSVC | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-2022 | |
arch: | |
- x86_64 | |
- i686 | |
- aarch64 | |
compiler: | |
- cl | |
- clang-cl | |
include: | |
- os: windows-2022 | |
vs_version: vs-2022 | |
cmake: 3.22.6 | |
- rust: 1.54.0 | |
# Override rust version for x86_64 | |
- arch: x86_64 | |
rust: 1.46.0 | |
# Add variable mapping for ilammy/msvc-dev-cmd action | |
- arch: x86_64 | |
msvc_dev_arch: amd64 | |
- arch: i686 | |
msvc_dev_arch: amd64_x86 | |
- arch: aarch64 | |
msvc_dev_arch: amd64_arm64 | |
exclude: | |
# Not sure what parameters CMake needs when cross-compiling with clang-cl, so exclude for now | |
- compiler: clang-cl | |
arch: i686 | |
- compiler: clang-cl | |
arch: aarch64 | |
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 | |
- name: Setup MSVC Development Environment | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{ matrix.msvc_dev_arch }} | |
- name: New configure | |
run: cmake -S. -Bbuild "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "ninja-${{ matrix.arch }}-pc-windows-msvc-${{ matrix.compiler }}" | |
- name: Run Tests | |
working-directory: build | |
run: ctest --output-on-failure --build-config Debug -j 3 | |
windows_gnu: | |
name: Test Windows GNU | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-2022 | |
arch: | |
- x86_64 | |
# - i686 | |
# - aarch64 | |
compiler: | |
- gcc # Clang only has experimental support for Cygwin / MinGW, so we don't test it | |
generator: | |
- ninja | |
- make | |
include: | |
- cmake: 3.22.6 | |
- rust: 1.54.0 | |
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-gnu | |
- name: New configure | |
run: cmake -S. -Bbuild "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "${{ matrix.generator }}-${{ matrix.arch }}-pc-windows-gnu-${{ matrix.compiler }}" | |
- name: Run Tests | |
working-directory: build | |
run: ctest --output-on-failure --build-config Debug -j 3 | |
linux: # todo: could probably be merged into one action with windows-gnu | |
name: Test Linux | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- x86_64 | |
- i686 | |
- aarch64 | |
compiler: | |
- gcc | |
generator: | |
- "Ninja" | |
- "Unix Makefiles" | |
include: | |
- os: ubuntu-latest | |
- cmake: 3.22.6 | |
- rust: 1.54.0 | |
# rustc doesn't support cross-compiling with clang out of the box, since | |
# clang requires a --target parameter. Corrosion currently can only pass | |
# this for the top-level crate, so linking of cdylibs that are built as | |
# dependencies of this crate will fail if they exist. | |
# Solutions would be to make cross-compiling with clang work out-of-the-box | |
# in rustc, or working around it in corrosion by adding a linker-wrapper. | |
# For this reason we only test clang with the host target for now. | |
- arch: x86_64 | |
compiler: clang | |
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}}-unknown-linux-gnu | |
- name: Install Cross Compiler | |
shell: bash | |
run: | | |
echo "::group::apt-install" | |
sudo apt-get update | |
sudo apt-get install -y "g++-${{matrix.arch}}-linux-gnu" | |
echo "::endgroup::" | |
if: ${{ 'Linux' == runner.os && matrix.arch != 'x86_64' }} | |
- name: New configure | |
run: cmake -S. -Bbuild -G "${{ matrix.generator }}" "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "${{ matrix.arch }}-unknown-linux-gnu-${{ matrix.compiler }}" | |
- name: Run Tests | |
working-directory: build | |
run: ctest --output-on-failure --build-config Debug -j 3 | |
# test_cxxbridge: | |
# name: Test cxxbridge integration | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# os: | |
# - windows-2022 | |
# - ubuntu-latest | |
# - macos-13 | |
# include: | |
# - abi: default | |
# # - os: windows-2019 | |
# # abi: gnu | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/cache@v3 | |
# id: cache_cxxbridge | |
# with: | |
# path: "~/.cargo/bin/cxxbridge*" | |
# key: ${{ runner.os }}-cxxbridge_1_0_86 | |
# - name: Install cxxbridge | |
# if: steps.cache_cxxbridge.outputs.cache-hit != 'true' | |
# run: cargo install [email protected] | |
# - name: Install lld | |
# run: sudo apt update && sudo apt install -y lld | |
# if: ${{ 'Linux' == runner.os }} | |
# - name: Setup Environment and Configure CMake | |
# uses: "./.github/actions/setup_test" | |
# with: | |
# target_arch: x86_64 | |
# cmake: 3.22.6 | |
# rust: stable minus 2 releases | |
# abi: ${{ matrix.abi }} | |
# generator: ninja | |
# build_dir: build | |
# configure_params: -DCORROSION_TESTS_CXXBRIDGE=ON | |
# - name: Run Tests | |
# working-directory: build | |
# run: ctest --output-on-failure --build-config Debug -j 3 -R "^cxxbridge" | |
# install: | |
# name: Test Corrosion as a Library | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# os: | |
# - windows-2019 | |
# - ubuntu-latest | |
# - macos-13 | |
# include: | |
# - rust: 1.46.0 | |
# - os: macos-13 | |
# rust: 1.54.0 # On MacOS-12 linking fails before Rust 1.54 | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Setup MSVC Development Environment | |
# uses: ilammy/msvc-dev-cmd@v1 | |
# if: runner.os == 'Windows' | |
# - name: Install CMake | |
# uses: corrosion-rs/install-cmake@v2 | |
# with: | |
# cmake: 3.22.6 | |
# ninja: 1.10.0 | |
# - name: Install Rust | |
# uses: dtolnay/rust-toolchain@master | |
# with: | |
# toolchain: ${{matrix.rust}} | |
# - name: CMake Version | |
# run: cmake --version | |
# - name: Rust Version | |
# run: rustc --version | |
# - name: Test Corrosion as subdirectory | |
# run: > | |
# cmake | |
# -S. | |
# -Bbuild | |
# -GNinja | |
# -DCORROSION_VERBOSE_OUTPUT=ON | |
# -DCORROSION_TESTS_INSTALL_CORROSION=OFF | |
# && | |
# cd build | |
# && | |
# ctest --output-on-failure -C Debug -j 3 | |
# - name: Test Corrosion as installed module | |
# run: > | |
# cmake -E remove_directory build | |
# && | |
# cmake | |
# -S. | |
# -Bbuild | |
# -GNinja | |
# -DCORROSION_VERBOSE_OUTPUT=ON | |
# -DCMAKE_BUILD_TYPE=Release | |
# -DCORROSION_TESTS_INSTALL_CORROSION=ON | |
# && | |
# cd build | |
# && | |
# ctest --output-on-failure -C Release -j 3 | |
# We want an "accumulation" job here because it is easier to specify required | |
# jobs here via needs, then in the github UI, since we use matrix jobs. | |
ci-success: | |
name: bors-ci-status | |
if: ${{ always() }} | |
needs: | |
# - test | |
- visual_studio_stage2 | |
# - test_cxxbridge | |
# - install | |
runs-on: ubuntu-latest | |
# Step copied from: https://github.com/cross-rs/cross/blob/80c9f9109a719ffb0f694060ddc6e371d5b3a540/.github/workflows/ci.yml#L361 | |
steps: | |
- name: Result | |
run: | | |
jq -C <<< "${needs}" | |
# Check if all needs were successful or skipped. | |
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")" | |
env: | |
needs: ${{ toJson(needs) }} | |