diff --git a/.github/actions/install-llvm/action.yml b/.github/actions/install-llvm/action.yml new file mode 100644 index 000000000..79c376174 --- /dev/null +++ b/.github/actions/install-llvm/action.yml @@ -0,0 +1,28 @@ +name: Install LLVM + +inputs: + version: + description: "LLVM version to install" + required: true + +runs: + using: "composite" + steps: + - name: Install LLVM ${{ inputs.version }} + shell: pwsh + run: | + if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ inputs.version }}') { + Write-Host "LLVM ${{ inputs.version }} is already installed." + } else { + Write-Host "Installing LLVM ${{ inputs.version }}..." + Install-WinGetPackage -Id LLVM.LLVM -Version ${{ inputs.version }} -Source winget -MatchOption Equals -Mode Silent -Force + + # Check if WinGet installation succeeded + $installSuccess = $? + if (-not $installSuccess) { + Write-Error "LLVM installation failed. Last exit code: $LASTEXITCODE and success status: $installSuccess" + exit 1 + } + } + + clang --version diff --git a/.github/actions/install-wdk/action.yml b/.github/actions/install-wdk/action.yml index 3493eb388..29b13e584 100644 --- a/.github/actions/install-wdk/action.yml +++ b/.github/actions/install-wdk/action.yml @@ -22,16 +22,20 @@ runs: - name: Install WDK shell: pwsh run: | - $hostArch = '${{ inputs.host }}' - $targetArch = '${{ inputs.target }}' - switch ($targetArch) { - 'amd64' { $targetArch = 'x64' } - 'arm64' { $targetArch = 'ARM64' } - default { - Write-Error "Invalid target architecture: $targetArch. Supported architectures are 'x64' and 'arm64'." - exit 1 + # Function to normalize architecture names + function Normalize-Architecture($arch) { + switch ($arch.ToLower()) { + 'amd64' { return 'x64' } + 'arm64' { return 'arm64' } + default { + Write-Error "Invalid architecture: $arch. Supported architectures are 'amd64' and 'arm64'." + exit 1 + } } } + + $hostArch = Normalize-Architecture '${{ inputs.host }}' + $targetArch = Normalize-Architecture '${{ inputs.target }}' $inputVersion = '${{ inputs.version }}' if ($inputVersion -notmatch '^10\.0\.\d{5}(\.\d{1,4})?$') { @@ -130,14 +134,24 @@ runs: Write-Output "WindowsSdkBinPath=$packages\Microsoft.Windows.SDK.CPP.$version\c\bin" >> $env:GITHUB_ENV } else { - Write-Host "Using Winget to install WDK version $inputVersion..." + Write-Host "Using Winget to install WDK and SDK version $inputVersion..." + + $sdk = "Microsoft.WindowsSDK.$sdkVersion" $wdk = "Microsoft.WindowsWDK.$inputVersion" - if ((Get-WinGetPackage -Id $wdk -Source winget -MatchOption Equals).Id -eq '$wdk') { - Write-Host "$wdk is already installed. Attempting to update..." - Update-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force - } else { - Write-Host "Installing $wdk..." - Install-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force + Write-Host "Installing $sdk..." + Install-WinGetPackage -Id $sdk -Source winget -MatchOption Equals -Mode Silent -Force -Override '/q /features +' + $installSuccess = $? + if (-not $installSuccess) { + Write-Error "$sdk installation failed. Last exit code: $LASTEXITCODE and success status: $installSuccess" + exit 1 + } + + Write-Host "Installing $wdk..." + Install-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force + $installSuccess = $? + if (-not $installSuccess) { + Write-Error "$wdk installation failed. Last exit code: $LASTEXITCODE and success status: $installSuccess" + exit 1 } Write-Host "Setting Version_Number environment variable to $sdkVersion..." diff --git a/.github/actions/install-winget/action.yaml b/.github/actions/install-winget/action.yaml new file mode 100644 index 000000000..68ca24414 --- /dev/null +++ b/.github/actions/install-winget/action.yaml @@ -0,0 +1,81 @@ +name: "Install Winget" +description: "Install winget on windows runners since its not installed by default: https://github.com/actions/runner-images/issues/6472" +inputs: + GITHUB_TOKEN: + description: "GitHub token to execute authenticated Github API requests (for higher rate limit)" + required: true +runs: + using: "composite" + steps: + - name: Get URIs for Winget v1.11.400 assets + shell: pwsh + run: | + $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } + + # Detect runner architecture + $Architecture = if ($env:RUNNER_ARCH -eq "ARM64") { "arm64" } else { "x64" } + Write-Host "Runner architecture: $Architecture" + + # winget-cli release v1.11.400 + # Define the winget-cli release tag to use + $WingetReleaseTag = "v1.11.400" + # Fetch release info by tag instead of magic number release ID + $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders "https://api.github.com/repos/microsoft/winget-cli/releases/tags/$WingetReleaseTag" + $WingetDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') } + $WingetLicenseDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') } + $WingetDependenciesZipDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('DesktopAppInstaller_Dependencies.zip') } + + # Print to logs + Write-Host "WingetDownloadUri=$WingetDownloadUri" + Write-Host "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" + Write-Host "WingetDependenciesZipDownloadUri=$WingetDependenciesZipDownloadUri" + + # Save output for next step + Write-Output "WingetDownloadUri=$WingetDownloadUri" >> $env:GITHUB_ENV + Write-Output "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" >> $env:GITHUB_ENV + Write-Output "Architecture=$Architecture" >> $env:GITHUB_ENV + Write-Output "WingetDependenciesZipDownloadUri=$WingetDependenciesZipDownloadUri" >> $env:GITHUB_ENV + Write-Output "InstallWingetTempDir=$env:RUNNER_TEMP/install-winget" >> $env:GITHUB_ENV + + - name: Download Winget Assets and Dependencies + shell: pwsh + run: | + New-Item -Type Directory $env:InstallWingetTempDir + + # Download winget and license (architecture-agnostic) + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDownloadUri -OutFile $env:InstallWingetTempDir/winget.msixbundle + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetLicenseDownloadUri -OutFile $env:InstallWingetTempDir/license.xml + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDependenciesZipDownloadUri -OutFile $env:InstallWingetTempDir/DesktopAppInstaller_Dependencies.zip + + Expand-Archive -Path "$env:InstallWingetTempDir/DesktopAppInstaller_Dependencies.zip" -DestinationPath $env:InstallWingetTempDir/ -Force + + - name: Start Winget Installation for all Users + shell: pwsh + run: | + # Use architecture-specific dependency paths + [string[]]$DependencyPaths = (Get-ChildItem -Path "$env:InstallWingetTempDir/$env:Architecture" -Filter '*.appx' -File -Force).FullName + + $MicrosoftUIXamlDep = $($DependencyPaths[0]) + $MicrosoftVCLibsDep = $($DependencyPaths[1]) + + Write-Host "Found Dependency $MicrosoftUIXamlDep" + Write-Host "Found Dependency $MicrosoftVCLibsDep" + + Add-AppxProvisionedPackage -Online -PackagePath $env:InstallWingetTempDir/winget.msixbundle -LicensePath $env:InstallWingetTempDir/license.xml -DependencyPackagePath "$MicrosoftUIXamlDep", "$MicrosoftVCLibsDep" + + - name: Install Winget for Current User (for better install diagnostics) + shell: powershell + run: | + Add-AppxPackage $env:InstallWingetTempDir/winget.msixbundle + + - name: Wait for Completion of Winget Installation + shell: pwsh + run: | + while ((Get-Command * | Select-String winget)?.ToString() -ne "winget.exe") { + Start-Sleep -Seconds 1 + } + Write-Output "Winget Version: $(winget --version)" + + - name: Install winget Powershell Module + shell: pwsh + run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml deleted file mode 100644 index a10a986e0..000000000 --- a/.github/actions/winget-install/action.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: "Install Winget" -description: "Install winget on windows runners since its not installed by default: https://github.com/actions/runner-images/issues/6472" -inputs: - GITHUB_TOKEN: - description: "GitHub token to execute authenticated Github API requests (for higher rate limit)" - required: true -runs: - using: "composite" - steps: - - name: Get URIs for Winget v1.8.1911 assets - shell: pwsh - run: | - $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } - - $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/164835566' - $WingetDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') } - $WingetLicenseDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') } - - # Print to logs - Write-Host "WingetDownloadUri=$WingetDownloadUri" - Write-Host "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" - - # Save output for next step - Write-Output "WingetDownloadUri=$WingetDownloadUri" >> $env:GITHUB_ENV - Write-Output "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" >> $env:GITHUB_ENV - - - name: Download Winget Assets and Dependencies - shell: pwsh - run: | - New-Item -Type Directory $env:RUNNER_TEMP/winget-install - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx - Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx # Needed per https://github.com/microsoft/winget-cli/blob/21de1607ed5c90174e6bb931406975c18681a5dd/README.md?plain=1#L35C19-L35C19 - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/winget.msixbundle - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetLicenseDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/license.xml - - - name: Start Winget Installation for all Users - shell: pwsh - run: | - Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx - - - name: Install Winget for Current User (for better install diagnostics) - shell: powershell - run: | - Add-AppxPackage $env:RUNNER_TEMP/winget-install/winget.msixbundle - - - name: Wait for Completion of Winget Installation - shell: pwsh - run: | - while ((Get-Command * | Select-String winget)?.ToString() -ne "winget.exe") { - Start-Sleep -Seconds 1 - } - Write-Output "Winget Version: $(winget --version)" - - - name: Install winget Powershell Module - shell: pwsh - run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d9c823056..96454f233 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,10 +19,15 @@ env: jobs: build: name: Build - runs-on: windows-latest strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - name: windows-latest + arch: amd64 + - name: windows-11-arm + arch: arm64 + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -46,32 +51,29 @@ jobs: arch: amd64 - name: aarch64-pc-windows-msvc arch: arm64 + + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force - } - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) @@ -98,7 +100,7 @@ jobs: - name: Package Examples (via Cargo Make) run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} - # Run cargo-wdk on examples + # Run cargo-wdk on examples and tests - name: Install cargo-wdk run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 47ece59a9..2fb1c2755 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -55,26 +55,21 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force - } - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: 'amd64' # windows-latest is x64-based target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 91f019ab8..ccb12f42a 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -17,10 +17,15 @@ env: jobs: docs: name: Docs - runs-on: windows-latest strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - name: windows-latest + arch: amd64 + - name: windows-11-arm + arch: arm64 + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -45,31 +50,28 @@ jobs: - name: aarch64-pc-windows-msvc arch: arm64 + runs-on: ${{ matrix.runner.name }} + steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force - } - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) @@ -83,6 +85,5 @@ jobs: run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --workspace --exclude wdk-macros --all-features - name: Run Cargo Doc w/ proc-macro crates - if: matrix.target_triple.name == 'x86_64-pc-windows-msvc' # cargo doc can only generate documentation for proc-macro crates when --target is not specified due to a cargo doc bug: https://github.com/rust-lang/cargo/issues/7677 run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --all-features diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 3ce57ff6d..25ab069ca 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,12 +18,17 @@ env: jobs: clippy: name: Clippy - runs-on: windows-latest permissions: checks: write strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - name: windows-latest + arch: amd64 + - name: windows-11-arm + arch: arm64 + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -48,31 +53,28 @@ jobs: - name: aarch64-pc-windows-msvc arch: arm64 + runs-on: ${{ matrix.runner.name }} + steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force - } - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index ae05ee366..cee74797a 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -17,10 +17,15 @@ env: jobs: build: name: Test WDR's local cargo-make Makefile - runs-on: windows-latest strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - name: windows-latest + arch: amd64 + - name: windows-11-arm + arch: arm64 + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -30,57 +35,44 @@ jobs: llvm: - 17.0.6 - target_triple: - - name: x86_64-pc-windows-msvc - arch: amd64 - # - name: aarch64-pc-windows-msvc FIXME: validate on aarch64 - # arch: arm64 - + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force - } - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based - target: ${{ matrix.target_triple.arch }} + host: ${{ matrix.runner.arch }} + target: ${{ matrix.runner.arch }} - - name: Install Nightly Rust Toolchain (${{ matrix.target_triple.name }}) + - name: Install Nightly Rust Toolchain uses: dtolnay/rust-toolchain@nightly with: components: clippy, rustfmt - targets: ${{ matrix.target_triple.name }} - - name: Install Beta Rust Toolchain (${{ matrix.target_triple.name }}) + - name: Install Beta Rust Toolchain uses: dtolnay/rust-toolchain@beta with: components: clippy - targets: ${{ matrix.target_triple.name }} - - name: Install Stable Rust Toolchain (${{ matrix.target_triple.name }}) + - name: Install Stable Rust Toolchain uses: dtolnay/rust-toolchain@stable with: components: clippy - targets: ${{ matrix.target_triple.name }} - name: Install Cargo Make uses: taiki-e/install-action@v2 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7638a3ba5..f14076616 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,10 +14,15 @@ concurrency: jobs: test: name: Test - runs-on: windows-latest strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - name: windows-latest + arch: amd64 + - name: windows-11-arm + arch: arm64 + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -36,43 +41,34 @@ jobs: - dev - release - target_triple: - - name: x86_64-pc-windows-msvc - arch: amd64 - # - aarch64-pc-windows-msvc FIXME: Add support for executing ARM64 tests. Maybe use target specific test runner in emulator: https://doc.rust-lang.org/cargo/reference/config.html#target + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force - } - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based - target: ${{ matrix.target_triple.arch }} + host: ${{ matrix.runner.arch }} + target: ${{ matrix.runner.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust_toolchain }} - targets: ${{ matrix.target_triple.name }} - name: Install Cargo Expand uses: taiki-e/install-action@v2 @@ -80,4 +76,4 @@ jobs: tool: cargo-expand@1.0.85 - name: Run Cargo Test - run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --all-features + run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --all-features