Skip to content

Add gnullvm targets to test.yml #2974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/fix-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ runs:
{
(Join-Path $env:GITHUB_WORKSPACE "target\debug\deps").ToString() >> $env:GITHUB_PATH
(Join-Path $env:GITHUB_WORKSPACE "target\test\debug\deps").ToString() >> $env:GITHUB_PATH
(Join-Path $env:GITHUB_WORKSPACE "target\${{ matrix.target }}\debug\deps").ToString() >> $env:GITHUB_PATH
(Join-Path $env:GITHUB_WORKSPACE "target\${{ matrix.target }}\test\debug\deps").ToString() >> $env:GITHUB_PATH
"INCLUDE=C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" `
>> $env:GITHUB_ENV
}
Expand Down
49 changes: 43 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the stuff here to fix the environment for gnullvm should probably be in the fix-environment action...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was basing this on what was already done in cross.yml. The only "environment" thing this does that that does not is adding some extra to ~/.cargo/config. Would you like that moved to fix-environment, the whole setup of the llvm toolchain moved to fix-environment, or possibly the setup of the llvm toolchain in a new action (it seems like it should be possible to reuse that between here and cross.yml)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatting with @riverar the non-MSVC testing is a bit of muddle and needs to get cleaned up. Will get back to you on this.

env:
RUSTFLAGS: -Dwarnings
LLVM-MINGW-TOOLCHAIN-NAME: llvm-mingw-20231128-ucrt-x86_64

jobs:
test:
Expand All @@ -27,27 +28,63 @@ jobs:
target: x86_64-pc-windows-gnu
- version: stable
target: i686-pc-windows-gnu
- version: nightly
target: x86_64-pc-windows-gnullvm
- version: nightly
target: i686-pc-windows-gnullvm

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update toolchain
run: rustup update --no-self-update ${{ matrix.version }} && rustup default ${{ matrix.version }}-${{ matrix.target }}
- name: Add toolchain target
run: rustup target add ${{ matrix.target }}
run: rustup update --no-self-update ${{ matrix.version }}
- name: Add target toolchain
run: rustup default ${{ matrix.version }}-${{ matrix.target }}
if: contains(matrix.target, 'gnullvm') == false
- name: Add nightly toolchain with rust-src
run: |
rustup default ${{ matrix.version }}
rustup component add rust-src
if: contains(matrix.target, 'gnullvm')
- name: Install fmt
run: rustup component add rustfmt
- name: Fix environment
uses: ./.github/actions/fix-environment
- name: Add gnullvm config
run: |
Add-Content $env:USERPROFILE\.cargo\config @"
[build]
target = `"${{ matrix.target }}`"
[unstable]
build-std = [`"std`"]
"@
if: contains(matrix.target, 'gnullvm')
- name: LLVM MinGW toolchain cache configuration
id: cache-llvm-mingw-toolchain
uses: actions/cache@v4
if: contains(matrix.target, 'gnullvm')
with:
path: "${{ runner.temp }}/${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}"
key: ${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}
- name: Install LLVM MinGW toolchain
if: contains(matrix.target, 'gnullvm') && steps.cache-llvm-mingw-toolchain.outputs.cache-hit != 'true'
run: |
cd "${{ runner.temp }}"
curl -L -o ${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}.zip https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}.zip
tar -xf ${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}.zip
- name: Add LLVM MinGW toolchain to PATH
if: contains(matrix.target, 'gnullvm')
run: |
echo "${{ runner.temp }}\${{ env.LLVM-MINGW-TOOLCHAIN-NAME }}\bin" >> $env:GITHUB_PATH
- name: Test
run: >
cargo test -p riddle &&
cargo test -p sample_bits &&
cargo test -p sample_com_uri &&
cargo test -p sample_component_hello_world &&
cargo test -p sample_component_json_validator &&
cargo test -p sample_component_json_validator_winrt &&
cargo test -p sample_component_json_validator_winrt_client &&
"cargo test -p sample_component_json_validator" &&
"cargo test -p sample_component_json_validator_winrt" &&
"cargo test -p sample_component_json_validator_winrt_client" &&
cargo test -p sample_consent &&
cargo test -p sample_core_app &&
cargo test -p sample_counter &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ path = "../../../libs/bindgen"

# TODO: this causes a warning about lack of linkage target. The point is to ensure that this binary dependency is built first but
# Cargo doesn't respect cdylib targets. https://github.com/rust-lang/cargo/issues/7825
[build-dependencies.sample_component_json_validator_winrt]
[dependencies.sample_component_json_validator_winrt]
path = "../json_validator_winrt"
2 changes: 1 addition & 1 deletion crates/tests/component_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ features = [

# TODO: this causes a warning about lack of linkage target. The point is to ensure that this binary dependency is built first but
# Cargo doesn't respect cdylib targets. https://github.com/rust-lang/cargo/issues/7825
[build-dependencies.test_component]
[dependencies.test_component]
path = "../component"