diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 940bd593..e07eba81 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -127,58 +127,32 @@ jobs: # working-directory: build # run: ctest --output-on-failure --build-config Debug -j 3 - test_msvc: - name: Test Windows Visual Studio - runs-on: ${{ matrix.os }} + + 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: - fail-fast: false matrix: - os: - - windows-2019 - - windows-2022 + vs_version: + - "2019" + - "2022" arch: - x86_64 - i686 - aarch64 - include: - - os: windows-2019 - vs_version: vs-2019 - cmake: 3.22.6 - - 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 - - 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. - - name: Cache MSVC build directory - id: cache-msvc-builddir - uses: actions/cache@v3 - with: - path: build - key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.rust }}-msvc-build - - 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 + with: + vs_version: "${{ matrix.vs_version}}" + rust: 1.54.0 + target_arch: "${{ matrix.arch}}" windows_ninja_cl: name: Test Windows Ninja MSVC @@ -326,13 +300,11 @@ jobs: - name: Install Cross Compiler shell: bash run: | - if [[ "${{ matrix.arch }}" != 'x86_64' ]]; then echo "::group::apt-install" sudo apt-get update sudo apt-get install -y "g++-${{matrix.arch}}-linux-gnu" echo "::endgroup::" - fi - if: ${{ 'Linux' == runner.os }} + 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 @@ -446,7 +418,7 @@ jobs: if: ${{ always() }} needs: # - test - - test_msvc + - visual_studio_stage2 # - test_cxxbridge # - install runs-on: ubuntu-latest diff --git a/.github/workflows/visual_studio.yaml b/.github/workflows/visual_studio.yaml new file mode 100644 index 00000000..15a9c7a0 --- /dev/null +++ b/.github/workflows/visual_studio.yaml @@ -0,0 +1,53 @@ +name: Corrosion with Visual Studio + +on: + workflow_call: + inputs: + vs_version: + required: true + type: string + default: 2022 + cmake: + required: false + type: string + default: "3.22.6" + rust: + required: false + type: string + default: 1.46.0 + target_arch: + required: false + type: string + default: x86_64 + +jobs: + visual_studio: + name: Test Visual Studio ${{ inputs.vs_version }} + runs-on: "windows-${{ inputs.vs_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}}-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. + - name: Cache MSVC build directory + id: cache-msvc-builddir + uses: actions/cache@v3 + with: + path: build + key: ${{ inputs.os }}-${{ inputs.target_arch }}-${{ inputs.rust }}-msvc-build + - name: New configure + run: cmake -S. -Bbuild -DCORROSION_TESTS_KEEP_BUILDDIRS=ON "-DRust_TOOLCHAIN=${{steps.install_rust.outputs.name}}" --preset "vs-${{ inputs.vs_version }}-${{ inputs.target_arch }}" + - name: Run Tests + working-directory: build + run: ctest --output-on-failure --build-config Debug -j 3