From 3189751ec7eb0ee78d838c265a5fbc66514b0298 Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Thu, 1 Apr 2021 22:22:54 +0100 Subject: [PATCH 01/10] Initial actions --- .github/workflows/codecov.yml | 25 ++++++++++++ .github/workflows/lint.yml | 38 +++++++++++++++++++ .github/workflows/test.yml | 36 ++++++++++++++++++ .gitignore | 1 + setup.cfg | 28 ++++++++++++++ .../base.txt} | 0 tests/requirements/dj22_cms37.txt | 4 ++ tests/requirements/dj22_cms38.txt | 4 ++ tests/requirements/dj30_cms37.txt | 4 ++ tests/requirements/dj30_cms38.txt | 4 ++ tests/requirements/dj31_cms38.txt | 4 ++ 11 files changed, 148 insertions(+) create mode 100644 .github/workflows/codecov.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml create mode 100644 setup.cfg rename tests/{requirements.txt => requirements/base.txt} (100%) create mode 100644 tests/requirements/dj22_cms37.txt create mode 100644 tests/requirements/dj22_cms38.txt create mode 100644 tests/requirements/dj30_cms37.txt create mode 100644 tests/requirements/dj30_cms38.txt create mode 100644 tests/requirements/dj31_cms38.txt diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..a473e0ae --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,25 @@ +name: CodeCov + +on: [push, pull_request] + +jobs: + run: + runs-on: ubuntu-latest + env: + OS: ubuntu-latest + PYTHON: '3.9' + steps: + - uses: checkout@v2 + with: + fetch-depth: ‘2’ + + - name: Setup Python + uses: actions/setup-python@master + with: + python-version: 3.9 + - name: Generate Report + run: | + pip install coverage + coverage run setup.py test + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..721b2ca6 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,38 @@ +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 flate8 + run: pip install --upgrade flake8 + - name: Run flake8 + uses: liskin/gh-problem-matcher-wrap@v1 + with: + linters: flake8 + run: flake8 + + 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_bootstrap4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..f0e47de6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: Unit tests + +on: [push] + +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 tests + run: python setup.py test diff --git a/.gitignore b/.gitignore index 560c3a09..1e7fc9c1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ __pycache__/ build/ dist/ env/ +.venv/ /~ /node_modules diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..3f1fb35d --- /dev/null +++ b/setup.cfg @@ -0,0 +1,28 @@ +[flake8] +max-line-length = 119 +exclude = + *.egg-info, + .eggs, + .git, + .settings, + .tox, + build, + data, + dist, + docs, + *migrations*, + requirements, + tmp + +[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_bootstrap4 +known_cms = cms, menus +known_django = django diff --git a/tests/requirements.txt b/tests/requirements/base.txt similarity index 100% rename from tests/requirements.txt rename to tests/requirements/base.txt diff --git a/tests/requirements/dj22_cms37.txt b/tests/requirements/dj22_cms37.txt new file mode 100644 index 00000000..6b96a102 --- /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 00000000..22c4fef2 --- /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 00000000..edcfd450 --- /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 00000000..7bc3c0be --- /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 00000000..d17fdb42 --- /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 From c609dee259d98b52b2c28229f206b1d0965cf1a8 Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Thu, 1 Apr 2021 22:29:38 +0100 Subject: [PATCH 02/10] Correct inverted commas --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index a473e0ae..8d0dd859 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: checkout@v2 with: - fetch-depth: ‘2’ + fetch-depth: '2' - name: Setup Python uses: actions/setup-python@master From 0820b4e59e835e8f3a788336851734a6ab47e4fe Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Thu, 1 Apr 2021 22:34:34 +0100 Subject: [PATCH 03/10] Remove travis config --- .github/workflows/codecov.yml | 25 --------------------- .travis.yml | 42 ----------------------------------- 2 files changed, 67 deletions(-) delete mode 100644 .github/workflows/codecov.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index 8d0dd859..00000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: CodeCov - -on: [push, pull_request] - -jobs: - run: - runs-on: ubuntu-latest - env: - OS: ubuntu-latest - PYTHON: '3.9' - steps: - - uses: checkout@v2 - with: - fetch-depth: '2' - - - name: Setup Python - uses: actions/setup-python@master - with: - python-version: 3.9 - - name: Generate Report - run: | - pip install coverage - coverage run setup.py test - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d5efac84..00000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: python - -dist: xenial - -matrix: - include: - - python: 3.5 - env: TOX_ENV='flake8' - - python: 3.5 - env: TOX_ENV='isort' - # 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=py37; fi" - - "if [[ ${DJANGO}z != 'z' ]]; then export TOX_ENV=$PY_VER-$DJANGO-$CMS; fi" - -script: - - tox -e $TOX_ENV - -after_success: - - bash <(curl -s https://codecov.io/bash) From 436eddde5393ebdba312a3cb976b09f62dfab156 Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Thu, 1 Apr 2021 23:28:57 +0100 Subject: [PATCH 04/10] Added codecov action back in as the issue is with github --- .github/workflows/codecov.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..8d0dd859 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,25 @@ +name: CodeCov + +on: [push, pull_request] + +jobs: + run: + runs-on: ubuntu-latest + env: + OS: ubuntu-latest + PYTHON: '3.9' + steps: + - uses: checkout@v2 + with: + fetch-depth: '2' + + - name: Setup Python + uses: actions/setup-python@master + with: + python-version: 3.9 + - name: Generate Report + run: | + pip install coverage + coverage run setup.py test + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v1 From 6dc0697cf1a76091c403a49fc7e928f69f6995a7 Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Fri, 2 Apr 2021 00:32:03 +0100 Subject: [PATCH 05/10] Change job --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 8d0dd859..f776d290 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -3,7 +3,7 @@ name: CodeCov on: [push, pull_request] jobs: - run: + coverage: runs-on: ubuntu-latest env: OS: ubuntu-latest From f79896bb73ebf0282157fc8ca7ad15dd75f80057 Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Fri, 2 Apr 2021 00:44:56 +0100 Subject: [PATCH 06/10] Correct `uses` --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index f776d290..f0b50d6d 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -9,7 +9,7 @@ jobs: OS: ubuntu-latest PYTHON: '3.9' steps: - - uses: checkout@v2 + - uses: actions/checkout@v2 with: fetch-depth: '2' From 5328630f73e5df854cfb6ca23293d773db12c10e Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Fri, 2 Apr 2021 00:48:03 +0100 Subject: [PATCH 07/10] Coverage appears to need `wheel` --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index f0b50d6d..e5676876 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -19,7 +19,7 @@ jobs: python-version: 3.9 - name: Generate Report run: | - pip install coverage + pip install coverage wheel coverage run setup.py test - name: Upload Coverage to Codecov uses: codecov/codecov-action@v1 From 1d8504c8ed329e378b55a243af2bbe4c7ca7af3c Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Fri, 2 Apr 2021 00:53:26 +0100 Subject: [PATCH 08/10] Pin treebeard to <4.5 --- .github/workflows/codecov.yml | 24 ++++++++++++++++++------ tests/requirements/base.txt | 3 +++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index e5676876..7ebfc590 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -4,10 +4,22 @@ on: [push, pull_request] jobs: coverage: - runs-on: ubuntu-latest - env: - OS: ubuntu-latest - PYTHON: '3.9' + 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@v2 with: @@ -16,10 +28,10 @@ jobs: - name: Setup Python uses: actions/setup-python@master with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} - name: Generate Report run: | - pip install coverage wheel + pip install -r tests/requirements/${{ matrix.requirements-file }} coverage run setup.py test - name: Upload Coverage to Codecov uses: codecov/codecov-action@v1 diff --git a/tests/requirements/base.txt b/tests/requirements/base.txt index 77295764..66157f2d 100644 --- a/tests/requirements/base.txt +++ b/tests/requirements/base.txt @@ -1,6 +1,9 @@ +coverage django-app-helper +django-treebeard<4.5 tox coverage isort flake8 pyflakes>=2.1 +wheel From dd9443d1cd9c6ae75ea26a206441182a566fba5c Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Fri, 2 Apr 2021 22:10:45 +0100 Subject: [PATCH 09/10] Remove standard test action in favour of coverage --- .github/workflows/test.yml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index f0e47de6..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Unit tests - -on: [push] - -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 tests - run: python setup.py test From b0fe7384b7cc5ea9dc3a7ea43aa14e6f4f996d6d Mon Sep 17 00:00:00 2001 From: Mark Walker Date: Fri, 2 Apr 2021 22:41:09 +0100 Subject: [PATCH 10/10] Ensure tox can still find the base requirements --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e8613892..6c92ce4e 100644 --- a/tox.ini +++ b/tox.ini @@ -39,7 +39,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