diff --git a/.github/actions/fix-environment/action.yml b/.github/actions/fix-environment/action.yml index 895fb861f8..84f8133fe0 100644 --- a/.github/actions/fix-environment/action.yml +++ b/.github/actions/fix-environment/action.yml @@ -40,6 +40,12 @@ runs: ((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } + "aarch64*" + { + "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH + ((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64") + | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH + } "*" { (Join-Path $env:GITHUB_WORKSPACE "target\debug\deps").ToString() >> $env:GITHUB_PATH diff --git a/.github/workflows/arm64.yml b/.github/workflows/arm64.yml new file mode 100644 index 0000000000..caa4e25f1f --- /dev/null +++ b/.github/workflows/arm64.yml @@ -0,0 +1,308 @@ +name: arm64 + +on: + pull_request: + push: + paths-ignore: + - '.github/ISSUE_TEMPLATE/**' + branches: + - master + +env: + RUSTFLAGS: -Dwarnings + +jobs: + check: + runs-on: windows-2019 + + strategy: + matrix: + include: + - version: stable + target: aarch64-pc-windows-msvc + - version: nightly + target: aarch64-pc-windows-msvc + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Update toolchain + run: rustup update --no-self-update ${{ matrix.version }} && rustup default ${{ matrix.version }}-x86_64-pc-windows-msvc + - name: Add toolchain target + run: rustup target add ${{ matrix.target }} + - name: Fix environment + uses: ./.github/actions/fix-environment + - name: Clean + run: cargo clean + - name: Test riddle + run: cargo test -p riddle --no-run --target ${{ matrix.target }} + - name: Test sample_bits + run: cargo test -p sample_bits --no-run --target ${{ matrix.target }} + - name: Test sample_com_uri + run: cargo test -p sample_com_uri --no-run --target ${{ matrix.target }} + - name: Test sample_component_hello_world + run: cargo test -p sample_component_hello_world --no-run --target ${{ matrix.target }} + - name: Test sample_component_json_validator + run: cargo test -p sample_component_json_validator --no-run --target ${{ matrix.target }} + - name: Test sample_component_json_validator_winrt + run: cargo test -p sample_component_json_validator_winrt --no-run --target ${{ matrix.target }} + - name: Test sample_component_json_validator_winrt_client + run: cargo test -p sample_component_json_validator_winrt_client --no-run --target ${{ matrix.target }} + - name: Test sample_consent + run: cargo test -p sample_consent --no-run --target ${{ matrix.target }} + - name: Test sample_core_app + run: cargo test -p sample_core_app --no-run --target ${{ matrix.target }} + - name: Test sample_counter + run: cargo test -p sample_counter --no-run --target ${{ matrix.target }} + - name: Test sample_counter_sys + run: cargo test -p sample_counter_sys --no-run --target ${{ matrix.target }} + - name: Test sample_create_window + run: cargo test -p sample_create_window --no-run --target ${{ matrix.target }} + - name: Test sample_create_window_sys + run: cargo test -p sample_create_window_sys --no-run --target ${{ matrix.target }} + - name: Test sample_credentials + run: cargo test -p sample_credentials --no-run --target ${{ matrix.target }} + - name: Test sample_data_protection + run: cargo test -p sample_data_protection --no-run --target ${{ matrix.target }} + - name: Test sample_dcomp + run: cargo test -p sample_dcomp --no-run --target ${{ matrix.target }} + - name: Test sample_delay_load + run: cargo test -p sample_delay_load --no-run --target ${{ matrix.target }} + - name: Test sample_delay_load_sys + run: cargo test -p sample_delay_load_sys --no-run --target ${{ matrix.target }} + - name: Test sample_device_watcher + run: cargo test -p sample_device_watcher --no-run --target ${{ matrix.target }} + - name: Test sample_direct2d + run: cargo test -p sample_direct2d --no-run --target ${{ matrix.target }} + - name: Test sample_direct3d12 + run: cargo test -p sample_direct3d12 --no-run --target ${{ matrix.target }} + - name: Test sample_enum_windows + run: cargo test -p sample_enum_windows --no-run --target ${{ matrix.target }} + - name: Test sample_enum_windows_sys + run: cargo test -p sample_enum_windows_sys --no-run --target ${{ matrix.target }} + - name: Test sample_kernel_event + run: cargo test -p sample_kernel_event --no-run --target ${{ matrix.target }} + - name: Test sample_memory_buffer + run: cargo test -p sample_memory_buffer --no-run --target ${{ matrix.target }} + - name: Test sample_message_box + run: cargo test -p sample_message_box --no-run --target ${{ matrix.target }} + - name: Test sample_message_box_sys + run: cargo test -p sample_message_box_sys --no-run --target ${{ matrix.target }} + - name: Test sample_ocr + run: cargo test -p sample_ocr --no-run --target ${{ matrix.target }} + - name: Test sample_overlapped + run: cargo test -p sample_overlapped --no-run --target ${{ matrix.target }} + - name: Test sample_privileges + run: cargo test -p sample_privileges --no-run --target ${{ matrix.target }} + - name: Test sample_privileges_sys + run: cargo test -p sample_privileges_sys --no-run --target ${{ matrix.target }} + - name: Test sample_rss + run: cargo test -p sample_rss --no-run --target ${{ matrix.target }} + - name: Test sample_shell + run: cargo test -p sample_shell --no-run --target ${{ matrix.target }} + - name: Test sample_simple + run: cargo test -p sample_simple --no-run --target ${{ matrix.target }} + - name: Test sample_spellchecker + run: cargo test -p sample_spellchecker --no-run --target ${{ matrix.target }} + - name: Test sample_task_dialog + run: cargo test -p sample_task_dialog --no-run --target ${{ matrix.target }} + - name: Test sample_task_dialog_sys + run: cargo test -p sample_task_dialog_sys --no-run --target ${{ matrix.target }} + - name: Test sample_thread_pool_work + run: cargo test -p sample_thread_pool_work --no-run --target ${{ matrix.target }} + - name: Test sample_thread_pool_work_sys + run: cargo test -p sample_thread_pool_work_sys --no-run --target ${{ matrix.target }} + - name: Test sample_uiautomation + run: cargo test -p sample_uiautomation --no-run --target ${{ matrix.target }} + - name: Test sample_wmi + run: cargo test -p sample_wmi --no-run --target ${{ matrix.target }} + - name: Test sample_xml + run: cargo test -p sample_xml --no-run --target ${{ matrix.target }} + - name: Test test_agile + run: cargo test -p test_agile --no-run --target ${{ matrix.target }} + - name: Test test_agile_reference + run: cargo test -p test_agile_reference --no-run --target ${{ matrix.target }} + - name: Test test_alternate_success_code + run: cargo test -p test_alternate_success_code --no-run --target ${{ matrix.target }} + - name: Test test_arch + run: cargo test -p test_arch --no-run --target ${{ matrix.target }} + - name: Test test_arch_feature + run: cargo test -p test_arch_feature --no-run --target ${{ matrix.target }} + - name: Test test_array + run: cargo test -p test_array --no-run --target ${{ matrix.target }} + - name: Test test_bcrypt + run: cargo test -p test_bcrypt --no-run --target ${{ matrix.target }} + - name: Test test_bstr + run: cargo test -p test_bstr --no-run --target ${{ matrix.target }} + - name: Clean + run: cargo clean + - name: Test test_calling_convention + run: cargo test -p test_calling_convention --no-run --target ${{ matrix.target }} + - name: Test test_cfg_generic + run: cargo test -p test_cfg_generic --no-run --target ${{ matrix.target }} + - name: Test test_collections + run: cargo test -p test_collections --no-run --target ${{ matrix.target }} + - name: Test test_component + run: cargo test -p test_component --no-run --target ${{ matrix.target }} + - name: Test test_component_client + run: cargo test -p test_component_client --no-run --target ${{ matrix.target }} + - name: Test test_const_fields + run: cargo test -p test_const_fields --no-run --target ${{ matrix.target }} + - name: Test test_const_params + run: cargo test -p test_const_params --no-run --target ${{ matrix.target }} + - name: Test test_const_ptrs + run: cargo test -p test_const_ptrs --no-run --target ${{ matrix.target }} + - name: Test test_core + run: cargo test -p test_core --no-run --target ${{ matrix.target }} + - name: Test test_debug + run: cargo test -p test_debug --no-run --target ${{ matrix.target }} + - name: Test test_debug_inspectable + run: cargo test -p test_debug_inspectable --no-run --target ${{ matrix.target }} + - name: Test test_debugger_visualizer + run: cargo test -p test_debugger_visualizer --no-run --target ${{ matrix.target }} + - name: Test test_deprecated + run: cargo test -p test_deprecated --no-run --target ${{ matrix.target }} + - name: Test test_dispatch + run: cargo test -p test_dispatch --no-run --target ${{ matrix.target }} + - name: Test test_does_not_return + run: cargo test -p test_does_not_return --no-run --target ${{ matrix.target }} + - name: Test test_enums + run: cargo test -p test_enums --no-run --target ${{ matrix.target }} + - name: Test test_error + run: cargo test -p test_error --no-run --target ${{ matrix.target }} + - name: Test test_event + run: cargo test -p test_event --no-run --target ${{ matrix.target }} + - name: Test test_extensions + run: cargo test -p test_extensions --no-run --target ${{ matrix.target }} + - name: Test test_handles + run: cargo test -p test_handles --no-run --target ${{ matrix.target }} + - name: Test test_helpers + run: cargo test -p test_helpers --no-run --target ${{ matrix.target }} + - name: Test test_implement + run: cargo test -p test_implement --no-run --target ${{ matrix.target }} + - name: Test test_interface + run: cargo test -p test_interface --no-run --target ${{ matrix.target }} + - name: Test test_interface_core + run: cargo test -p test_interface_core --no-run --target ${{ matrix.target }} + - name: Test test_interop + run: cargo test -p test_interop --no-run --target ${{ matrix.target }} + - name: Test test_lib + run: cargo test -p test_lib --no-run --target ${{ matrix.target }} + - name: Test test_literals + run: cargo test -p test_literals --no-run --target ${{ matrix.target }} + - name: Test test_match + run: cargo test -p test_match --no-run --target ${{ matrix.target }} + - name: Test test_matrix3x2 + run: cargo test -p test_matrix3x2 --no-run --target ${{ matrix.target }} + - name: Test test_metadata + run: cargo test -p test_metadata --no-run --target ${{ matrix.target }} + - name: Test test_msrv + run: cargo test -p test_msrv --no-run --target ${{ matrix.target }} + - name: Test test_no_use + run: cargo test -p test_no_use --no-run --target ${{ matrix.target }} + - name: Test test_not_dll + run: cargo test -p test_not_dll --no-run --target ${{ matrix.target }} + - name: Test test_query_signature + run: cargo test -p test_query_signature --no-run --target ${{ matrix.target }} + - name: Test test_readme + run: cargo test -p test_readme --no-run --target ${{ matrix.target }} + - name: Test test_registry + run: cargo test -p test_registry --no-run --target ${{ matrix.target }} + - name: Test test_reserved + run: cargo test -p test_reserved --no-run --target ${{ matrix.target }} + - name: Test test_resources + run: cargo test -p test_resources --no-run --target ${{ matrix.target }} + - name: Test test_result + run: cargo test -p test_result --no-run --target ${{ matrix.target }} + - name: Test test_return_handle + run: cargo test -p test_return_handle --no-run --target ${{ matrix.target }} + - name: Test test_return_struct + run: cargo test -p test_return_struct --no-run --target ${{ matrix.target }} + - name: Test test_riddle + run: cargo test -p test_riddle --no-run --target ${{ matrix.target }} + - name: Test test_simple_component + run: cargo test -p test_simple_component --no-run --target ${{ matrix.target }} + - name: Test test_standalone + run: cargo test -p test_standalone --no-run --target ${{ matrix.target }} + - name: Test test_string_param + run: cargo test -p test_string_param --no-run --target ${{ matrix.target }} + - name: Test test_structs + run: cargo test -p test_structs --no-run --target ${{ matrix.target }} + - name: Test test_sys + run: cargo test -p test_sys --no-run --target ${{ matrix.target }} + - name: Test test_targets + run: cargo test -p test_targets --no-run --target ${{ matrix.target }} + - name: Test test_unions + run: cargo test -p test_unions --no-run --target ${{ matrix.target }} + - name: Test test_variant + run: cargo test -p test_variant --no-run --target ${{ matrix.target }} + - name: Clean + run: cargo clean + - name: Test test_wdk + run: cargo test -p test_wdk --no-run --target ${{ matrix.target }} + - name: Test test_weak + run: cargo test -p test_weak --no-run --target ${{ matrix.target }} + - name: Test test_weak_ref + run: cargo test -p test_weak_ref --no-run --target ${{ matrix.target }} + - name: Test test_win32 + run: cargo test -p test_win32 --no-run --target ${{ matrix.target }} + - name: Test test_win32_arrays + run: cargo test -p test_win32_arrays --no-run --target ${{ matrix.target }} + - name: Test test_window_long + run: cargo test -p test_window_long --no-run --target ${{ matrix.target }} + - name: Test test_winrt + run: cargo test -p test_winrt --no-run --target ${{ matrix.target }} + - name: Test tool_gnu + run: cargo test -p tool_gnu --no-run --target ${{ matrix.target }} + - name: Test tool_lib + run: cargo test -p tool_lib --no-run --target ${{ matrix.target }} + - name: Test tool_license + run: cargo test -p tool_license --no-run --target ${{ matrix.target }} + - name: Test tool_metadata + run: cargo test -p tool_metadata --no-run --target ${{ matrix.target }} + - name: Test tool_msvc + run: cargo test -p tool_msvc --no-run --target ${{ matrix.target }} + - name: Test tool_sys + run: cargo test -p tool_sys --no-run --target ${{ matrix.target }} + - name: Test tool_windows + run: cargo test -p tool_windows --no-run --target ${{ matrix.target }} + - name: Test tool_yml + run: cargo test -p tool_yml --no-run --target ${{ matrix.target }} + - name: Test windows + run: cargo test -p windows --no-run --target ${{ matrix.target }} + - name: Test windows-bindgen + run: cargo test -p windows-bindgen --no-run --target ${{ matrix.target }} + - name: Test windows-core + run: cargo test -p windows-core --no-run --target ${{ matrix.target }} + - name: Test windows-implement + run: cargo test -p windows-implement --no-run --target ${{ matrix.target }} + - name: Test windows-interface + run: cargo test -p windows-interface --no-run --target ${{ matrix.target }} + - name: Test windows-metadata + run: cargo test -p windows-metadata --no-run --target ${{ matrix.target }} + - name: Test windows-registry + run: cargo test -p windows-registry --no-run --target ${{ matrix.target }} + - name: Test windows-result + run: cargo test -p windows-result --no-run --target ${{ matrix.target }} + - name: Test windows-sys + run: cargo test -p windows-sys --no-run --target ${{ matrix.target }} + - name: Test windows-targets + run: cargo test -p windows-targets --no-run --target ${{ matrix.target }} + - name: Test windows-version + run: cargo test -p windows-version --no-run --target ${{ matrix.target }} + - name: Test windows_aarch64_gnullvm + run: cargo test -p windows_aarch64_gnullvm --no-run --target ${{ matrix.target }} + - name: Test windows_aarch64_msvc + run: cargo test -p windows_aarch64_msvc --no-run --target ${{ matrix.target }} + - name: Test windows_i686_gnu + run: cargo test -p windows_i686_gnu --no-run --target ${{ matrix.target }} + - name: Test windows_i686_gnullvm + run: cargo test -p windows_i686_gnullvm --no-run --target ${{ matrix.target }} + - name: Test windows_i686_msvc + run: cargo test -p windows_i686_msvc --no-run --target ${{ matrix.target }} + - name: Test windows_x86_64_gnu + run: cargo test -p windows_x86_64_gnu --no-run --target ${{ matrix.target }} + - name: Test windows_x86_64_gnullvm + run: cargo test -p windows_x86_64_gnullvm --no-run --target ${{ matrix.target }} + - name: Test windows_x86_64_msvc + run: cargo test -p windows_x86_64_msvc --no-run --target ${{ matrix.target }} \ No newline at end of file diff --git a/crates/tests/arch/tests/sys.rs b/crates/tests/arch/tests/sys.rs index ebdcbd152c..a666486e88 100644 --- a/crates/tests/arch/tests/sys.rs +++ b/crates/tests/arch/tests/sys.rs @@ -1,13 +1,13 @@ -use windows_sys::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS; - #[test] #[cfg(target_arch = "x86_64")] fn test() { + use windows_sys::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS; assert_eq!(256, core::mem::size_of::()); } #[test] #[cfg(target_arch = "x86")] fn test() { + use windows_sys::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS; assert_eq!(4, core::mem::size_of::()); } diff --git a/crates/tests/arch/tests/win.rs b/crates/tests/arch/tests/win.rs index 18ab430665..d8a4add7fe 100644 --- a/crates/tests/arch/tests/win.rs +++ b/crates/tests/arch/tests/win.rs @@ -1,13 +1,13 @@ -use windows::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS; - #[test] #[cfg(target_arch = "x86_64")] fn test() { + use windows::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS; assert_eq!(256, core::mem::size_of::()); } #[test] #[cfg(target_arch = "x86")] fn test() { + use windows::Win32::System::Diagnostics::Debug::KNONVOLATILE_CONTEXT_POINTERS; assert_eq!(4, core::mem::size_of::()); } diff --git a/crates/tests/arch_feature/tests/sys.rs b/crates/tests/arch_feature/tests/sys.rs index 60ec04d875..8659908151 100644 --- a/crates/tests/arch_feature/tests/sys.rs +++ b/crates/tests/arch_feature/tests/sys.rs @@ -1,11 +1,11 @@ -use windows_sys::{ - Win32::System::Diagnostics::Debug::CONTEXT, - Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD, -}; - #[test] #[cfg(target_arch = "x86_64")] fn test() { + use windows_sys::{ + Win32::System::Diagnostics::Debug::CONTEXT, + Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD, + }; + assert_eq!(1232, core::mem::size_of::()); use windows_sys::Win32::System::Environment::VBS_BASIC_ENCLAVE_THREAD_DESCRIPTOR64; @@ -21,6 +21,11 @@ fn test() { #[test] #[cfg(target_arch = "x86")] fn test() { + use windows_sys::{ + Win32::System::Diagnostics::Debug::CONTEXT, + Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD, + }; + assert_eq!(716, core::mem::size_of::()); use windows_sys::Win32::System::Environment::VBS_BASIC_ENCLAVE_THREAD_DESCRIPTOR32; diff --git a/crates/tests/arch_feature/tests/win.rs b/crates/tests/arch_feature/tests/win.rs index 5f3fa7b831..2716d123b8 100644 --- a/crates/tests/arch_feature/tests/win.rs +++ b/crates/tests/arch_feature/tests/win.rs @@ -1,11 +1,11 @@ -use windows::{ - Win32::System::Diagnostics::Debug::CONTEXT, - Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD, -}; - #[test] #[cfg(target_arch = "x86_64")] fn test() { + use windows::{ + Win32::System::Diagnostics::Debug::CONTEXT, + Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD, + }; + assert_eq!(1232, core::mem::size_of::()); use windows::Win32::System::Environment::VBS_BASIC_ENCLAVE_THREAD_DESCRIPTOR64; @@ -21,6 +21,11 @@ fn test() { #[test] #[cfg(target_arch = "x86")] fn test() { + use windows::{ + Win32::System::Diagnostics::Debug::CONTEXT, + Win32::System::Environment::VBS_BASIC_ENCLAVE_BASIC_CALL_CREATE_THREAD, + }; + assert_eq!(716, core::mem::size_of::()); use windows::Win32::System::Environment::VBS_BASIC_ENCLAVE_THREAD_DESCRIPTOR32; diff --git a/crates/tools/yml/src/main.rs b/crates/tools/yml/src/main.rs index 04dfc0d188..b08a37673c 100644 --- a/crates/tools/yml/src/main.rs +++ b/crates/tools/yml/src/main.rs @@ -3,6 +3,7 @@ use std::fmt::Write; fn main() { test_yml(); clippy_yml(); + arm64_yml(); } fn test_yml() { @@ -137,3 +138,65 @@ jobs: std::fs::write(".github/workflows/clippy.yml", yml.as_bytes()).unwrap(); } + +// Ideally this would just be another matrix dimension in test_yml but Cargo limitations are blocking this for the time being. +// See https://github.com/rust-lang/cargo/issues/9661 +fn arm64_yml() { + let mut yml = r"name: arm64 + +on: + pull_request: + push: + paths-ignore: + - '.github/ISSUE_TEMPLATE/**' + branches: + - master + +env: + RUSTFLAGS: -Dwarnings + +jobs: + check: + runs-on: windows-2019 + + strategy: + matrix: + include: + - version: stable + target: aarch64-pc-windows-msvc + - version: nightly + target: aarch64-pc-windows-msvc + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Update toolchain + run: rustup update --no-self-update ${{ matrix.version }} && rustup default ${{ matrix.version }}-x86_64-pc-windows-msvc + - name: Add toolchain target + run: rustup target add ${{ matrix.target }} + - name: Fix environment + uses: ./.github/actions/fix-environment" + .to_string(); + + for (count, (name, _)) in lib::crates("crates").iter().enumerate() { + if count % 50 == 0 { + write!( + &mut yml, + r" + - name: Clean + run: cargo clean" + ) + .unwrap(); + } + + write!( + &mut yml, + r" + - name: Test {name} + run: cargo test -p {name} --no-run --target ${{{{ matrix.target }}}}" + ) + .unwrap(); + } + + std::fs::write(".github/workflows/arm64.yml", yml.as_bytes()).unwrap(); +}