From 40221ebfc36eaccf1634153a0b57ac2db5020966 Mon Sep 17 00:00:00 2001 From: Manuel Rom Date: Mon, 22 Mar 2021 11:12:42 +0100 Subject: [PATCH] Add Github action workflows for CI/CD * Add .github/workflows/check-full.yml, enabling: * Code checks (flake8, black, isort, vulture) * Unit tests (pytest) * Adapt the Makefile * Add vulture to codecheck target * Add test target with pytest --- .github/workflows/check-full.yml | 57 ++++++++++++++++++++++++++++++++++++++++ Makefile | 4 +++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/check-full.yml diff --git a/.github/workflows/check-full.yml b/.github/workflows/check-full.yml new file mode 100644 index 0000000..91d5ab6 --- /dev/null +++ b/.github/workflows/check-full.yml @@ -0,0 +1,57 @@ +name: Code Testing + +on: + push: + pull_request: + schedule: + - cron: '42 1 * * *' + +jobs: + codecheck: + runs-on: ubuntu-latest + name: Run codecheck + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Install virtualenv + python3-setuptools + run: sudo apt-get install virtualenv python3-setuptools + + - name: Set up Python virtualenv environment + run: virtualenv -p /usr/bin/python3 venv3 + + - name: Activate Python virtualenv environment + run: . ./venv3/bin/activate + + - name: pip install wheel (to make install black work) + run: pip3 install wheel + + - name: pip install flake8, isort + black, vulture + run: pip3 install flake8 isort black vulture + + - name: Codecheck execution + run: make codecheck + + unittests: + runs-on: ubuntu-latest + name: Run unit tests + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Install virtualenv + python3-setuptools + run: sudo apt-get install virtualenv python3-setuptools + + - name: Set up Python virtualenv environment + run: virtualenv -p /usr/bin/python3 venv3 + + - name: Activate Python virtualenv environment + run: . ./venv3/bin/activate + + - name: Install pytest + run: pip3 install pytest + + - name: Run Pytest + run: pytest diff --git a/Makefile b/Makefile index 7a3f516..6d506eb 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,10 @@ codecheck: flake8 grml2usb isort --check-only grml2usb black --check grml2usb + vulture grml2iso grml2usb test/grml2usb_test.py + +test: + pytest # graph: # sudo pycallgraph grml2usb /grml/isos/grml-small_2008.11.iso /dev/sdb1 -- 2.1.4