瀏覽代碼

Jenkinsfile (#4301)

* Added Jenkinsfile

* Added vdt.versionplugin.wheel

* Added Jenkinsfile and make build pass
master
Voxin Muyli 11 月之前
父節點
當前提交
5f2061d119
No account linked to committer's email address
共有 8 個文件被更改,包括 155 次插入74 次删除
  1. 73
    0
      Jenkinsfile
  2. 2
    2
      Makefile
  3. 1
    1
      package-lock.json
  4. 3
    3
      requirements.txt
  5. 71
    65
      setup.py
  6. 2
    2
      src/oscar/__init__.py
  7. 2
    1
      src/oscar/apps/customer/wishlists/views.py
  8. 1
    0
      src/oscar/apps/offer/abstract_models.py

+ 73
- 0
Jenkinsfile 查看文件

@@ -0,0 +1,73 @@
1
+#!/usr/bin/env groovy
2
+
3
+pipeline {
4
+    agent { label 'GEITENPETRA' }
5
+    options { disableConcurrentBuilds() }
6
+
7
+    stages {
8
+        stage('Build') {
9
+            steps {
10
+                withPythonEnv('System-CPython-3.10') {
11
+                    withEnv(['DATABASE_USER=django_oscar', 'DATABASE_PASSWORD=django_oscar', 'DATABASE_PORT=5432', 'DATABASE_HOST=localhost']) {
12
+                        pysh "make install"
13
+                    }
14
+                }
15
+            }
16
+        }
17
+        stage('Lint') {
18
+            steps {
19
+                withPythonEnv('System-CPython-3.10') {
20
+                    pysh "make lint"
21
+                }
22
+            }
23
+        }
24
+        stage('Test') {
25
+            steps {
26
+                withPythonEnv('System-CPython-3.10') {
27
+                    withEnv(['DATABASE_USER=django_oscar', 'DATABASE_PASSWORD=django_oscar', 'DATABASE_PORT=5432', 'DATABASE_HOST=localhost']) {
28
+                        pysh "make test"
29
+                    }
30
+                }
31
+            }
32
+            post {
33
+                always {
34
+                    junit allowEmptyResults: true, testResults: '**/nosetests.xml'
35
+                }
36
+                success {
37
+                    echo "kek!"
38
+                    // step([
39
+                    //     $class: 'CoberturaPublisher',
40
+                    //     coberturaReportFile: '**/coverage.xml',
41
+                    // ])
42
+                }
43
+            }
44
+        }
45
+    }
46
+    post {
47
+        always {
48
+            echo 'This will always run'
49
+        }
50
+        success {
51
+            echo 'This will run only if successful'
52
+            withPythonEnv('System-CPython-3.10') {
53
+                echo 'This will run only if successful'
54
+                pysh "version --plugin=wheel -B${env.BUILD_NUMBER} --skip-build"
55
+                sh "which git"
56
+                sh "git push --tags"
57
+            }
58
+        }
59
+        failure {
60
+            emailext subject: "JENKINS-NOTIFICATION: ${currentBuild.currentResult}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}'",
61
+                    body: '${SCRIPT, template="groovy-text.template"}',
62
+                    recipientProviders: [culprits(), brokenBuildSuspects(), brokenTestsSuspects()]
63
+
64
+        }
65
+        unstable {
66
+            echo 'This will run only if the run was marked as unstable'
67
+        }
68
+        changed {
69
+            echo 'This will run only if the state of the Pipeline has changed'
70
+            echo 'For example, if the Pipeline was previously failing but is now successful'
71
+        }
72
+    }
73
+}

+ 2
- 2
Makefile 查看文件

@@ -16,10 +16,10 @@ help: ## Display this help message
16 16
 install: install-python install-test assets ## Install requirements for local development and production
17 17
 
18 18
 install-python: ## Install python requirements
19
-	pip install -r requirements.txt
19
+	pip install -r requirements.txt --upgrade --upgrade-strategy=eager
20 20
 
21 21
 install-test: ## Install test requirements
22
-	pip install -e .[test]
22
+	pip install -e .[test] --upgrade --upgrade-strategy=eager
23 23
 
24 24
 install-migrations-testing-requirements: ## Install migrations testing requirements
25 25
 	pip install -r requirements_migrations.txt

+ 1
- 1
package-lock.json 查看文件

@@ -6,7 +6,7 @@
6 6
   "packages": {
7 7
     "": {
8 8
       "name": "django-oscar",
9
-      "version": "3.2.4",
9
+      "version": "3.2.5a2",
10 10
       "license": "MIT",
11 11
       "devDependencies": {
12 12
         "@fortawesome/fontawesome-free": "^6.5.1",

+ 3
- 3
requirements.txt 查看文件

@@ -16,9 +16,9 @@ uWSGI>=2.0.19
16 16
 whitenoise>=5.2,<6.6
17 17
 
18 18
 # Linting
19
-pylint>=2.17.4
20
-pylint-django>=2.5.3
21
-black>=23.3.0
19
+pylint>=3.1.0
20
+pylint-django>=2.5.5
21
+black>=24.4.2
22 22
 
23 23
 # Helpers
24 24
 pyprof2calltree>=1.4,<1.5

+ 71
- 65
setup.py 查看文件

@@ -10,115 +10,121 @@ import os
10 10
 import re
11 11
 import sys
12 12
 
13
-from setuptools import setup
13
+from setuptools import setup, find_packages
14 14
 
15 15
 PROJECT_DIR = os.path.dirname(__file__)
16 16
 
17
-sys.path.append(os.path.join(PROJECT_DIR, 'src'))
17
+sys.path.append(os.path.join(PROJECT_DIR, "src"))
18 18
 from oscar import get_version  # noqa isort:skip
19 19
 
20 20
 install_requires = [
21
-    'django>=3.2,<4.3',
21
+    "setuptools>=51.3.3",
22
+    "django>=3.2,<4.3",
22 23
     # PIL is required for image fields, Pillow is the "friendly" PIL fork
23
-    'pillow>=6.0',
24
+    "pillow>=6.0",
24 25
     # We use the ModelFormSetView from django-extra-views for the basket page
25
-    'django-extra-views>=0.13,<0.15',
26
+    "django-extra-views>=0.13,<0.15",
26 27
     # Search support
27
-    'django-haystack>=3.0b1',
28
+    "django-haystack>=3.0b1",
28 29
     # Treebeard is used for categories
29
-    'django-treebeard>=4.3.0',
30
+    "django-treebeard>=4.3.0",
30 31
     # Babel is used for currency formatting
31
-    'Babel>=1.0,<3.0',
32
+    "Babel>=1.0,<3.0",
32 33
     # For manipulating search URLs
33
-    'purl>=0.7',
34
+    "purl>=0.7",
34 35
     # For phone number field
35
-    'phonenumbers',
36
-    'django-phonenumber-field>=4.0.0,<7.0.0',
36
+    "phonenumbers",
37
+    "django-phonenumber-field>=4.0.0,<7.0.0",
37 38
     # Used for oscar.test.factories
38
-    'factory-boy>=3.0,<3.3',
39
+    "factory-boy>=3.0,<3.3",
39 40
     # Used for automatically building larger HTML tables
40
-    'django-tables2>=2.3,<2.4',
41
+    "django-tables2>=2.3,<2.4",
41 42
     # Used for manipulating form field attributes in templates (eg: add
42 43
     # a css class)
43
-    'django-widget-tweaks>=1.4.1',
44
+    "django-widget-tweaks>=1.4.1",
44 45
 ]
45 46
 
46
-sorl_thumbnail_version = 'sorl-thumbnail>=12.9,<12.10'
47
-easy_thumbnails_version = 'easy-thumbnails>=2.7,<2.8.6'
47
+sorl_thumbnail_version = "sorl-thumbnail>=12.9,<12.10"
48
+easy_thumbnails_version = "easy-thumbnails>=2.7,<2.8.6"
48 49
 
49 50
 docs_requires = [
50
-    'Sphinx>=5.0',
51
-    'sphinxcontrib-spelling==7.5.1',
52
-    'sphinx_rtd_theme==1.0.0',
53
-    'sphinx-issues==3.0.1',
51
+    "Sphinx>=5.0",
52
+    "sphinxcontrib-spelling==7.5.1",
53
+    "sphinx_rtd_theme==1.0.0",
54
+    "sphinx-issues==3.0.1",
54 55
     sorl_thumbnail_version,
55 56
     easy_thumbnails_version,
56 57
 ]
57 58
 
58 59
 test_requires = [
59
-    'WebTest>=2.0,<2.1',
60
-    'coverage>=5.4,<5.5',
61
-    'django-webtest>=1.9,<1.10',
62
-    'psycopg2-binary>=2.8,<2.10',
63
-    'pytest-django>=3.7,<3.9',
64
-    'pytest-xdist>=2.2,<3',
65
-    'tox>=3.21,<4',
66
-    'freezegun>=1.1,<2',
67
-    'pytz',
60
+    "WebTest>=2.0,<2.1",
61
+    "coverage>=5.4,<5.5",
62
+    "django-webtest>=1.9,<1.10",
63
+    "psycopg2-binary>=2.8,<2.10",
64
+    "pytest-django>=3.7,<3.9",
65
+    "pytest-xdist>=2.2,<3",
66
+    "tox>=3.21,<4",
67
+    "freezegun>=1.1,<2",
68
+    "pytz",
69
+    "vdt.versionplugin.wheel",
68 70
     sorl_thumbnail_version,
69 71
     easy_thumbnails_version,
70 72
 ]
71 73
 
72
-with open(os.path.join(PROJECT_DIR, 'README.rst'), encoding="utf-8") as fh:
74
+with open(os.path.join(PROJECT_DIR, "README.rst"), encoding="utf-8") as fh:
73 75
     long_description = re.sub(
74
-        '^.. start-no-pypi.*^.. end-no-pypi', '', fh.read(), flags=re.M | re.S)
76
+        "^.. start-no-pypi.*^.. end-no-pypi", "", fh.read(), flags=re.M | re.S
77
+    )
75 78
 
76 79
 setup(
77
-    name='django-oscar',
80
+    name="django-oscar",
78 81
     version=get_version(),
79
-    url='https://github.com/django-oscar/django-oscar',
82
+    url="https://github.com/django-oscar/django-oscar",
80 83
     author="David Winterbottom",
81 84
     author_email="david.winterbottom@gmail.com",
82 85
     description="A domain-driven e-commerce framework for Django",
83 86
     long_description=long_description,
84 87
     keywords="E-commerce, Django, domain-driven",
85
-    license='BSD',
86
-    platforms=['linux'],
88
+    license="BSD",
89
+    platforms=["linux"],
87 90
     include_package_data=True,
88
-    python_requires='>=3.8',
91
+    package_dir={'': 'src'},
92
+    packages=find_packages('src'),
93
+    python_requires=">=3.8",
89 94
     install_requires=install_requires,
90 95
     extras_require={
91
-        'docs': docs_requires,
92
-        'test': test_requires,
93
-        'sorl-thumbnail': [sorl_thumbnail_version],
94
-        'easy-thumbnails': [easy_thumbnails_version],
96
+        "docs": docs_requires,
97
+        "test": test_requires,
98
+        "sorl-thumbnail": [sorl_thumbnail_version],
99
+        "easy-thumbnails": [easy_thumbnails_version],
95 100
     },
96 101
     classifiers=[
97
-        'Development Status :: 5 - Production/Stable',
98
-        'Environment :: Web Environment',
99
-        'Framework :: Django',
100
-        'Framework :: Django :: 3.2',
101
-        'Framework :: Django :: 4.0',
102
-        'Framework :: Django :: 4.1',
103
-        'Framework :: Django :: 4.2',
104
-        'Intended Audience :: Developers',
105
-        'License :: OSI Approved :: BSD License',
106
-        'Operating System :: Unix',
107
-        'Programming Language :: Python',
108
-        'Programming Language :: Python :: 3',
109
-        'Programming Language :: Python :: 3.8',
110
-        'Programming Language :: Python :: 3.9',
111
-        'Programming Language :: Python :: 3.10',
112
-        'Programming Language :: Python :: 3.11',
113
-        'Topic :: Software Development :: Libraries :: Application Frameworks']
102
+        "Development Status :: 5 - Production/Stable",
103
+        "Environment :: Web Environment",
104
+        "Framework :: Django",
105
+        "Framework :: Django :: 3.2",
106
+        "Framework :: Django :: 4.0",
107
+        "Framework :: Django :: 4.1",
108
+        "Framework :: Django :: 4.2",
109
+        "Intended Audience :: Developers",
110
+        "License :: OSI Approved :: BSD License",
111
+        "Operating System :: Unix",
112
+        "Programming Language :: Python",
113
+        "Programming Language :: Python :: 3",
114
+        "Programming Language :: Python :: 3.8",
115
+        "Programming Language :: Python :: 3.9",
116
+        "Programming Language :: Python :: 3.10",
117
+        "Programming Language :: Python :: 3.11",
118
+        "Topic :: Software Development :: Libraries :: Application Frameworks",
119
+    ],
114 120
 )
115 121
 
116 122
 # Show contributing instructions if being installed in 'develop' mode
117
-if len(sys.argv) > 1 and sys.argv[1] == 'develop':
118
-    docs_url = 'https://django-oscar.readthedocs.io/en/latest/internals/contributing/index.html'
119
-    mailing_list = 'django-oscar@googlegroups.com'
120
-    mailing_list_url = 'https://groups.google.com/forum/?fromgroups#!forum/django-oscar'
121
-    twitter_url = 'https://twitter.com/django_oscar'
123
+if len(sys.argv) > 1 and sys.argv[1] == "develop":
124
+    docs_url = "https://django-oscar.readthedocs.io/en/latest/internals/contributing/index.html"
125
+    mailing_list = "django-oscar@googlegroups.com"
126
+    mailing_list_url = "https://groups.google.com/forum/?fromgroups#!forum/django-oscar"
127
+    twitter_url = "https://twitter.com/django_oscar"
122 128
     msg = (
123 129
         "You're installing Oscar in 'develop' mode so I presume you're thinking\n"
124 130
         "of contributing:\n\n"
@@ -128,7 +134,7 @@ if len(sys.argv) > 1 and sys.argv[1] == 'develop':
128 134
         "(c) There are more detailed contributing guidelines that you should "
129 135
         "have a look at:\n    %s\n"
130 136
         "(d) Consider following @django_oscar on Twitter to stay up-to-date\n"
131
-        "    %s\n\nHappy hacking!") % (mailing_list, mailing_list_url,
132
-                                       docs_url, twitter_url)
133
-    line = '=' * 82
137
+        "    %s\n\nHappy hacking!"
138
+    ) % (mailing_list, mailing_list_url, docs_url, twitter_url)
139
+    line = "=" * 82
134 140
     print(("\n%s\n%s\n%s" % (line, msg, line)))

+ 2
- 2
src/oscar/__init__.py 查看文件

@@ -1,5 +1,5 @@
1 1
 # Use 'alpha', 'beta', 'rc' or 'final' as the 4th element to indicate release type.
2
-VERSION = (3, 2, 5, "alpha", 2)
2
+VERSION = (3, 2, 5)
3 3
 
4 4
 
5 5
 def get_short_version():
@@ -12,7 +12,7 @@ def get_version():
12 12
     if VERSION[2]:
13 13
         version = "%s.%s" % (version, VERSION[2])
14 14
 
15
-    if VERSION[3] != "final":
15
+    if len(VERSION) > 3 and VERSION[3] != "final":
16 16
         mapping = {"alpha": "a", "beta": "b", "rc": "rc"}
17 17
         version = "%s%s" % (version, mapping[VERSION[3]])
18 18
         if len(VERSION) == 5:

+ 2
- 1
src/oscar/apps/customer/wishlists/views.py 查看文件

@@ -117,12 +117,13 @@ class WishListCreateUpdateViewMixin(PageTitleMixin):
117 117
                     "The shared accounts won't be able to access your wishlist "
118 118
                     "because the visiblity is set to private."
119 119
                 )
120
+                messages.warning(self.request, msg)
120 121
             elif wishlist.visibility == WishList.PUBLIC:
121 122
                 msg = _(
122 123
                     "You have added shared accounts to your wishlist but the visiblity "
123 124
                     "is public, this means everyone with a link has access to it."
124 125
                 )
125
-            messages.warning(self.request, msg)
126
+                messages.warning(self.request, msg)
126 127
 
127 128
         return wishlist
128 129
 

+ 1
- 0
src/oscar/apps/offer/abstract_models.py 查看文件

@@ -472,6 +472,7 @@ class AbstractConditionalOffer(models.Model):
472 472
 
473 473
         if self.start_datetime or self.end_datetime:
474 474
             today = now()
475
+            is_satisfied = False
475 476
             if self.start_datetime and self.end_datetime:
476 477
                 desc = _("Available between %(start)s and %(end)s") % {
477 478
                     "start": hide_time_if_zero(self.start_datetime),

Loading…
取消
儲存