Skip to content

Commit b374f3b

Browse files
authored
Merge pull request #79 from mathoudebine/feature/integration-test-github
Update integration tests
2 parents 83d2f14 + 98695dd commit b374f3b

File tree

4 files changed

+154
-12
lines changed

4 files changed

+154
-12
lines changed
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
4-
name: Integration tests
1+
name: Lint with flake8
52

63
on: [push, pull_request]
74

85
jobs:
9-
build:
6+
lint-flake8:
107

118
runs-on: ubuntu-latest
129
strategy:
1310
fail-fast: false
14-
matrix:
15-
python-version: ["3.7", "3.8", "3.9", "3.10"]
1611

1712
steps:
1813
- uses: actions/checkout@v3
19-
- name: Set up Python ${{ matrix.python-version }}
14+
- name: Set up Python 3.x
2015
uses: actions/setup-python@v3
2116
with:
22-
python-version: ${{ matrix.python-version }}
23-
- name: Install dependencies
17+
python-version: '3.x'
18+
19+
- name: Display Python version
20+
run: python -c "import sys; print(sys.version)"
21+
22+
- name: Install flake8
2423
run: |
2524
python -m pip install --upgrade pip
2625
python -m pip install flake8
27-
python -m pip install -r requirements.txt
26+
2827
- name: Lint with flake8
2928
run: |
3029
# stop the build if there are Python syntax errors or undefined names
3130
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3231
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3332
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34-

.github/workflows/simple-program.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Integration tests - simple program run
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
simple-program:
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: ["3.7", "3.8", "3.9", "3.10"]
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install -r requirements.txt
25+
26+
- name: Run simple-program.py during 20 seconds
27+
run: |
28+
sed -i 's/^REVISION.*$/REVISION=\"SIMU\"/g' simple-program.py
29+
python3 simple-program.py > tests.log 2>&1 &
30+
sleep 20
31+
killall -9 python3
32+
33+
- name: View output
34+
run: |
35+
echo "######## Output : ########"
36+
cat tests.log
37+
38+
- name: Check output for exceptions
39+
run: |
40+
if grep -q Exception tests.log; then
41+
echo "Program failed to run, see output above"
42+
false
43+
fi
44+
if grep -q Traceback tests.log; then
45+
echo "Program failed to run, see output above"
46+
false
47+
fi
48+
49+
- name: Run default configuration
50+
run: |
51+
sed -i "/REVISION:/c\ REVISION: SIMU" config.yaml
52+
timeout --preserve-status 20s python3 main.py > tests.log 2>&1
53+
54+
- name: View output
55+
run: |
56+
echo "######## Output : ########"
57+
cat tests.log
58+
59+
- name: Check output for exceptions
60+
run: |
61+
if grep -q Exception tests.log; then
62+
echo "Program failed to run, see output above"
63+
false
64+
fi
65+
if grep -q Traceback tests.log; then
66+
echo "Program failed to run, see output above"
67+
false
68+
fi
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: System monitor generic run
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
theme:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
system-monitor-generic:
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.7", "3.8", "3.9", "3.10"]
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install -r requirements.txt
30+
31+
- name: Configure system monitor
32+
run: |
33+
sed -i "/REVISION:/c\ REVISION: SIMU" config.yaml
34+
echo "Using theme ${{ inputs.theme }}"
35+
sed -i "/THEME:/c\ THEME: ${{ inputs.theme }}" config.yaml
36+
37+
- name: Run system monitor for 20 seconds
38+
run: |
39+
timeout --preserve-status 20s python3 main.py > tests.log 2>&1
40+
41+
- name: View output
42+
run: |
43+
echo "######## Output : ########"
44+
cat tests.log
45+
46+
- name: Check output for exceptions
47+
run: |
48+
if grep -q Exception tests.log; then
49+
echo "Program failed to run, see output above"
50+
false
51+
fi
52+
if grep -q Traceback tests.log; then
53+
echo "Program failed to run, see output above"
54+
false
55+
fi
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Integration tests - system monitor run
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
system-monitor-3_5inchTheme2:
7+
uses: ./.github/workflows/system-monitor-generic.yml
8+
with:
9+
theme: 3.5inchTheme2
10+
system-monitor-Cyberpunk:
11+
uses: ./.github/workflows/system-monitor-generic.yml
12+
with:
13+
theme: Cyberpunk
14+
system-monitor-Landscape6Grid:
15+
uses: ./.github/workflows/system-monitor-generic.yml
16+
with:
17+
theme: Landscape6Grid
18+
system-monitor-Terminal:
19+
uses: ./.github/workflows/system-monitor-generic.yml
20+
with:
21+
theme: Terminal

0 commit comments

Comments
 (0)