fix: warn when WDK env vars are non-UTF8 (#596) #3799
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| push: | |
| branches-ignore: | |
| - 'gh-readonly-queue/**' | |
| pull_request: | |
| merge_group: | |
| schedule: # Trigger a job on default branch at 4AM PST everyday | |
| - cron: 0 11 * * * | |
| name: Test | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| test: | |
| name: Test | |
| strategy: | |
| fail-fast: false # Allow all matrix variants to complete even if some fail | |
| matrix: | |
| runner: | |
| - name: windows-2025 | |
| arch: amd64 | |
| - name: windows-11-arm | |
| arch: arm64 | |
| wdk: | |
| - version: 10.0.22621 # NI WDK | |
| source: winget | |
| - version: 10.0.26100 # GE WDK | |
| source: nuget | |
| llvm: | |
| - 17.0.6 | |
| rust_toolchain: | |
| - stable | |
| - beta | |
| # Pin nightly version temporarily due to bug in macrotest: https://github.com/eupn/macrotest/issues/131 | |
| - nightly-2025-11-20 | |
| cargo_profile: | |
| - dev | |
| - release | |
| runs-on: ${{ matrix.runner.name }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v5 | |
| - name: Install Winget | |
| uses: ./.github/actions/install-winget | |
| with: | |
| # windows-11-arm runner image does not include winget-cli (see https://github.com/actions/partner-runner-images/issues/95). | |
| force-cli-install: ${{ matrix.runner.name == 'windows-11-arm' && 'true' || 'false' }} | |
| - name: Install LLVM ${{ matrix.llvm }} | |
| 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: ${{ matrix.wdk.source == 'nuget' && matrix.runner.arch || '' }} | |
| target: ${{ matrix.wdk.source == 'nuget' && matrix.runner.arch || '' }} | |
| - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) and LLVM tools | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust_toolchain }} | |
| components: llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| if: matrix.runner.arch != 'arm64' | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-llvm-cov | |
| - name: Install Cargo Expand | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: [email protected] | |
| - name: Install Cargo Make | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-make | |
| # Code coverage is generated only for amd64 because cargo-llvm-cov | |
| # does not currently support Windows on arm64. | |
| # See issue: https://github.com/taiki-e/cargo-llvm-cov/issues/436 | |
| - name: Run Cargo Test with Coverage (workspace) | |
| if: matrix.runner.arch != 'arm64' | |
| env: | |
| # cargo-wdk new tests try to build newly generated | |
| # driver projects which can fail in release-plz PRs | |
| # because the dependencies are not yet published. | |
| # This env var skips such builds for release-plz PRs | |
| SKIP_BUILD_IN_CARGO_WDK_NEW_TESTS: ${{ startsWith(github.head_ref, 'release-plz-') && '1' || '' }} | |
| run: cargo +${{ matrix.rust_toolchain }} llvm-cov --workspace --codecov --output-path target/codecov.info --locked --profile ${{ matrix.cargo_profile }} --all-features | |
| - name: Upload Coverage to Codecov | |
| if: matrix.runner.arch != 'arm64' && github.repository == 'microsoft/windows-drivers-rs' # Skip for forks because they may not have CODECOV_TOKEN | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: target/codecov.info | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true | |
| - name: Run Cargo Test (workspace) | |
| if: matrix.runner.arch == 'arm64' | |
| env: | |
| # Skips build in cargo-wdk new tests for release-plz PRs | |
| SKIP_BUILD_IN_CARGO_WDK_NEW_TESTS: ${{ startsWith(github.head_ref, 'release-plz-') && '1' || '' }} | |
| run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --all-features | |
| - name: Run Cargo Test (Top-Level tests Folder via Cargo Make) | |
| run: cargo +${{ matrix.rust_toolchain }} make --cwd ./tests test --locked --profile ${{ matrix.cargo_profile }} |