Skip to content

Commit 45baeb3

Browse files
committed
🐎 ci: rust build
1 parent 6945435 commit 45baeb3

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

.github/workflows/rust.yml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
11
name: Rust
2-
3-
on:
4-
push:
5-
branches: [ "master", "dev" ]
6-
pull_request:
7-
branches: [ "master", "dev" ]
8-
2+
on: [push, pull_request]
93
env:
104
CARGO_TERM_COLOR: always
115

126
jobs:
137
build:
14-
15-
runs-on: ubuntu-latest
8+
env:
9+
NPCAP_SDK_URL: "https://npcap.com/dist/npcap-sdk-1.15.zip"
1610
strategy:
1711
matrix:
18-
toolchain:
19-
- nightly
12+
os: [ubuntu-latest, windows-latest]
13+
runs-on: ${{ matrix.os }}
2014
steps:
21-
- uses: actions/checkout@v4
22-
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
23-
- name: Build
24-
run: cargo build --verbose
25-
- name: Build for release
26-
run: cargo build --release --verbose
27-
- name: Run tests
28-
run: cargo test --verbose
15+
- uses: actions/checkout@v4
16+
- name: Set up Rust
17+
uses: dtolnay/rust-toolchain@nightly
18+
- name: Cache Windows dependencies
19+
if: matrix.os == 'windows-latest'
20+
id: cache-windows
21+
uses: actions/cache@v4
22+
with:
23+
key: ${{ env.NPCAP_SDK_URL }}
24+
path: .\Packet.lib
25+
- name: Install Windows dependencies
26+
if: matrix.os == 'windows-latest' && steps.cache-windows.outputs.cache-hit != 'true'
27+
shell: pwsh
28+
run: |
29+
$sdkPath = ".\tmp"
30+
mkdir $sdkPath
31+
Invoke-WebRequest -Uri $env:NPCAP_SDK_URL -OutFile "$sdkPath\npcap-sdk.zip"
32+
Expand-Archive -Path "$sdkPath\npcap-sdk.zip" -DestinationPath $sdkPath
33+
Copy-Item -Path "$sdkPath\Lib\x64\Packet.lib" -Destination .
34+
- name: Build
35+
run: cargo build --verbose
36+
- name: Build for release
37+
run: cargo build --release --verbose
38+
# - name: Run tests
39+
# run: cargo test --verbose

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)