Skip to content

Commit

Permalink
Refactor CI
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.

Additionally add some needs dependencies to order
some of jobs and skip them if the predecessor failed.
  • Loading branch information
jschwe committed Oct 14, 2023
1 parent 73d0aea commit 697150f
Show file tree
Hide file tree
Showing 13 changed files with 662 additions and 344 deletions.
184 changes: 0 additions & 184 deletions .github/actions/setup_test/action.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions .github/scripts/toolchains/aarch64-apple-darwin-clang.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_C_COMPILER_TARGET "aarch64-apple-darwin")
set(CMAKE_CXX_COMPILER_TARGET "aarch64-apple-darwin")
set(CMAKE_SYSTEM_NAME "Darwin")
set(CMAKE_SYSTEM_VERSION ${CMAKE_HOST_SYSTEM_VERSION})
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "")
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_C_COMPILER_TARGET "aarch64-linux-gnu")
set(CMAKE_CXX_COMPILER_TARGET "aarch64-linux-gnu")
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
set(CMAKE_SYSTEM_NAME "Linux")
4 changes: 4 additions & 0 deletions .github/scripts/toolchains/i686-unknown-linux-gnu-clang.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_C_COMPILER_TARGET "i686-pc-linux-gnu")
set(CMAKE_CXX_COMPILER_TARGET "i686-pc-linux-gnu")
3 changes: 3 additions & 0 deletions .github/scripts/toolchains/i686-unknown-linux-gnu-gcc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_C_COMPILER "i686-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "i686-linux-gnu-g++")
set(CMAKE_SYSTEM_NAME "Linux")
3 changes: 3 additions & 0 deletions .github/scripts/toolchains/x86_64-pc-windows-gnu-clang.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_C_COMPILER_TARGET "x86_64-pc-win32-gnu")
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Assumption: This is the native host target.
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
3 changes: 3 additions & 0 deletions .github/scripts/toolchains/x86_64-unknown-linux-gnu-gcc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Assumption: This is the native host target.
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
58 changes: 58 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Workflow file for Linux hosts
name: Corrosion on Linux
on:
workflow_call:
inputs:
ubuntu_version:
required: false
type: string
default: "latest"
cmake:
required: false
type: string
default: "3.22.6"
generator:
required: true
type: string
c_compiler:
required: true
type: string
rust:
required: false
type: string
default: 1.46.0
target_arch:
required: false
type: string
default: x86_64

jobs:
linux:
name: Test Linux
runs-on: ubuntu-${{ inputs.ubuntu_version }}
steps:
- uses: actions/checkout@v4
- name: Install CMake
uses: corrosion-rs/install-cmake@v2
with:
cmake: ${{ inputs.cmake }}
ninja: 1.10.0
- name: Install Rust
id: install_rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{inputs.rust}}
targets: ${{inputs.target_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++-${{inputs.target_arch}}-linux-gnu"
echo "::endgroup::"
if: ${{ 'Linux' == runner.os && inputs.target_arch != 'x86_64' }}
- name: Configure Corrosion
run: cmake -S. -Bbuild -G "${{ inputs.generator }}" "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "${{ inputs.target_arch }}-unknown-linux-gnu-${{ inputs.c_compiler }}"
- name: Run Tests
working-directory: build
run: ctest --output-on-failure --build-config Debug -j 3
Loading

0 comments on commit 697150f

Please sign in to comment.