forked from Ekristoffe/ModbusSniffer
-
Notifications
You must be signed in to change notification settings - Fork 2
151 lines (133 loc) · 3.61 KB
/
Copy pathci.yml
File metadata and controls
151 lines (133 loc) · 3.61 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
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
name: CI Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
test_and_lint:
name: Test and Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libegl-mesa0 \
libegl1 \
libgl1 \
libgl1-mesa-dri \
xvfb \
libxrender1 \
libxext6 \
libxrandr2 \
libxi6 \
libfontconfig1 \
libxcb-glx0 \
libxcb-render0 \
libxcb-shape0 \
libxcb-xfixes0
- uses: actions/setup-python@v4
with:
python-version: '3.12.3'
- name: Install Python dependencies
run: |
python -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -e ".[dev]"
- name: Lint with flake8
run: |
.venv/bin/flake8 src/modbus_sniffer
- name: Run tests with Xvfb
uses: GabrielBB/xvfb-action@v1
with:
run: .venv/bin/pytest --cov=src/modbus_sniffer tests/
env:
QT_QPA_PLATFORM: offscreen
build_linux:
name: Build Linux Binary
runs-on: ubuntu-latest
needs: test_and_lint
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libegl-mesa0 \
libegl1 \
libgl1 \
libgl1-mesa-dri \
xvfb \
libxrender1 \
libxext6 \
libxrandr2 \
libxi6 \
libfontconfig1 \
libxcb-glx0 \
libxcb-render0 \
libxcb-shape0 \
libxcb-xfixes0
- uses: actions/setup-python@v4
with:
python-version: '3.12.3'
- name: Install Python dependencies
run: |
python -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -e ".[dev]"
- name: Build Linux binary
run: |
.venv/bin/pyinstaller \
--onefile \
--name "ModbusSniffer" \
--paths="src" \
--hidden-import modbus_sniffer.modbus_parser_new \
src/modbus_sniffer/gui.py
- name: Verify Linux binary exists
run: |
if [ ! -f "dist/ModbusSniffer" ]; then
echo "::error::Binary file was not created!"
ls -la dist/
exit 1
else
echo "Binary file exists:"
ls -la dist/ModbusSniffer
file dist/ModbusSniffer
fi
build_windows:
name: Build Windows Binary
runs-on: windows-latest
needs: test_and_lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12.3'
- name: Install Python dependencies
run: |
python -m venv .venv
.venv\Scripts\pip install --upgrade pip
.venv\Scripts\pip install -e ".[dev]"
- name: Build Windows binary
run: |
.venv\Scripts\pyinstaller `
--onefile `
--noconsole `
--name "ModbusSniffer" `
--paths="src" `
--hidden-import modbus_sniffer.modbus_parser_new `
--icon="images/icon.ico" `
src/modbus_sniffer/gui.py
- name: Verify Windows binary exists
run: |
if (!(Test-Path -Path "dist\ModbusSniffer.exe")) {
Write-Error "Binary file was not created!"
Get-ChildItem -Path dist
exit 1
} else {
Write-Output "Binary file exists:"
Get-ChildItem -Path dist\ModbusSniffer.exe
}