Repository: django-cms/djangocms-text-ckeditor (language: python)

Issue:
[Feature] Implement Github Actions
As part of the effort to switch from Travis to GH actions, I'm raising this & will begin working on this feature.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml
new file mode 100644
index 000000000..4019a4453
--- /dev/null
+++ b/.github/workflows/frontend.yml
@@ -0,0 +1,22 @@
+name: Frontend
+
+on: [push]
+
+jobs:
+  frontend:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        node-version: [6.x]
+    steps:
+    - uses: actions/checkout@v2
+    - name: Use Node.js ${{ matrix.node-version }}
+      uses: actions/setup-node@v1
+      with:
+        node-version: ${{ matrix.node-version }}
+    - name: Install gulp
+      run: npm install -g gulp@3.9.1
+    - name: Install dependencies
+      run: npm install
+    - name: Run gulp
+      run: gulp ci
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 000000000..0d5f4e6e6
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,39 @@
+name: Lint
+
+on: [push]
+
+jobs:
+  flake8:
+    name: flake8
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: 3.9
+      - name: Install flake8
+        run: pip install --upgrade flake8
+      - name: Run flake8
+        uses: liskin/gh-problem-matcher-wrap@v1
+        with:
+          linters: flake8
+          run: |
+            flake8 --exit-zero
+
+  isort:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: 3.9
+      - run: python -m pip install isort
+      - name: isort
+        uses: liskin/gh-problem-matcher-wrap@v1
+        with:
+          linters: isort
+          run: isort -c -rc -df djangocms_text_ckeditor
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index ac732e834..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-language: python
-
-dist: xenial
-
-matrix:
-  include:
-    - python: 3.5
-      env: TOX_ENV='flake8'
-    - python: 3.5
-      env: TOX_ENV='isort'
-    - python: 3.5
-      env: TOX_ENV='frontend'
-    # Django 2.2
-    - python: 3.5
-      env: DJANGO='dj22' CMS='cms37'
-    - python: 3.6
-      env: DJANGO='dj22' CMS='cms37'
-    - python: 3.7
-      env: DJANGO='dj22' CMS='cms37'
-    - python: 3.8
-      env: DJANGO='dj22' CMS='cms37'
-    # Django 3.0, always run the lowest supported version
-    - python: 3.6
-      env: DJANGO='dj30' CMS='cms37'
-    # Django 3.1, always run the lowest supported version
-    - python: 3.6
-      env: DJANGO='dj31' CMS='cms38'
-  allow_failures:
-    - python: 3.6
-      env: DJANGO='dj31' CMS='cms38'
-
-install:
-  - pip install coverage isort tox
-  - "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export PY_VER=py35; fi"
-  - "if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then export PY_VER=py36; fi"
-  - "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then export PY_VER=py37; fi"
-  - "if [[ $TRAVIS_PYTHON_VERSION == '3.8' ]]; then export PY_VER=py38; fi"
-  - "if [[ ${DJANGO}z != 'z' ]]; then export TOX_ENV=$PY_VER-$DJANGO-$CMS; fi"
-
-before_script:
-  - if [ $TOX_ENV == 'frontend' ]; then
-    nvm install 8.10.0 && nvm use 8.10.0;
-    npm config set spin false;
-    npm install -g npm;
-    npm install -g gulp@3.9.0;
-    npm install;
-    fi
-
-script:
-  - tox -e $TOX_ENV
-
-after_success:
-  - bash <(curl -s https://codecov.io/bash)
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 2b99eac15..ad676335b 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -11,7 +11,7 @@ Changelog
 * Dropped support for Django < 2.2
 * Ensure that correct urls are generated when static files are hosted on a CDN
 * Allow to style WYSIWYG content based on parent plugins, by adding
-``CMSPluginBase.child_ckeditor_body_css_class`` to a parent (#520)
+  ``CMSPluginBase.child_ckeditor_body_css_class`` to a parent (#520)
 * Upgrade to CKeditor version to 4.14.1
 
 
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 000000000..79fd5aaf5
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,30 @@
+[flake8]
+ignore = E251,E128,E501
+max-line-length = 119
+exclude =
+    *.egg-info,
+    .eggs,
+    .git,
+    .settings,
+    .tox,
+    build,
+    data,
+    dist,
+    docs,
+    *migrations*,
+    requirements,
+    tmp,
+    *node_modules*
+
+[isort]
+line_length = 79
+skip = manage.py, *migrations*, .tox, .eggs, data
+include_trailing_comma = true
+multi_line_output = 5
+not_skip = __init__.py
+lines_after_imports = 2
+default_section = THIRDPARTY
+sections = FUTURE, STDLIB, DJANGO, CMS, THIRDPARTY, FIRSTPARTY, LIB, LOCALFOLDER
+known_first_party = djangocms_text_ckeditor
+known_cms = cms, menus
+known_django = django
diff --git a/tox.ini b/tox.ini
index 2b6f1ae7d..6ba71cbbe 100644
--- a/tox.ini
+++ b/tox.ini
@@ -42,7 +42,7 @@ known_django = django
 
 [testenv]
 deps =
-    -r{toxinidir}/tests/requirements.txt
+    -r{toxinidir}/tests/requirements/base.txt
     dj22: Django>=2.2,<3.0
     dj30: Django>=3.0,<3.1
     dj31: Django>=3.1,<3.2


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000000000..3122daf2a
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,39 @@
+name: CodeCov
+
+on: [push, pull_request]
+
+jobs:
+  unit-tests:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: [ 3.7, 3.8, 3.9, ]  # latest release minus two
+        requirements-file: [
+          dj22_cms37.txt,
+          dj22_cms38.txt,
+          dj30_cms37.txt,
+          dj30_cms38.txt,
+          dj31_cms38.txt,
+        ]
+        os: [
+          ubuntu-20.04,
+        ]
+
+    steps:
+    - uses: actions/checkout@v1
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install -r tests/requirements/${{ matrix.requirements-file }}
+        python setup.py install
+
+    - name: Run coverage
+      run: coverage run setup.py test
+
+    - name: Upload Coverage to Codecov
+      uses: codecov/codecov-action@v1
diff --git a/tests/requirements.txt b/tests/requirements/base.txt
similarity index 94%
rename from tests/requirements.txt
rename to tests/requirements/base.txt
index 77ea615a8..c55c67600 100644
--- a/tests/requirements.txt
+++ b/tests/requirements/base.txt
@@ -5,10 +5,13 @@ djangocms-link>=2.2.1
 django-polymorphic>=2.0.3
 Pillow
 html5lib>=0.999999999
+
 # other requirements
+coverage
+django-treebeard<4.5
 django-app-helper
 tox
-coverage
+wheel
 
 # In order to run skipped tests uncomment the next lines:
 # -e git+ssh://git@github.com/divio/djangocms-transfer.git@master#egg=djangocms-transfer
diff --git a/tests/requirements/dj22_cms37.txt b/tests/requirements/dj22_cms37.txt
new file mode 100644
index 000000000..6b96a1021
--- /dev/null
+++ b/tests/requirements/dj22_cms37.txt
@@ -0,0 +1,4 @@
+-r base.txt
+
+Django>=2.2,<3.0
+django-cms>=3.7,<3.8
diff --git a/tests/requirements/dj22_cms38.txt b/tests/requirements/dj22_cms38.txt
new file mode 100644
index 000000000..22c4fef29
--- /dev/null
+++ b/tests/requirements/dj22_cms38.txt
@@ -0,0 +1,4 @@
+-r base.txt
+
+Django>=2.2,<3.0
+django-cms>=3.8,<3.9
diff --git a/tests/requirements/dj30_cms37.txt b/tests/requirements/dj30_cms37.txt
new file mode 100644
index 000000000..edcfd450e
--- /dev/null
+++ b/tests/requirements/dj30_cms37.txt
@@ -0,0 +1,4 @@
+-r base.txt
+
+Django>=3.0,<3.1
+django-cms>=3.7,<3.8
diff --git a/tests/requirements/dj30_cms38.txt b/tests/requirements/dj30_cms38.txt
new file mode 100644
index 000000000..7bc3c0bee
--- /dev/null
+++ b/tests/requirements/dj30_cms38.txt
@@ -0,0 +1,4 @@
+-r base.txt
+
+Django>=3.0,<3.1
+django-cms>=3.8,<3.9
diff --git a/tests/requirements/dj31_cms38.txt b/tests/requirements/dj31_cms38.txt
new file mode 100644
index 000000000..d17fdb422
--- /dev/null
+++ b/tests/requirements/dj31_cms38.txt
@@ -0,0 +1,4 @@
+-r base.txt
+
+Django>=3.1,<3.2
+django-cms>=3.8,<3.9