-
Notifications
You must be signed in to change notification settings - Fork 37
158 lines (132 loc) · 6.39 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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, cuda-release ]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- 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
- name: Free Disk Space (Ubuntu)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
# do not remove large-packages, as it is necessary
large-packages: false
docker-images: true
swap-storage: true
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y pkg-config libudev-dev libpcap-dev libglib2.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
# Install GStreamer Runtime
Invoke-WebRequest -Uri https://gstreamer.freedesktop.org/data/pkg/windows/1.24.12/msvc/gstreamer-1.0-msvc-x86_64-1.24.12.msi -OutFile gstreamer-runtime.msi
Start-Process msiexec.exe -ArgumentList '/i gstreamer-runtime.msi /quiet /norestart' -NoNewWindow -Wait
Remove-Item gstreamer-runtime.msi
# Install GStreamer Development
Invoke-WebRequest -Uri https://gstreamer.freedesktop.org/data/pkg/windows/1.24.12/msvc/gstreamer-1.0-devel-msvc-x86_64-1.24.12.msi -OutFile gstreamer-devel.msi
Start-Process msiexec.exe -ArgumentList '/i gstreamer-devel.msi /quiet /norestart' -NoNewWindow -Wait
Remove-Item gstreamer-devel.msi
# Set environment variables for GStreamer
echo "GSTREAMER_1_0_ROOT_MSVC_X86_64=C:\gstreamer\1.0\msvc_x86_64" | Out-File -Append -Encoding utf8 $env:GITHUB_ENV
echo "PATH=$env:GSTREAMER_1_0_ROOT_MSVC_X86_64\bin;$env:PATH" | Out-File -Append -Encoding utf8 $env:GITHUB_ENV
# Install PCAP
Invoke-WebRequest -Uri https://npcap.com/dist/npcap-sdk-1.13.zip -OutFile npcap-sdk.zip
Expand-Archive -Path npcap-sdk.zip -DestinationPath $env:USERPROFILE\npcap-sdk
Remove-Item npcap-sdk.zip
winget install DaiyuuNobori.Win10Pcap --accept-source-agreements --accept-package-agreements
Add-Content -Path $env:GITHUB_ENV -Value "LIB=$env:USERPROFILE\npcap-sdk\Lib\x64"
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install pkg-config glib gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad
- name: Install CUDA
uses: Jimver/cuda-toolkit@master
if: runner.os != 'macOS' && matrix.mode == 'cuda-release'
with:
cuda: 12.6.1
log-file-suffix: '${{ matrix.os }}-${{ matrix.mode }}-cuda.txt'
- name: Set build mode (Linux / MacOS)
if: runner.os != 'Windows' && ( matrix.mode == 'release' || matrix.mode == 'cuda-release' )
run: echo "RELEASE_FLAG=--release" >> $GITHUB_ENV
- name: Set build mode (Windows)
if: runner.os == 'Windows' && ( matrix.mode == 'release' || matrix.mode == 'cuda-release' )
run: |
Add-Content -Path $env:GITHUB_ENV -Value "RELEASE_FLAG=--release"
- name: Set features (Linux / MacOS)
if: runner.os != 'Windows'
run: echo "FEATURES_FLAG=$([[ '${{ matrix.mode }}' == 'cuda-release' ]] && echo '--all-features' || echo '--features macro_debug,mock,image,kornia')" >> $GITHUB_ENV
- name: Set features (Windows)
if: runner.os == 'Windows'
run: |
$features = if ($env:matrix_mode -eq 'cuda-release') {
'--all-features'
} else {
'--features macro_debug,mock,image,kornia'
}
Add-Content -Path $env:GITHUB_ENV -Value "FEATURES_FLAG=$features"
# 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 $FEATURES_FLAG -- --deny warnings
- name: Run build with all features on (${{ matrix.os }} | ${{matrix.mode}})
run: cargo +stable build $RELEASE_FLAG --workspace --all-targets $FEATURES_FLAG
- 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 $FEATURES_FLAG
# 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