diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/lint-flake8.yml similarity index 56% rename from .github/workflows/integration-tests.yml rename to .github/workflows/lint-flake8.yml index 8a060ca4..c10c017c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/lint-flake8.yml @@ -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 - diff --git a/.github/workflows/simple-program.yml b/.github/workflows/simple-program.yml new file mode 100644 index 00000000..ab36b021 --- /dev/null +++ b/.github/workflows/simple-program.yml @@ -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 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 + + - 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 \ No newline at end of file diff --git a/.github/workflows/system-monitor-generic.yml b/.github/workflows/system-monitor-generic.yml new file mode 100644 index 00000000..b86bd0f0 --- /dev/null +++ b/.github/workflows/system-monitor-generic.yml @@ -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 system monitor 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 \ No newline at end of file diff --git a/.github/workflows/system-monitor-tests.yml b/.github/workflows/system-monitor-tests.yml new file mode 100644 index 00000000..3df6bfb8 --- /dev/null +++ b/.github/workflows/system-monitor-tests.yml @@ -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 \ No newline at end of file