tools/corrosion/.github/workflows/test.yaml
branchtransitional_engine
changeset 16021 6a3dc15b78b9
equal deleted inserted replaced
16009:7544a7d7c819 16021:6a3dc15b78b9
       
     1 name: Tests
       
     2 on:
       
     3   push:
       
     4     branches:
       
     5       - master
       
     6   pull_request:
       
     7     branches:
       
     8       - 'master'
       
     9       - 'stable/**'
       
    10 jobs:
       
    11 
       
    12   test_legacy_linux:
       
    13     name: Test Corrosion (CMake 3.15)
       
    14     uses: ./.github/workflows/test_legacy.yaml
       
    15     with :
       
    16       os: ubuntu-20.04
       
    17       rust: 1.46.0
       
    18   test_legacy_mac:
       
    19     name: Test Corrosion (CMake 3.15)
       
    20     uses: ./.github/workflows/test_legacy.yaml
       
    21     with:
       
    22       os: macos-12
       
    23       rust: 1.54.0
       
    24   test_legacy_windows:
       
    25     name: Test Corrosion (CMake 3.15)
       
    26     uses: ./.github/workflows/test_legacy.yaml
       
    27     with:
       
    28       os: windows-2019
       
    29       rust: 1.46.0
       
    30 
       
    31   test_legacy_stable:
       
    32     name: Legacy CMake + stable Rust
       
    33     uses: ./.github/workflows/test_legacy.yaml
       
    34     strategy:
       
    35       fail-fast: false
       
    36       matrix:
       
    37         os:
       
    38           - windows-2019 # windows-latest is currently not having a supported MSVC compiler
       
    39           - ubuntu-20.04
       
    40           - macos-12
       
    41     with:
       
    42       os: ${{ matrix.os }}
       
    43       rust: stable
       
    44 
       
    45   test_legacy_nightly:
       
    46     name: Legacy CMake + nightly Rust
       
    47     uses: ./.github/workflows/test_legacy.yaml
       
    48     with:
       
    49       os: ubuntu-20.04
       
    50       rust: nightly
       
    51 
       
    52   test_legacy_new_lockfile_msrv:
       
    53     name: Test MSRV of the new lockfile
       
    54     runs-on: ubuntu-20.04
       
    55     steps:
       
    56       - uses: actions/checkout@v4
       
    57       - name: Install Rust
       
    58         id: install_rust
       
    59         uses: dtolnay/rust-toolchain@1.56
       
    60       - name: Test Generator build with MSRV
       
    61         run: cargo build
       
    62         working-directory: generator
       
    63 
       
    64   test:
       
    65     name: Test Corrosion
       
    66     runs-on: ${{ matrix.os }}
       
    67     continue-on-error: ${{ matrix.rust == 'nightly' }}
       
    68     strategy:
       
    69       fail-fast: false
       
    70       matrix:
       
    71         os:
       
    72           - windows-2019 # windows-latest is currently not having a supported MSVC compiler
       
    73           - ubuntu-latest
       
    74           - macos-12
       
    75         arch:
       
    76           - x86_64
       
    77           - i686
       
    78           - aarch64
       
    79           - powerpc64le
       
    80         abi:
       
    81           - gnu
       
    82           - darwin
       
    83           - msvc
       
    84         cmake:
       
    85           - 3.19.0
       
    86         rust:
       
    87           # Our MSRV is already tested with the legacy generator, so just test the current stable rust here.
       
    88           - stable
       
    89         generator:
       
    90           - default # This is just whatever the platform default is
       
    91           - ninja
       
    92         compiler: [default]
       
    93         include:
       
    94           - rust: nightly
       
    95             cmake: 3.19.0
       
    96             generator: ninja
       
    97             arch: x86_64
       
    98             abi: msvc
       
    99             os: windows-2019
       
   100           - rust: nightly
       
   101             cmake: 3.19.0
       
   102             generator: ninja
       
   103             arch: x86_64
       
   104             abi: gnu
       
   105             os: ubuntu-latest
       
   106           - rust: nightly
       
   107             cmake: 3.19.0
       
   108             generator: ninja
       
   109             arch: x86_64
       
   110             abi: darwin
       
   111             os: macos-12
       
   112           - rust: 1.54
       
   113             cmake: 3.19.0
       
   114             generator: ninja
       
   115             arch: x86_64
       
   116             abi: msvc
       
   117             os: windows-2019
       
   118             compiler: clang
       
   119           - os: ubuntu-latest
       
   120             arch: x86_64
       
   121             abi: gnu
       
   122             cmake: 3.20.0
       
   123             rust: 1.54
       
   124             generator: ninja-multiconfig
       
   125 
       
   126         exclude:
       
   127 
       
   128           # We have a separate test Matrix for the Visual Studio Generator
       
   129           - os: windows-2019
       
   130             generator: default # Default generator is Visual Studio
       
   131 
       
   132           # ARCH
       
   133           - os: windows-2019
       
   134             arch: i686
       
   135             abi: gnu
       
   136           - os: windows-2019
       
   137             arch: aarch64
       
   138             abi: gnu
       
   139           - os: windows-2019
       
   140             arch: i686
       
   141             generator: ninja
       
   142           - os: windows-2019
       
   143             arch: aarch64
       
   144             generator: ninja
       
   145           - os: windows-2019
       
   146             arch: powerpc64le
       
   147           - os: macos-12
       
   148             arch: i686
       
   149           - os: macos-12
       
   150             arch: aarch64
       
   151           - os: macos-12
       
   152             arch: powerpc64le
       
   153 
       
   154           # ABI
       
   155           - os: ubuntu-latest
       
   156             abi: msvc
       
   157           - os: ubuntu-latest
       
   158             abi: darwin
       
   159           - os: windows-2019
       
   160             abi: darwin
       
   161           - os: macos-12
       
   162             abi: msvc
       
   163           - os: macos-12
       
   164             abi: gnu
       
   165 
       
   166     steps:
       
   167       - uses: actions/checkout@v4
       
   168       - name: Setup Environment and Configure CMake
       
   169         uses: "./.github/actions/setup_test"
       
   170         with:
       
   171           target_arch: ${{matrix.arch}}
       
   172           abi: ${{matrix.abi}}
       
   173           cmake: ${{matrix.cmake}}
       
   174           rust: ${{matrix.rust}}
       
   175           generator: ${{matrix.generator}}
       
   176           build_dir: build
       
   177           compiler: ${{matrix.compiler}}
       
   178       - name: Run Tests
       
   179         id: run_tests
       
   180         working-directory: build
       
   181         run: ctest --output-on-failure --build-config Debug -j 3
       
   182 
       
   183   test_msvc:
       
   184     name: Test MSVC Generator
       
   185     runs-on: ${{ matrix.os }}
       
   186     strategy:
       
   187       fail-fast: false
       
   188       matrix:
       
   189         os:
       
   190           - windows-2019
       
   191           - windows-2022
       
   192         arch:
       
   193           - x86_64
       
   194           - i686
       
   195           - aarch64
       
   196         include:
       
   197           - rust: 1.54.0
       
   198           # Override rust version for x86_64
       
   199           - arch: x86_64
       
   200             rust: 1.46.0
       
   201           - os: windows-2019
       
   202             cmake: 3.20.6  # Multi-config Generators require at least CMake 3.20
       
   203           - os: windows-2022
       
   204             cmake: 3.21.5 # VS on windows-2022 requires at least CMake 3.21
       
   205 
       
   206     steps:
       
   207       - uses: actions/checkout@v4
       
   208       # The initial configure for MSVC is quite slow, so we cache the build directory
       
   209       # (including the build directories of the tests) since reconfiguring is
       
   210       # significantly faster.
       
   211       - name: Cache MSVC build directory
       
   212         id: cache-msvc-builddir
       
   213         uses: actions/cache@v4
       
   214         with:
       
   215           path: build
       
   216           key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.rust }}-msvc-build
       
   217       - name: Setup Environment and Configure CMake
       
   218         uses: "./.github/actions/setup_test"
       
   219         with:
       
   220           target_arch: ${{matrix.arch}}
       
   221           abi: msvc
       
   222           cmake: ${{matrix.cmake}}
       
   223           rust: ${{matrix.rust}}
       
   224           generator: default
       
   225           build_dir: build
       
   226           configure_params: "-DCORROSION_TESTS_KEEP_BUILDDIRS=ON"
       
   227       - name: Run Tests
       
   228         working-directory: build
       
   229         run: ctest --output-on-failure --build-config Debug -j 3
       
   230 
       
   231   test_cxxbridge:
       
   232     name: Test cxxbridge integration
       
   233     runs-on: ${{ matrix.os }}
       
   234     strategy:
       
   235       fail-fast: false
       
   236       matrix:
       
   237         os:
       
   238           - windows-2019
       
   239           - ubuntu-latest
       
   240           - macos-12
       
   241         include:
       
   242           - abi: default
       
   243         #  - os: windows-2019
       
   244         #    abi: gnu
       
   245     steps:
       
   246       - uses: actions/checkout@v4
       
   247       - uses: actions/cache@v4
       
   248         id: cache_cxxbridge
       
   249         with:
       
   250           path: "~/.cargo/bin/cxxbridge*"
       
   251           key: ${{ runner.os }}-cxxbridge_1_0_86
       
   252       - name: Install cxxbridge
       
   253         if: steps.cache_cxxbridge.outputs.cache-hit != 'true'
       
   254         run: cargo install cxxbridge-cmd@1.0.86
       
   255       - name: Install lld
       
   256         run: sudo apt update && sudo apt install -y lld
       
   257         if: ${{ 'Linux' == runner.os }}
       
   258       - name: Setup Environment and Configure CMake
       
   259         uses: "./.github/actions/setup_test"
       
   260         with:
       
   261           target_arch: x86_64
       
   262           cmake: 3.15.7
       
   263           rust: stable minus 2 releases
       
   264           abi: ${{ matrix.abi }}
       
   265           generator: ninja
       
   266           build_dir: build
       
   267           configure_params: -DCORROSION_TESTS_CXXBRIDGE=ON
       
   268       - name: Run Tests
       
   269         working-directory: build
       
   270         run: ctest --output-on-failure --build-config Debug -j 3 -R "^cxxbridge"
       
   271   install:
       
   272     name: Test Corrosion as a Library
       
   273     runs-on: ${{ matrix.os }}
       
   274     strategy:
       
   275       fail-fast: false
       
   276       matrix:
       
   277         os:
       
   278           - windows-2019
       
   279           - ubuntu-latest
       
   280           - macos-12
       
   281         include:
       
   282           - rust: 1.46.0
       
   283           - os: macos-12
       
   284             rust: 1.54.0  # On MacOS-12 linking fails before Rust 1.54
       
   285     steps:
       
   286       - uses: actions/checkout@v4
       
   287       - name: Setup MSVC Development Environment
       
   288         uses: ilammy/msvc-dev-cmd@v1
       
   289         if: runner.os == 'Windows'
       
   290       - name: Install CMake
       
   291         uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
       
   292         with:
       
   293           cmakeVersion: "~3.18.0"
       
   294           ninjaVersion: "~1.10.0"
       
   295       - name: Install Rust
       
   296         uses: dtolnay/rust-toolchain@master
       
   297         with:
       
   298           toolchain: ${{matrix.rust}}
       
   299       - name: CMake Version
       
   300         run: cmake --version
       
   301       - name: Rust Version
       
   302         run: rustc --version
       
   303       - name: Test Corrosion as subdirectory
       
   304         run: >
       
   305           cmake
       
   306           -S.
       
   307           -Bbuild
       
   308           -GNinja
       
   309           -DCORROSION_VERBOSE_OUTPUT=ON
       
   310           -DCORROSION_TESTS_INSTALL_CORROSION=OFF
       
   311           &&
       
   312           cd build
       
   313           &&
       
   314           ctest --output-on-failure -C Debug -j 3
       
   315       - name: Test Corrosion as installed module
       
   316         run: >
       
   317           cmake -E remove_directory build
       
   318           &&
       
   319           cmake
       
   320           -S.
       
   321           -Bbuild
       
   322           -GNinja
       
   323           -DCORROSION_VERBOSE_OUTPUT=ON
       
   324           -DCMAKE_BUILD_TYPE=Release
       
   325           -DCORROSION_TESTS_INSTALL_CORROSION=ON
       
   326           &&
       
   327           cd build
       
   328           &&
       
   329           ctest --output-on-failure -C Release -j 3
       
   330   # We need some "accumulation" job here because bors fails (timeouts) to
       
   331   # listen on matrix builds.
       
   332   # Hence, we have some kind of dummy here that bors can listen on
       
   333   ci-success:
       
   334     name: bors-ci-status
       
   335     if: ${{ always() }}
       
   336     needs:
       
   337       - test_legacy_linux
       
   338       - test_legacy_mac
       
   339       - test_legacy_windows
       
   340       - test_legacy_stable
       
   341       - test_legacy_new_lockfile_msrv
       
   342       - test
       
   343       - test_msvc
       
   344       - test_cxxbridge
       
   345       - install
       
   346     runs-on: ubuntu-latest
       
   347     # Step copied from: https://github.com/cross-rs/cross/blob/80c9f9109a719ffb0f694060ddc6e371d5b3a540/.github/workflows/ci.yml#L361
       
   348     steps:
       
   349       - name: Result
       
   350         run: |
       
   351           jq -C <<< "${needs}"
       
   352           # Check if all needs were successful or skipped.
       
   353           "$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
       
   354         env:
       
   355           needs: ${{ toJson(needs) }}
       
   356