-
Notifications
You must be signed in to change notification settings - Fork 37
113 lines (94 loc) · 3.83 KB
/
general.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: "CI/CD"
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
env:
CARGO_TERM_COLOR: always
jobs:
Unit-Tests:
name: Unit Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
mode: [debug, release]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Setup rust-cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.mode }}
- name: Install latest nextest
uses: taiki-e/install-action@nextest
- name: Install winget
if: runner.os == 'Windows'
uses: Cyberboss/install-winget@v1
- name: Check formatting
run: cargo +stable fmt --all -- --check
## System dependencies
# Install dependencies only on Linux
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libudev-dev libpcap-dev
# Install dependencies only on Windows
- name: Download Npcap SDK (Windows)
if: runner.os == 'Windows'
run: |
winget install DaiyuuNobori.Win10Pcap --accept-source-agreements --accept-package-agreements
dir "C:\Program Files (x86)\Win10Pcap"
dir "C:\Program Files (x86)\Win10Pcap\x64"
- name: Set Library and Include Paths (Windows)
if: runner.os == 'Windows'
run: |
Add-Content -Path $env:GITHUB_ENV -Value "LIB=C:\Program Files (x86)\Win10Pcap\x64"
- name: Set build mode (Linux / MacOS)
if: runner.os != 'Windows'
run: echo "RELEASE_FLAG=$([[ '${{ matrix.mode }}' == 'release' ]] && echo '--release' || echo '')" >> $GITHUB_ENV
- name: Set build mode (Windows)
if: runner.os == 'Windows' && matrix.mode == 'release'
run: |
Add-Content -Path $env:GITHUB_ENV -Value "RELEASE_FLAG=--release"
# Run Clippy and build
- name: Run clippy on (${{ matrix.os }} | ${{matrix.mode}})
run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets -- --deny warnings
- name: Run clippy with all features on (${{ matrix.os }} | ${{matrix.mode}})
run: cargo +stable clippy $RELEASE_FLAG --workspace --all-targets --all-features -- --deny warnings
- name: Run build with all features on $(${{ matrix.os }} | ${{matrix.mode}})
run: cargo +stable build $RELEASE_FLAG --workspace --all-targets --all-features
- name: Run doctests on (${{ matrix.os }} | debug)
if: matrix.mode == 'debug'
run: cargo +stable test --doc --workspace
# Run Unit Tests
- name: Run Unit Tests on (${{ matrix.os }} | ${{matrix.mode}})
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace
- name: Run Unit Tests with all features on (${{ matrix.os }} | ${{matrix.mode}})
run: cargo +stable nextest run $RELEASE_FLAG --all-targets --workspace --all-features
# Run Project Generation Tests
- name: Install cargo-generate on (${{ matrix.os }} | debug)
if: matrix.mode == 'debug'
run: cargo +stable install cargo-generate
- name: Generate new project on (${{ matrix.os }} | debug)
if: matrix.mode == 'debug'
run: |
cd templates
cargo +stable generate -p cu_full --name test_project --destination . -d copper_source=local --silent
- name: Build generated project on (${{ matrix.os }} | debug)
if: matrix.mode == 'debug'
run: |
cd templates/test_project
cargo +stable build
typos:
name: Typos Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master
with:
config: ./.config/_typos.toml