diff --git a/.github/workflows/chores.yml b/.github/workflows/chores.yml
new file mode 100644
index 00000000..f8863ef8
--- /dev/null
+++ b/.github/workflows/chores.yml
@@ -0,0 +1,88 @@
+name: Tests
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ build:
+ name: Tests
+ runs-on: ubuntu-20.04
+
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ lfs: true
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: '3.10'
+ architecture: 'x64'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -e ".[dev]"
+
+ - name: Check formatting with black
+ id: black
+ if: always() # Run this step even if the previous one fails
+ run: |
+ black --check jaxley tests
+
+ - name: Check imports with isort
+ id: isort
+ if: always() # Run this step even if the previous one fails
+ run: |
+ isort -c jaxley tests
+
+ - name: Check license headers
+ id: license
+ if: always() # Run this step even if the previous one fails
+ run: |
+ expected_header="# This file is part of Jaxley, a differentiable neuroscience simulator. Jaxley is\n# licensed under the Apache License Version 2.0, see "
+ exit_code=0
+
+ while IFS= read -r file; do
+ header=$(head -n 2 "$file")
+ if [ "$header" != "$expected_header" ]; then
+ echo "❌ Missing or incorrect license header in $file"
+ exit_code=1
+ fi
+ done < <(find jaxley tests -name "*.py" -type f)
+
+ if [ $exit_code -ne 0 ]; then
+ echo "License header check failed"
+ exit 1
+ fi
+
+ - name: Ensure that the changelog reflects the changes
+ id: changelog
+ if: always() # Run this step even if the previous one fails
+ run: |
+ # Ensure the main branch is up-to-date
+ git fetch origin main
+
+ # Check if CHANGELOG.md was updated
+ changed_files=$(git diff --name-only origin/main)
+ if echo "$changed_files" | grep -q 'CHANGELOG.md'; then
+ echo "CHANGELOG.md was updated"
+ else
+ echo "CHANGELOG.md was not updated"
+ exit 1
+ fi
+
+ - name: Final check
+ run: |
+ if [[ "${{ steps.black.outcome }}" != "success" ||
+ "${{ steps.isort.outcome }}" != "success" ||
+ "${{ steps.license.outcome }}" != "success" ||
+ "${{ steps.changelog.outcome }}" != "success" ]]; then
+ echo "❌ Some checks failed!"
+ exit 1
+ fi
+ echo "✅ All checks passed"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 50977957..20b7f950 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -27,28 +27,6 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
-
- - name: Check formatting with black
- run: |
- black --check jaxley tests
-
- - name: Check imports with isort
- run: |
- isort -c jaxley tests
-
- - name: Ensure that the changelog reflects the changes
- run: |
- # Ensure the main branch is up-to-date
- git fetch origin main
-
- # Check if CHANGELOG.md was updated
- changed_files=$(git diff --name-only origin/main)
- if echo "$changed_files" | grep -q 'CHANGELOG.md'; then
- echo "CHANGELOG.md was updated"
- else
- echo "CHANGELOG.md was not updated"
- exit 1
- fi
- name: Test with pytest
run: |
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 75698747..ca384ebf 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -10,27 +10,6 @@
import pytest
-def list_files(directory):
- for root, dirs, files in os.walk(directory):
- for file in files:
- if file.endswith(".py"):
- yield os.path.join(root, file)
-
-
-license_txt = """# This file is part of Jaxley, a differentiable neuroscience simulator. Jaxley is
-# licensed under the Apache License Version 2.0, see """
-
-
-@pytest.mark.parametrize("dir", ["../jaxley", "."])
-def test_license(dir):
- for i, file in enumerate(list_files(dir)):
- with open(file, "r") as f:
- header = f.read(len(license_txt))
- assert (
- header == license_txt
- ), f"File {file} does not have the correct license header"
-
-
def test_rm_all_deprecated_functions():
from jaxley.__version__ import __version__ as package_version