tools/corrosion/.github/workflows/visual_studio.yaml
author unC0Rr
Wed, 20 Nov 2024 21:37:47 +0100
branchtransitional_engine
changeset 16038 d903f8d2395a
permissions -rw-r--r--
- Update corrosion - Implement installation of targets imported with corrosion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16038
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     1
name: Corrosion with Visual Studio
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     2
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     3
on:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     4
  workflow_call:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     5
    inputs:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     6
      vs_version:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     7
        required: true
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     8
        type: string
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
     9
        default: 2022
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    10
      cmake:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    11
        required: false
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    12
        type: string
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    13
        default: "3.22.6"
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    14
      rust:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    15
        required: false
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    16
        type: string
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    17
        default: 1.46.0
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    18
      target_arch:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    19
        required: false
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    20
        type: string
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    21
        default: x86_64
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    22
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    23
jobs:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    24
  visual_studio:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    25
    name: Test Visual Studio ${{ inputs.vs_version }}
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    26
    runs-on: "windows-${{ inputs.vs_version }}"
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    27
    steps:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    28
      - uses: actions/checkout@v4
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    29
      - name: Install CMake
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    30
        uses: lukka/get-cmake@519de0c7b4812477d74976b2523a9417f552d126
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    31
        with:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    32
          cmakeVersion: "${{ inputs.cmake }}"
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    33
          ninjaVersion: "~1.10.0"
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    34
      - name: Install Rust
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    35
        id: install_rust
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    36
        uses: dtolnay/rust-toolchain@master
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    37
        with:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    38
          toolchain: ${{inputs.rust}}
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    39
          targets: ${{inputs.target_arch}}-pc-windows-msvc
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    40
      # The initial configure for MSVC is quite slow, so we cache the build directory
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    41
      # (including the build directories of the tests) since reconfiguring is
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    42
      # significantly faster.
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    43
      - name: Cache MSVC build directory
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    44
        id: cache-msvc-builddir
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    45
        uses: actions/cache@v4
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    46
        with:
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    47
          path: build
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    48
          key: ${{ inputs.os }}-${{ inputs.target_arch }}-${{ inputs.rust }}-msvc-${{ inputs.vs_version}}-build
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    49
      - name: Configure
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    50
        run: cmake -S. -Bbuild -DCORROSION_TESTS_KEEP_BUILDDIRS=ON "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "vs-${{ inputs.vs_version }}-${{ inputs.target_arch }}"
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    51
      - name: Run Tests
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    52
        working-directory: build
d903f8d2395a - Update corrosion
unC0Rr
parents:
diff changeset
    53
        run: ctest --output-on-failure --build-config Debug -j 3