Skip to content

Commit

Permalink
demo staged workflow for VS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwe committed Sep 17, 2023
1 parent 8abf5d4 commit a95ccf7
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 50 deletions.
72 changes: 22 additions & 50 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -446,7 +418,7 @@ jobs:
if: ${{ always() }}
needs:
# - test
- test_msvc
- visual_studio_stage2
# - test_cxxbridge
# - install
runs-on: ubuntu-latest
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/visual_studio.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a95ccf7

Please sign in to comment.