diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cdcd4fe9..58e0634e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,13 +44,21 @@ jobs: - name: Install libpcap (macos) if: matrix.os == 'macos-latest' run: brew install libpcap - - name: Install WinPcap and WinPcap 4.1.2 Developer's Pack (windows) + - name: Install npcap sdk (windows) if: matrix.os == 'windows-latest' run: | - cinst -y winpcap --version 4.1.3.20161116 - Invoke-WebRequest -Uri "https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip" -OutFile "C:/WpdPack.zip" - Expand-Archive -LiteralPath C:/WpdPack.zip -DestinationPath C:/ - echo "LIB=C:/WpdPack/Lib/x64" >> $env:GITHUB_ENV + 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 + - name: Install npcap dll (windows) + # Secrets are not passed to workflows that are triggered by a pull request from a fork. + # https://docs.github.com/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets + if: (matrix.os == 'windows-latest') && (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 - name: Select rust toolchain uses: actions-rs/toolchain@v1 with: @@ -60,6 +68,10 @@ jobs: - name: cargo build run: cargo build ${{ matrix.profile }} ${{ matrix.features }} - name: cargo test + # Since secrets are not passed to workflows that are triggered by a pull request from a fork + # the npcap dll won't be installed so we skip this step on pull requests. It will + # nevertheless be run once merged and the pull request will still verify the build steps. + if: (matrix.os != 'windows-latest') || (github.event_name != 'pull_request') run: cargo test ${{ matrix.profile }} ${{ matrix.features }} - name: cargo clippy if: matrix.toolchain == 'stable' diff --git a/README.md b/README.md index 852411eee..8a900ab3d 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ This crate requires the libpcap (or wpcap on Windows) library. ### Windows -1. Install [WinPcap](http://www.winpcap.org/install/default.htm). -2. Download the WinPcap [Developer's Pack](https://www.winpcap.org/devel.htm). -3. Add the `/Lib` or `/Lib/x64` folder to your `LIB` environment variable. +1. Install [Npcap](https://npcap.com/#download). +2. Download the [Npcap SDK](https://npcap.com/#download). +3. Add the SDK's `/Lib` or `/Lib/x64` folder to your `LIB` environment variable. ### Linux