|
| 1 | +name: System monitor (Windows) |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + system-monitor: |
| 7 | + |
| 8 | + runs-on: windows-latest |
| 9 | + |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + python-version: ["3.7", "3.8", "3.9", "3.10"] |
| 14 | + theme: [ "3.5inchTheme2", "Cyberpunk", "Landscape6Grid", "Terminal", "bash-dark-green" ] |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + - name: Set up Python ${{ matrix.python-version }} |
| 19 | + uses: actions/setup-python@v3 |
| 20 | + with: |
| 21 | + python-version: ${{ matrix.python-version }} |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + python -m pip install --upgrade pip |
| 26 | + python -m pip install -r requirements.txt |
| 27 | +
|
| 28 | + - name: Configure system monitor |
| 29 | + run: | |
| 30 | + # For tests there is no real HW: use simulated LCD mode |
| 31 | + (Get-Content config.yaml) -replace "^ REVISION.*$"," REVISION: SIMU" | Set-Content config.yaml |
| 32 | + |
| 33 | + # Setup selected theme in config.yaml |
| 34 | + echo "Using theme ${{ matrix.theme }}" |
| 35 | + (Get-Content config.yaml) -replace "^ THEME.*$"," THEME: ${{ matrix.theme }}" | Set-Content config.yaml |
| 36 | +
|
| 37 | + - name: Run system monitor for 20 seconds |
| 38 | + run: | |
| 39 | + Start-Process -NoNewWindow python3 main.py -RedirectStandardOutput output.log -RedirectStandardError error.log |
| 40 | + sleep 20 |
| 41 | + add-content output.log (get-content error.log) |
| 42 | +
|
| 43 | + - name: Check output for errors |
| 44 | + run: | |
| 45 | + echo "######## Output : ########" |
| 46 | + cat output.log |
| 47 | + |
| 48 | + $SEL = Select-String -Path output.log -Pattern "error" |
| 49 | + if ($SEL -ne $null) |
| 50 | + { |
| 51 | + throw "Program failed to run, see output above" |
| 52 | + } |
| 53 | + $SEL = Select-String -Path output.log -Pattern "traceback" |
| 54 | + if ($SEL -ne $null) |
| 55 | + { |
| 56 | + throw "Program failed to run, see output above" |
| 57 | + } |
| 58 | + $SEL = Select-String -Path output.log -Pattern "exception" |
| 59 | + if ($SEL -ne $null) |
| 60 | + { |
| 61 | + throw "Program failed to run, see output above" |
| 62 | + } |
0 commit comments