From cae089e56efefaf92194aafc36a96355eeec7dd2 Mon Sep 17 00:00:00 2001 From: Soban Javed Date: Mon, 18 Oct 2021 14:55:49 +0500 Subject: [PATCH 1/3] Test django 3.2 with github action --- .github/workflows/test.yml | 105 +++++++++++++++++++++++++++++++++++++ setup.py | 4 +- 2 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000000..886318be3ac --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,105 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + python-version: [3.7, 3.8, 3.9] + django-version: [3.0, 3.1, 3.2] + services: + postgres: + image: postgres:10 + ports: + - 5432/tcp + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + steps: + - uses: actions/checkout@v2 + - 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 pytest + pip install -e .[test] + pip install -r requirements.txt + pip install "django~=${{ matrix.django-version }}.0" + - name: Run tests + env: + DATABASE_USER: postgres + DATABASE_PASSWORD: postgres + DATABASE_HOST: localhost + DATABASE_PORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port + run: | + coverage run --parallel -m pytest -x + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + fail_ci_if_error: true + lint_python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Run linters + run: | + flake8 src tests setup.py + isort -c -q --diff src/ tests/ + lint_js: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up NodeJS + uses: actions/setup-node@v1 + - name: Install dependencies + run: | + npm ci + - name: Run linters + run: | + npm run eslint + sandbox: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Build sandbox + run: | + python -m pip install --upgrade pip + make sandbox + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Build docs + run: | + make docs \ No newline at end of file diff --git a/setup.py b/setup.py index f7787563d55..2f89d62ce05 100755 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ from oscar import get_version # noqa isort:skip install_requires = [ - 'django>=2.2,<3.1', + 'django>=2.2,<4.0', # PIL is required for image fields, Pillow is the "friendly" PIL fork 'pillow>=6.0', # We use the ModelFormSetView from django-extra-views for the basket page @@ -37,7 +37,7 @@ # Used for oscar.test.newfactories 'factory-boy>=2.4.1,<3.0', # Used for automatically building larger HTML tables - 'django-tables2>=2.2,<2.3', + 'django-tables2>=2.2', # Used for manipulating form field attributes in templates (eg: add # a css class) 'django-widget-tweaks>=1.4.1', From 8aae294147cde5a90854730e7a5eb7fbfe14ea30 Mon Sep 17 00:00:00 2001 From: Soban Javed Date: Mon, 18 Oct 2021 17:24:04 +0500 Subject: [PATCH 2/3] postgres downgrade --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 886318be3ac..55e8ba54b9e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: django-version: [3.0, 3.1, 3.2] services: postgres: - image: postgres:10 + image: postgres:9.6 ports: - 5432/tcp options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 From 574b2a256c303e3b120c1f2604082ea9bd2b3e1b Mon Sep 17 00:00:00 2001 From: Soban Javed Date: Mon, 18 Oct 2021 17:38:52 +0500 Subject: [PATCH 3/3] run on release branches also --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 55e8ba54b9e..e59fc1c3c04 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,9 +4,11 @@ on: push: branches: - master + - /^releases.*$/ pull_request: branches: - master + - /^releases.*$/ jobs: test: