Skip to content

Commit

Permalink
Npcap CI (#273)
Browse files Browse the repository at this point in the history
* First attempt at npcap oem in ci

* Try with credential object

* Fix path

* Missing top-level dir in npcap-sdk

* Re-enable full CI

* Restrict ci to account for secrets on public forks

* Update README to point to npcap for windows [no ci]
  • Loading branch information
Wojtek242 authored Aug 29, 2022
1 parent 15c8b32 commit 348aa8b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 348aa8b

Please sign in to comment.