Merge pull request #639 from mathoudebine/dev/add-weather-and-ping-to… #179
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: System monitor - themes screenshot (on push) | |
on: | |
push: | |
branches: | |
- main | |
- 'releases/**' | |
jobs: | |
system-monitor-theme-screenshot: | |
# Don't run this action on forked repositories to avoid conflicts in PR... | |
if: github.repository == 'mathoudebine/turing-smart-screen-python' | |
runs-on: ubuntu-latest | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
- name: Configure system monitor for screenshot | |
run: | | |
# Use static data | |
sed -i "/HW_SENSORS:/c\ HW_SENSORS: STATIC" config.yaml | |
- name: Run system monitor for 5 seconds on all themes | |
run: | | |
for dir in res/themes/*/ | |
do | |
if test -f "$dir/theme.yaml"; then | |
# Keep only folder name | |
theme=`basename "${dir%*/}"` | |
# Setup selected theme in config.yaml | |
echo "Using theme $theme" | |
sed -i '/THEME:/c\ THEME: "'"$theme"'"' config.yaml | |
# For tests there is no real HW: use simulated LCD mode | |
# Check if theme is for 5" | |
orientation=$(grep 'DISPLAY_SIZE' "$dir/theme.yaml" | sed 's/ //g') | |
if [ "$orientation" == "DISPLAY_SIZE:5\"" ]; then | |
sed -i "/REVISION:/c\ REVISION: SIMU5" config.yaml | |
else | |
sed -i "/REVISION:/c\ REVISION: SIMU" config.yaml | |
fi | |
# Run system-monitor for 10 seconds | |
python3 main.py > output.log 2>&1 & | |
sleep 10 | |
killall -9 python3 | |
# Copy screen capture on theme folder | |
cp screencap.png "$dir/preview.png" | |
fi | |
done | |
- name: Generate theme list Markdown page | |
run: | | |
python3 tools/theme-preview-generator.py | |
- name: Commit theme previews | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "[GitHub Actions Bot] Update theme previews" | |
file_pattern: 'res/themes/*/preview.png res/themes/themes.md' | |
status_options: '--untracked-files=no' | |
- name: Run if changes have been detected | |
if: steps.auto-commit-action.outputs.changes_detected == 'true' | |
run: echo "Theme previews have changed!" |