Skip to content

Commit

Permalink
Fix: Code quality was not enforced
Browse files Browse the repository at this point in the history
Problem: The code quality of the source code and the scripts was not verified automatically and could result into bugs or noisy commits from other contributors when fixing them.

Solution:

1. Add the tool `flake8` to the CI tests and adds code quality on the runtime Python code.

2. Enable Python tests on the runtime init as well.

3. Add `shellcheck` to check the quality of shell scripts.
  • Loading branch information
hoh committed Sep 25, 2023
1 parent afe69d3 commit 2b418e3
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Test code quality
on: push

jobs:
code-quality:
code-quality-python:
runs-on: ubuntu-22.04

steps:
Expand All @@ -26,16 +26,37 @@ jobs:
- name: Test with Black
run: |
black --check ./vm_supervisor
black --check ./runtimes/aleph-debian-11-python/init1.py
- name: Test with isort
run: |
isort --check-only --profile=black ./vm_supervisor
isort --check-only --profile=black ./runtimes/aleph-debian-11-python/init1.py
- name: Test with MyPy
run: |
mypy --ignore-missing-imports ./vm_supervisor
# mypy --config-file ./mypy.ini ./vm_supervisor
mypy --ignore-missing-imports ./runtimes/aleph-debian-11-python/init1.py
# - name: Test with flake8
# run: |
# flake8 ./vm_supervisor
- name: Test with flake8
run: |
flake8 --extend-ignore E501 ./vm_supervisor
flake8 --extend-ignore E501,E402 ./runtimes/aleph-debian-11-python/init1.py
code-quality-shell:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Workaround github issue https://github.com/actions/runner-images/issues/7192
run: sudo echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc

- name: Install required system packages only for Ubuntu Linux
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Run Shellcheck on all shell scripts
run: |
find ./ -type f -name "*.sh" -exec shellcheck {} \;

0 comments on commit 2b418e3

Please sign in to comment.