Skip to content

readme

readme #17

Workflow file for this run

name: Build PyCron Video Alarm
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
jobs:
check-trigger:
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.check.outputs.should_build }}
steps:
- name: Check commit/PR message for 'build'
id: check
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
MSG=$(echo "${COMMIT_MSG}${PR_TITLE}" | tr '[:upper:]' '[:lower:]')
if [[ "$MSG" == build* ]]; then
echo "should_build=true" >> $GITHUB_OUTPUT
else
echo "should_build=false" >> $GITHUB_OUTPUT
fi
build-linux:
runs-on: ubuntu-latest
needs: check-trigger
if: needs.check-trigger.outputs.should_build == 'true'
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-tk libxcb-cursor0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build with PyInstaller
run: |
export TZ='America/New_York'
TS=$(date +'%Y-%m-%d_%H%M')
BUILD_DATE=$(date +'%Y-%m-%d %H:%M EST')
echo "Built: $BUILD_DATE" > version.txt
echo "Archive: ${TS}_PyCronVideoAlarm_Linux" >> version.txt
pyinstaller --noconfirm --onefile --windowed \
--name "PyCronVideoAlarm_Linux" \
--icon "icons/alarm_icon7.ico" \
--add-data "src:src" \
--add-data "icons/alarm_icon7.ico:." \
--add-data "icons/alarm_icon7.png:." \
--add-data "version.txt:." \
--add-data "LICENSE:." \
--hidden-import=crontab \
--hidden-import=jeepney \
--exclude-module=cv2 \
--exclude-module=numpy \
--exclude-module=scipy \
--exclude-module=pandas \
--exclude-module=matplotlib \
--exclude-module=sounddevice \
src/main.py
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: PyCronVideoAlarm_Linux
path: dist/PyCronVideoAlarm_Linux
build-windows:
runs-on: windows-latest
needs: check-trigger
if: needs.check-trigger.outputs.should_build == 'true'
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build with PyInstaller
run: |
$tz = [System.TimeZoneInfo]::FindSystemTimeZoneById("Eastern Standard Time")
$est = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), $tz)
$ts = $est.ToString('yyyy-MM-dd_HHmm')
"Built: $($est.ToString('yyyy-MM-dd HH:mm')) EST" | Out-File -FilePath version.txt -Encoding utf8
"Archive: ${ts}_PyCronVideoAlarm_Windows.exe" | Add-Content -Path version.txt -Encoding utf8
pyinstaller --noconfirm --onefile --windowed `
--name "PyCronVideoAlarm_Windows" `
--icon="icons/alarm_icon7.ico" `
--add-data "src;src" `
--add-data "icons/alarm_icon7.ico;." `
--add-data "icons/alarm_icon7.png;." `
--add-data "bin;bin" `
--add-data "version.txt;." `
--add-data "LICENSE;." `
--hidden-import=pycaw `
--hidden-import=comtypes `
--hidden-import=comtypes.stream `
--exclude-module=cv2 `
--exclude-module=numpy `
--exclude-module=scipy `
--exclude-module=pandas `
--exclude-module=sounddevice `
src/main.py
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: PyCronVideoAlarm_Windows
path: dist/PyCronVideoAlarm_Windows.exe