Repository: aphp/edsnlp (language: python)

Issue:
feat: matrices testing
Add tests on multiple python versions


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml
new file mode 100644
index 000000000..6995c8642
--- /dev/null
+++ b/.github/workflows/documentation.yml
@@ -0,0 +1,25 @@
+name: Documentation
+
+on:
+  push:
+    branches: [master]
+
+jobs:
+  Documentation:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: actions/setup-python@v2
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install -r requirements-docs.txt
+    - name: Set up Git
+      run: |
+        git config user.name ${{ github.actor }}
+        git config user.email ${{ github.actor }}@users.noreply.github.com
+    - name: Build documentation
+      run: |
+        git fetch origin gh-pages
+        mike delete master
+        mike deploy --push master
diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml
new file mode 100644
index 000000000..3865dbe93
--- /dev/null
+++ b/.github/workflows/package.yml
@@ -0,0 +1,54 @@
+# This workflow will upload a Python Package using Twine when a release is created
+# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Upload Python Package
+
+on:
+  release:
+    types: [published]
+
+jobs:
+  PyPI:
+
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python
+      uses: actions/setup-python@v2
+      with:
+        python-version: '3.x'
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install build
+    - name: Build package
+      run: python -m build
+    - name: Publish package
+      uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
+      with:
+        user: __token__
+        password: ${{ secrets.PYPI_API_TOKEN }}
+
+  Documentation:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: actions/setup-python@v2
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install -r requirements-docs.txt
+    - name: Set up Git
+      run: |
+        git config user.name ${{ github.actor }}
+        git config user.email ${{ github.actor }}@users.noreply.github.com
+    - name: Build documentation
+      run: |
+        git fetch origin gh-pages
+        mike deploy --push --no-redirect --update-aliases $GITHUB_REF_NAME latest
diff --git a/scripts/demo.py b/demo/app.py
similarity index 100%
rename from scripts/demo.py
rename to demo/app.py
diff --git a/demo/requirements.txt b/demo/requirements.txt
new file mode 100644
index 000000000..cac80615f
--- /dev/null
+++ b/demo/requirements.txt
@@ -0,0 +1,2 @@
+edsnlp==0.4.0
+streamlit
diff --git a/setup.py b/setup.py
index 05cb78057..7c1fb9a0d 100644
--- a/setup.py
+++ b/setup.py
@@ -49,7 +49,16 @@ def get_version(path):
     version=get_version("edsnlp/__init__.py"),
     author="Data Science - DSI APHP",
     author_email="basile.dura-ext@aphp.fr",
-    description="NLP tools for human consumption at AP-HP",
+    description=(
+        "A set of spaCy components to extract information "
+        "from clinical notes written in French."
+    ),
+    url="https://github.com/aphp/edsnlp",
+    project_urls={
+        "Documentation": "https://aphp.github.io/edsnlp",
+        "Demo": "https://aphp.github.io/edsnlp/demo",
+        "Bug Tracker": "https://github.com/aphp/edsnlp/issues",
+    },
     long_description=long_description,
     long_description_content_type="text/markdown",
     python_requires=">=3.6",


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 000000000..89da253bd
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,56 @@
+name: Tests and Linting
+
+on:
+  pull_request:
+  push:
+    branches: [master]
+
+jobs:
+  Linting:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: actions/setup-python@v2
+    - name: Set PY variable
+      run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
+    - uses: actions/cache@v2
+      with:
+        path: ~/.cache/pre-commit
+        key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
+    - name: Install pre-commit
+      run: |
+        pip install pre-commit
+        pre-commit install
+    - name: Run pre-commit
+      run: SKIP=no-commit-to-branch pre-commit run --all-files
+
+  Pytest:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [ '3.7', '3.8', '3.9']
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+        architecture: x64
+    - name: Install dependencies
+      run: |
+        pip install --upgrade pip
+        scripts/install.sh
+        pip install pyspark
+    - name: Test with Pytest on Python ${{ matrix.python-version }}
+      run: |
+        python -m pytest --cov edsnlp --junitxml=coverage.xml --html=report.html --self-contained-html
+    - uses: codecov/codecov-action@v2
+
+  Installation:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: actions/setup-python@v2
+    - name: Install library
+      run: |
+        pip install .