Skip to content

fixed string with newlines #84

fixed string with newlines

fixed string with newlines #84

Workflow file for this run

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
}