Repository: CodeToCAD/CodeToCAD (language: python)

Issue:
Run linting and testing in GitHub Actions
GitHub Actions should run the `development/run_tests.sh` and `development/run_lint.sh`, to check if builds are passable.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000..f7202861
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,19 @@
+name: flake8
+
+on: [push, pull_request]
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: Set up Python
+        uses: actions/setup-python@v3
+        with:
+          python-version: '3.x'
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install flake8
+
+      - name: lint
+        run: bash ./development/run_lint.sh
\ No newline at end of file
diff --git a/development/git_hooks/pre-commit.sh b/development/git_hooks/pre-commit.sh
index 43b8f464..2dd10867 100644
--- a/development/git_hooks/pre-commit.sh
+++ b/development/git_hooks/pre-commit.sh
@@ -2,12 +2,13 @@
 
 ROOT_DIR=`git rev-parse --show-toplevel`
 
+echo "Running pre-commit hooks."
+
 set -e # exit if script errors.
 
 # Reference: https://prettier.io/docs/en/precommit.html
 # ACMR = Added, Copied, Modified, Renamed (no deleted)
 FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep '\.\(py\)$' | sed 's| |\\ |g')
-[ -z "$FILES" ] && exit 0
 
 # Prettify all selected files
 echo "$FILES" | xargs black
@@ -15,13 +16,6 @@ echo "$FILES" | xargs black
 # Add back the modified/prettified files to staging
 echo "$FILES" | xargs git add
 
-# NO_EMPTY=git diff --cached --exit-code
-# if [ $NO_EMPTY -eq 0 ]
-# then
-#     echo "Black formatting resulted in an empty commit, cancelling!"
-#     exit 1
-# fi
-
 # Mark: run tests  and lint checks
 sh "$ROOT_DIR/development/run_tests.sh"
 


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00000000..33cce13a
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,18 @@
+name: test
+
+on: [push, pull_request]
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: Set up Python
+        uses: actions/setup-python@v3
+        with:
+          python-version: '3.11'
+          
+      - name: Install VENV
+        run: bash ./development/create_python_virtual_environment.sh
+
+      - name: Run Tests
+        run: bash ./development/run_tests.sh
\ No newline at end of file
diff --git a/development/run_tests.sh b/development/run_tests.sh
index 2fb7f331..a34adcab 100644
--- a/development/run_tests.sh
+++ b/development/run_tests.sh
@@ -22,4 +22,4 @@ fi
 export PYTHONPATH="$PYTHONPATH:$SCRIPT_DIR/../providers"
 export PYTHONPATH="$PYTHONPATH:$SCRIPT_DIR/../providers/blender"
 
-python -m unittest tests/**.py
\ No newline at end of file
+python -m unittest tests/**/**.py
\ No newline at end of file