Skip to content

Detect theme changes on PR and raise a warning, generate and save a diff in the job artifacts #310

Detect theme changes on PR and raise a warning, generate and save a diff in the job artifacts

Detect theme changes on PR and raise a warning, generate and save a diff in the job artifacts #310

name: Simple program (Windows)
on:
push:
branches:
- main
- 'releases/**'
pull_request:
jobs:
simple-program:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Run simple-program.py during 20 seconds
run: |
# For tests there is no real HW: use simulated LCD mode
(Get-Content simple-program.py) -replace "^REVISION.*$","REVISION=`"SIMU`"" | Set-Content simple-program.py
# Run the program for 20s
Start-Process -NoNewWindow python3 simple-program.py -RedirectStandardOutput output.log -RedirectStandardError error.log
sleep 20
add-content output.log (get-content error.log)
- name: Check output for errors
run: |
echo "######## Output : ########"
cat output.log
$SEL = Select-String -Path output.log -Pattern "error"
if ($SEL -ne $null)
{
throw "Program failed to run, see output above"
}
$SEL = Select-String -Path output.log -Pattern "traceback"
if ($SEL -ne $null)
{
throw "Program failed to run, see output above"
}
$SEL = Select-String -Path output.log -Pattern "exception"
if ($SEL -ne $null)
{
throw "Program failed to run, see output above"
}
- name: Prepare screenshot for archiving
run: |
cp screencap.png screenshot-py${{ matrix.python-version }}.png
- name: Archive a screenshot
uses: actions/upload-artifact@v3
with:
name: screenshot-py${{ matrix.python-version }}
path: screenshot-*.png