-
Notifications
You must be signed in to change notification settings - Fork 2
96 lines (76 loc) · 3.13 KB
/
continuous-integration.yml
File metadata and controls
96 lines (76 loc) · 3.13 KB
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
name: Continuous Integration
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
BUILD_TYPE: Release
jobs:
Linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install ninja-build libsocketcan-dev libreadline-dev cppcheck -y -qq
- name: Run cppcheck
run: |
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B build
cppcheck --project=build/compile_commands.json --enable=all --suppress=missingIncludeSystem --suppress=unusedFunction --inconclusive --force --std=c99 --error-exitcode=1
- name: Build CANvenient
run: |
cmake --build build
Windows:
needs: Linux
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Build x64
run: |
cmake -G "Ninja" -B build_x64 -DCMAKE_BUILD_TYPE=Release
cmake --build build_x64
- uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x86
- name: Build x86
run: |
cmake -G "Ninja" -B build_x86 -DCMAKE_BUILD_TYPE=Release
cmake --build build_x86
- name: Get short Git hash
id: git_hash
run: echo "sha=$(git rev-parse --short HEAD)" >> $env:GITHUB_OUTPUT
- name: Stage artifact layout
run: |
$root = "CANvenient"
New-Item -ItemType Directory -Force -Path "$root/bin/x64"
New-Item -ItemType Directory -Force -Path "$root/bin/x86"
New-Item -ItemType Directory -Force -Path "$root/include"
New-Item -ItemType Directory -Force -Path "$root/lib/x64"
New-Item -ItemType Directory -Force -Path "$root/lib/x86"
Copy-Item build_x64/CANvenient.dll "$root/bin/x64/CANvenient.dll"
Copy-Item build_x64/CANvenient.lib "$root/lib/x64/CANvenient.lib"
Copy-Item build_x86/CANvenient.dll "$root/bin/x86/CANvenient.dll"
Copy-Item build_x86/CANvenient.lib "$root/lib/x86/CANvenient.lib"
$vendorDlls_x64 = @("canchd_64.dll","canL2_64.dll","canlib32.dll","CANusbM.dll","PCANBasic.dll")
foreach ($dll in $vendorDlls_x64) {
if (Test-Path "build_x64/$dll") { Copy-Item "build_x64/$dll" "$root/bin/x64/$dll" }
}
$vendorDlls_x86 = @("canchd_64.dll","canL2.dll","canlib32.dll","CANusbM.dll","PCANBasic.dll")
foreach ($dll in $vendorDlls_x86) {
if (Test-Path "build_x86/$dll") { Copy-Item "build_x86/$dll" "$root/bin/x86/$dll" }
}
Copy-Item include/CANvenient.h "$root/include/CANvenient.h"
Copy-Item LICENSE.md "$root/LICENSE.md"
Copy-Item README.md "$root/README.md"
Compress-Archive -Path "$root" -DestinationPath "CANvenient-${{ steps.git_hash.outputs.sha }}.zip"
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: build-artifacts
path: CANvenient-${{ steps.git_hash.outputs.sha }}.zip