From ca29ea35bc2424473c10d672c344fefafebd3af8 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Mon, 30 Oct 2023 22:16:29 +0100 Subject: [PATCH] [ci] Separate job for QA tests --- .github/workflows/ci.yml | 29 ++++++++++++------- Dockerfile | 4 +-- README.rst | 2 +- requirements-test-qa.txt | 2 ++ ...nts-test.txt => requirements-unit-test.txt | 2 -- tox.ini | 5 +++- 6 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 requirements-test-qa.txt rename requirements-test.txt => requirements-unit-test.txt (62%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2725c881..b71db155 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,21 @@ on: - master jobs: - build: + qa-tests: + name: QA tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: QA checks + run: | + pip install -r requirements-test-qa.txt + pip install "importlib-metadata<5.0" # remove when flake8 is upgraded + ./run-qa-checks + + unit-tests: name: Python==${{ matrix.env.python }} | ${{ matrix.env.TOXENV }} runs-on: ubuntu-20.04 @@ -72,9 +86,7 @@ jobs: - python: 3.9 TOXENV: py39-django40-djangorestframework313 steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.env.python }} uses: actions/setup-python@v2 @@ -89,7 +101,7 @@ jobs: - name: Install python dependencies run: | pip install -U pip wheel setuptools - pip install -U -r requirements-test.txt + pip install -U -r requirements-unit-test.txt pip install tox docutils pygments twine - name: Tests @@ -106,14 +118,9 @@ jobs: python-${{ matrix.env.env }} COVERALLS_PARALLEL: true - - name: QA checks - run: | - pip install "importlib-metadata<5.0" # remove when flake8 is upgraded - ./run-qa-checks - coveralls: name: Finish Coveralls - needs: build + needs: unit-tests runs-on: ubuntu-latest container: python:3-slim steps: diff --git a/Dockerfile b/Dockerfile index a6a0fc87..44fa6079 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,6 @@ ENV PYTHONUNBUFFERED=1 \ WORKDIR /project -COPY requirements-test.txt /project/ +COPY requirements-unit-test.txt /project/ -RUN pip install --no-cache-dir -r requirements-test.txt +RUN pip install --no-cache-dir -r requirements-unit-test.txt diff --git a/README.rst b/README.rst index 66b45310..282f7ee8 100644 --- a/README.rst +++ b/README.rst @@ -721,7 +721,7 @@ Install the test requirements: .. code-block:: shell - pip install -r requirements-test.txt + pip install -r requirements-test-qa.txt Reformat the code according to `our coding style conventions with `_: diff --git a/requirements-test-qa.txt b/requirements-test-qa.txt new file mode 100644 index 00000000..0d244eff --- /dev/null +++ b/requirements-test-qa.txt @@ -0,0 +1,2 @@ +# QA checks +openwisp-utils[qa]~=1.0.0 diff --git a/requirements-test.txt b/requirements-unit-test.txt similarity index 62% rename from requirements-test.txt rename to requirements-unit-test.txt index 3c0aff2d..8d027bc6 100644 --- a/requirements-test.txt +++ b/requirements-unit-test.txt @@ -1,6 +1,4 @@ psycopg2~=2.8.0 django-filter>=2.0 contexttimer -# QA checks -openwisp-utils[qa]~=1.0.0 packaging~=20.4 diff --git a/tox.ini b/tox.ini index 63f36f82..760f48da 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = py{37,38,39,py3}-django{22}-djangorestframework{310,312}{,-pytest} py{37,38,39,py3}-django{30,31,32}-djangorestframework{312}{,-pytest} py{38,39,py3}-django{40}-djangorestframework{313}{,-pytest} + py{311}-django{42}-djangorestframework{314}{,-pytest} [testenv] usedevelop = true @@ -22,10 +23,12 @@ deps = django31: Django~=3.1.0 django32: Django~=3.2.0 django40: Django~=4.0.0 + django42: Django~=4.2.6 djangorestframework310: djangorestframework~=3.10.0 djangorestframework312: djangorestframework~=3.12.0 djangorestframework313: djangorestframework~=3.13.0 - -rrequirements-test.txt + djangorestframework313: djangorestframework~=3.13.0 + -rrequirements-unit-test.txt pytest: pytest pytest: pytest-django