Skip to content

Commit

Permalink
Update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mathoudebine committed Nov 5, 2022
1 parent 83d2f14 commit 79f2544
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Integration tests
name: Lint with flake8

on: [push, pull_request]

jobs:
build:
lint-flake8:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python 3.x
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
python-version: '3.x'

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install flake8
run: |
python -m pip install --upgrade pip
python -m pip install flake8
python -m pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
68 changes: 68 additions & 0 deletions .github/workflows/simple-program.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Integration tests - simple program run

on: [push, pull_request]

jobs:
simple-program:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
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: |
sed -i 's/^REVISION.*$/REVISION=\"SIMU\"/g' simple-program.py
python3 simple-program.py > tests.log 2>&1 &
sleep 20
killall -9 python3
- name: View simple-program.py output
run: |
echo "######## Output : ########"
cat tests.log
- name: Check simple-program.py output for exceptions
run: |
if grep -q Exception tests.log; then
echo "Program failed to run, see output above"
false
fi
if grep -q Traceback tests.log; then
echo "Program failed to run, see output above"
false
fi
- name: Run default configuration
run: |
sed -i "/REVISION:/c\ REVISION: SIMU" config.yaml
timeout --preserve-status 20s python3 main.py > tests.log 2>&1
- name: View output
run: |
echo "######## Output : ########"
cat tests.log
- name: Check output for exceptions
run: |
if grep -q Exception tests.log; then
echo "Program failed to run, see output above"
false
fi
if grep -q Traceback tests.log; then
echo "Program failed to run, see output above"
false
fi
55 changes: 55 additions & 0 deletions .github/workflows/system-monitor-generic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: System monitor generic run

on:
workflow_call:
inputs:
theme:
required: true
type: string

jobs:
system-monitor-generic:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Configure system monitor
run: |
sed -i "/REVISION:/c\ REVISION: SIMU" config.yaml
echo "Using theme ${{ inputs.theme }}"
sed -i "/THEME:/c\ THEME: ${{ inputs.theme }}" config.yaml
- name: Run default configuration for 20 seconds
run: |
timeout --preserve-status 20s python3 main.py > tests.log 2>&1
- name: View output
run: |
echo "######## Output : ########"
cat tests.log
- name: Check output for exceptions
run: |
if grep -q Exception tests.log; then
echo "Program failed to run, see output above"
false
fi
if grep -q Traceback tests.log; then
echo "Program failed to run, see output above"
false
fi
21 changes: 21 additions & 0 deletions .github/workflows/system-monitor-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Integration tests - system monitor run

on: [push, pull_request]

jobs:
system-monitor-3_5inchTheme2:
uses: ./.github/workflows/system-monitor-generic.yml
with:
theme: 3.5inchTheme2
system-monitor-Cyberpunk:
uses: ./.github/workflows/system-monitor-generic.yml
with:
theme: Cyberpunk
system-monitor-Landscape6Grid:
uses: ./.github/workflows/system-monitor-generic.yml
with:
theme: Landscape6Grid
system-monitor-Terminal:
uses: ./.github/workflows/system-monitor-generic.yml
with:
theme: Terminal

0 comments on commit 79f2544

Please sign in to comment.