From bc8db13495c359430ba09be53e5a73df2802bb4e Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Fri, 3 May 2024 11:05:05 +0200 Subject: [PATCH] Revert "Run all tests on Windows (#356)" This reverts commit 8e3fdd10ff4116de86de756f20f0ab37e280394e. --- .github/workflows/00-windows.yml | 3 --- .../workflows/01-build-and-test-windows.yml | 20 ++++++++--------- .github/workflows/02-coverage.yml | 22 +++++++------------ 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.github/workflows/00-windows.yml b/.github/workflows/00-windows.yml index 87f6cc35..2eaf1026 100644 --- a/.github/workflows/00-windows.yml +++ b/.github/workflows/00-windows.yml @@ -32,9 +32,6 @@ jobs: uses: './.github/workflows/02-coverage.yml' with: os: 'windows-latest' - secrets: - NPCAP_OEM_PASSWORD: ${{ secrets.NPCAP_OEM_PASSWORD }} - NPCAP_OEM_USERNAME: ${{ secrets.NPCAP_OEM_USERNAME }} windows-lint-stable: uses: './.github/workflows/03-lint.yml' diff --git a/.github/workflows/01-build-and-test-windows.yml b/.github/workflows/01-build-and-test-windows.yml index 0f2bee0d..c6716d20 100644 --- a/.github/workflows/01-build-and-test-windows.yml +++ b/.github/workflows/01-build-and-test-windows.yml @@ -21,7 +21,6 @@ env: RUST_BACKTRACE: 1 CARGO_TERM_VERBOSE: true CARGO_TERM_COLOR: always - PCAP_CI_TEST_TARGETS: ${{ (github.event_name == 'pull_request') && '--lib' || '--all-targets' }} jobs: build-and-test: @@ -45,17 +44,18 @@ jobs: rustup override set ${{ inputs.toolchain }} - if: inputs.msrv run: cp msrv.lock Cargo.lock - # Note that since secrets are not passed to workflows triggered by a pull request from a fork, - # it is not possible to run integration tests on pull requests. + # Until #275 is resolved, we will not run integration tests on Windows. Note that since + # secrets are not passed to workflows triggered by a pull request from a fork, it will still + # not be possible to run integration tests on pull requests. - run: cargo build --all-targets - - run: cargo test ${{ env.PCAP_CI_TEST_TARGETS }} - - run: cargo build --all-targets --release - - run: cargo test ${{ env.PCAP_CI_TEST_TARGETS }} --release + - run: cargo test --lib + - run: cargo build --all-targets --release + - run: cargo test --lib --release - if: ${{ ! inputs.msrv }} - run: cargo build --all-targets --all-features + run: cargo build --all-targets --all-features - if: ${{ ! inputs.msrv}} - run: cargo test ${{ env.PCAP_CI_TEST_TARGETS }} --all-features + run: cargo test --lib --all-features - if: ${{ ! inputs.msrv }} - run: cargo build --all-targets --release --all-features + run: cargo build --all-targets --release --all-features - if: ${{ ! inputs.msrv}} - run: cargo test ${{ env.PCAP_CI_TEST_TARGETS }} --release --all-features + run: cargo test --lib --release --all-features diff --git a/.github/workflows/02-coverage.yml b/.github/workflows/02-coverage.yml index 2284b408..3aedde01 100644 --- a/.github/workflows/02-coverage.yml +++ b/.github/workflows/02-coverage.yml @@ -4,17 +4,11 @@ on: os: required: true type: string - secrets: - NPCAP_OEM_PASSWORD: - required: false - NPCAP_OEM_USERNAME: - required: false env: RUST_BACKTRACE: 1 CARGO_TERM_VERBOSE: true CARGO_TERM_COLOR: always - PCAP_CI_TEST_TARGETS: ${{ contains(inputs.os, 'windows') && (github.event_name == 'pull_request') && '--lib' || '--all-targets' }} PCAP_CI_GRCOV_CMD: >- ${{ contains(inputs.os, 'windows') && 'C:/grcov' || './grcov' }} target/debug/profraw @@ -51,12 +45,6 @@ jobs: Invoke-WebRequest -Uri "https://npcap.com/dist/npcap-sdk-1.13.zip" -OutFile "C:/npcap-sdk.zip" Expand-Archive -LiteralPath C:/npcap-sdk.zip -DestinationPath C:/npcap-sdk echo "LIB=C:/npcap-sdk/Lib/x64" >> $env:GITHUB_ENV - - if: ${{ contains(inputs.os, 'windows') && (github.event_name != 'pull_request') }} - run: | - $SecPassword = ConvertTo-SecureString "${{ secrets.NPCAP_OEM_PASSWORD }}" -AsPlainText -Force - $CredObject = New-Object System.Management.Automation.PSCredential ("${{ secrets.NPCAP_OEM_USERNAME }}", $SecPassword) - Invoke-WebRequest -Uri "https://npcap.com/oem/dist/npcap-1.71-oem.exe" -OutFile C:/npcap-oem.exe -Credential $CredObject - C:/npcap-oem.exe /S # No installation of actuall library since we cannot install OEM pcap on pull request branches # anyway. We'll just be running unit tests on Windows. No integration tests. - run: | @@ -76,7 +64,10 @@ jobs: Invoke-WebRequest -Uri "https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-pc-windows-msvc.zip" -OutFile C:/grcov.zip Expand-Archive -LiteralPath C:/grcov.zip -DestinationPath C:/ # Coverage without features. - - run: cargo test ${{ env.PCAP_CI_TEST_TARGETS }} --no-fail-fast + - if: ${{ contains(inputs.os, 'windows') }} + run: cargo test --lib --no-fail-fast + - if: ${{ ! contains(inputs.os, 'windows') }} + run: cargo test --all-targets --no-fail-fast - run: ${{ env.PCAP_CI_GRCOV_CMD }} - run: ${{ env.PCAP_CI_COV_CMD }} --fail-under ${{ env.PCAP_CI_COV_FAIL_UNDER_NO_FEATURES }} # Clean up coverage artifacts. @@ -88,7 +79,10 @@ jobs: run: rm -rf ./target/debug/{coverage,profraw} - run: cargo clean -p pcap # Coverage with features. - - run: cargo test ${{ env.PCAP_CI_TEST_TARGETS }} --all-features --no-fail-fast + - if: ${{ contains(inputs.os, 'windows') }} + run: cargo test --lib --all-features --no-fail-fast + - if: ${{ ! contains(inputs.os, 'windows') }} + run: cargo test --all-targets --all-features --no-fail-fast - run: ${{ env.PCAP_CI_GRCOV_CMD }} - run: ${{ env.PCAP_CI_COV_CMD }} --fail-under ${{ env.PCAP_CI_COV_FAIL_UNDER_ALL_FEATURES }} # On push to main push results to coverage branch.