Repository: jeromekelleher/phylokit (language: python)

Issue:
Add CI
Something lightweight initially, just runs tests


Discussion / hints:

Fix patch:
diff --git a/pyproject.toml b/pyproject.toml
index b0f0765..7fa483a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,9 @@
 [build-system]
 requires = ["setuptools>=42"]
 build-backend = "setuptools.build_meta"
+
+[tool.pytest.ini_options]
+addopts = "-n 4"
+testpaths = [
+    "tests",
+]
\ No newline at end of file
diff --git a/requirements/CI.txt b/requirements/CI.txt
new file mode 100644
index 0000000..a1afa58
--- /dev/null
+++ b/requirements/CI.txt
@@ -0,0 +1,4 @@
+numba==0.55.2
+pytest==7.1.2
+pytest-xdist==2.5.0
+tskit==0.5.0
\ No newline at end of file
diff --git a/requirements/development.txt b/requirements/development.txt
new file mode 100644
index 0000000..9cce188
--- /dev/null
+++ b/requirements/development.txt
@@ -0,0 +1,5 @@
+numba
+pre-commit
+pytest
+pytest-xdist
+tskit
\ No newline at end of file


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..40c9ff6
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,56 @@
+name: Tests
+
+on:
+  pull_request:
+  push:
+    branches: [main, test]
+
+jobs:
+  pre-commit:
+    name: Lint
+    runs-on: ubuntu-18.04
+    steps:
+      - name: Cancel Previous Runs
+        uses: styfle/cancel-workflow-action@0.6.0
+        with:
+          access_token: ${{ github.token }}
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
+      - uses: pre-commit/action@v3.0.0
+
+  test:
+    name: Python
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        python: [ 3.7, 3.9, "3.10" ]
+        os:  [ macos-latest, ubuntu-latest, windows-latest ]
+    defaults:
+      run:
+        shell: bash
+    steps:
+      - name: Cancel Previous Runs
+        uses: styfle/cancel-workflow-action@0.10.0
+        with:
+          access_token: ${{ github.token }}
+
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Setup Python and cache deps
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python }}
+          cache: 'pip'
+          cache-dependency-path: requirements/CI.txt
+
+      - name: Install pip deps
+        run: |
+          pip install -r requirements/CI.txt
+
+      - name: Run tests
+        run: |
+          python -m pytest -x -n2
\ No newline at end of file