Skip to content

Commit

Permalink
Jenkinsfile (#4301)
Browse files Browse the repository at this point in the history
* Added Jenkinsfile

* Added vdt.versionplugin.wheel

* Added Jenkinsfile and make build pass
  • Loading branch information
specialunderwear committed May 15, 2024
1 parent ab8a818 commit 5f2061d
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 74 deletions.
73 changes: 73 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env groovy

pipeline {
agent { label 'GEITENPETRA' }
options { disableConcurrentBuilds() }

stages {
stage('Build') {
steps {
withPythonEnv('System-CPython-3.10') {
withEnv(['DATABASE_USER=django_oscar', 'DATABASE_PASSWORD=django_oscar', 'DATABASE_PORT=5432', 'DATABASE_HOST=localhost']) {
pysh "make install"
}
}
}
}
stage('Lint') {
steps {
withPythonEnv('System-CPython-3.10') {
pysh "make lint"
}
}
}
stage('Test') {
steps {
withPythonEnv('System-CPython-3.10') {
withEnv(['DATABASE_USER=django_oscar', 'DATABASE_PASSWORD=django_oscar', 'DATABASE_PORT=5432', 'DATABASE_HOST=localhost']) {
pysh "make test"
}
}
}
post {
always {
junit allowEmptyResults: true, testResults: '**/nosetests.xml'
}
success {
echo "kek!"
// step([
// $class: 'CoberturaPublisher',
// coberturaReportFile: '**/coverage.xml',
// ])
}
}
}
}
post {
always {
echo 'This will always run'
}
success {
echo 'This will run only if successful'
withPythonEnv('System-CPython-3.10') {
echo 'This will run only if successful'
pysh "version --plugin=wheel -B${env.BUILD_NUMBER} --skip-build"
sh "which git"
sh "git push --tags"
}
}
failure {
emailext subject: "JENKINS-NOTIFICATION: ${currentBuild.currentResult}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}'",
body: '${SCRIPT, template="groovy-text.template"}',
recipientProviders: [culprits(), brokenBuildSuspects(), brokenTestsSuspects()]

}
unstable {
echo 'This will run only if the run was marked as unstable'
}
changed {
echo 'This will run only if the state of the Pipeline has changed'
echo 'For example, if the Pipeline was previously failing but is now successful'
}
}
}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ help: ## Display this help message
install: install-python install-test assets ## Install requirements for local development and production

install-python: ## Install python requirements
pip install -r requirements.txt
pip install -r requirements.txt --upgrade --upgrade-strategy=eager

install-test: ## Install test requirements
pip install -e .[test]
pip install -e .[test] --upgrade --upgrade-strategy=eager

install-migrations-testing-requirements: ## Install migrations testing requirements
pip install -r requirements_migrations.txt
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ uWSGI>=2.0.19
whitenoise>=5.2,<6.6

# Linting
pylint>=2.17.4
pylint-django>=2.5.3
black>=23.3.0
pylint>=3.1.0
pylint-django>=2.5.5
black>=24.4.2

# Helpers
pyprof2calltree>=1.4,<1.5
Expand Down
136 changes: 71 additions & 65 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,115 +10,121 @@
import re
import sys

from setuptools import setup
from setuptools import setup, find_packages

PROJECT_DIR = os.path.dirname(__file__)

sys.path.append(os.path.join(PROJECT_DIR, 'src'))
sys.path.append(os.path.join(PROJECT_DIR, "src"))
from oscar import get_version # noqa isort:skip

install_requires = [
'django>=3.2,<4.3',
"setuptools>=51.3.3",
"django>=3.2,<4.3",
# PIL is required for image fields, Pillow is the "friendly" PIL fork
'pillow>=6.0',
"pillow>=6.0",
# We use the ModelFormSetView from django-extra-views for the basket page
'django-extra-views>=0.13,<0.15',
"django-extra-views>=0.13,<0.15",
# Search support
'django-haystack>=3.0b1',
"django-haystack>=3.0b1",
# Treebeard is used for categories
'django-treebeard>=4.3.0',
"django-treebeard>=4.3.0",
# Babel is used for currency formatting
'Babel>=1.0,<3.0',
"Babel>=1.0,<3.0",
# For manipulating search URLs
'purl>=0.7',
"purl>=0.7",
# For phone number field
'phonenumbers',
'django-phonenumber-field>=4.0.0,<7.0.0',
"phonenumbers",
"django-phonenumber-field>=4.0.0,<7.0.0",
# Used for oscar.test.factories
'factory-boy>=3.0,<3.3',
"factory-boy>=3.0,<3.3",
# Used for automatically building larger HTML tables
'django-tables2>=2.3,<2.4',
"django-tables2>=2.3,<2.4",
# Used for manipulating form field attributes in templates (eg: add
# a css class)
'django-widget-tweaks>=1.4.1',
"django-widget-tweaks>=1.4.1",
]

sorl_thumbnail_version = 'sorl-thumbnail>=12.9,<12.10'
easy_thumbnails_version = 'easy-thumbnails>=2.7,<2.8.6'
sorl_thumbnail_version = "sorl-thumbnail>=12.9,<12.10"
easy_thumbnails_version = "easy-thumbnails>=2.7,<2.8.6"

docs_requires = [
'Sphinx>=5.0',
'sphinxcontrib-spelling==7.5.1',
'sphinx_rtd_theme==1.0.0',
'sphinx-issues==3.0.1',
"Sphinx>=5.0",
"sphinxcontrib-spelling==7.5.1",
"sphinx_rtd_theme==1.0.0",
"sphinx-issues==3.0.1",
sorl_thumbnail_version,
easy_thumbnails_version,
]

test_requires = [
'WebTest>=2.0,<2.1',
'coverage>=5.4,<5.5',
'django-webtest>=1.9,<1.10',
'psycopg2-binary>=2.8,<2.10',
'pytest-django>=3.7,<3.9',
'pytest-xdist>=2.2,<3',
'tox>=3.21,<4',
'freezegun>=1.1,<2',
'pytz',
"WebTest>=2.0,<2.1",
"coverage>=5.4,<5.5",
"django-webtest>=1.9,<1.10",
"psycopg2-binary>=2.8,<2.10",
"pytest-django>=3.7,<3.9",
"pytest-xdist>=2.2,<3",
"tox>=3.21,<4",
"freezegun>=1.1,<2",
"pytz",
"vdt.versionplugin.wheel",
sorl_thumbnail_version,
easy_thumbnails_version,
]

with open(os.path.join(PROJECT_DIR, 'README.rst'), encoding="utf-8") as fh:
with open(os.path.join(PROJECT_DIR, "README.rst"), encoding="utf-8") as fh:
long_description = re.sub(
'^.. start-no-pypi.*^.. end-no-pypi', '', fh.read(), flags=re.M | re.S)
"^.. start-no-pypi.*^.. end-no-pypi", "", fh.read(), flags=re.M | re.S
)

setup(
name='django-oscar',
name="django-oscar",
version=get_version(),
url='https://github.com/django-oscar/django-oscar',
url="https://github.com/django-oscar/django-oscar",
author="David Winterbottom",
author_email="david.winterbottom@gmail.com",
description="A domain-driven e-commerce framework for Django",
long_description=long_description,
keywords="E-commerce, Django, domain-driven",
license='BSD',
platforms=['linux'],
license="BSD",
platforms=["linux"],
include_package_data=True,
python_requires='>=3.8',
package_dir={'': 'src'},
packages=find_packages('src'),
python_requires=">=3.8",
install_requires=install_requires,
extras_require={
'docs': docs_requires,
'test': test_requires,
'sorl-thumbnail': [sorl_thumbnail_version],
'easy-thumbnails': [easy_thumbnails_version],
"docs": docs_requires,
"test": test_requires,
"sorl-thumbnail": [sorl_thumbnail_version],
"easy-thumbnails": [easy_thumbnails_version],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Framework :: Django :: 4.1',
'Framework :: Django :: 4.2',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Software Development :: Libraries :: Application Frameworks']
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries :: Application Frameworks",
],
)

# Show contributing instructions if being installed in 'develop' mode
if len(sys.argv) > 1 and sys.argv[1] == 'develop':
docs_url = 'https://django-oscar.readthedocs.io/en/latest/internals/contributing/index.html'
mailing_list = 'django-oscar@googlegroups.com'
mailing_list_url = 'https://groups.google.com/forum/?fromgroups#!forum/django-oscar'
twitter_url = 'https://twitter.com/django_oscar'
if len(sys.argv) > 1 and sys.argv[1] == "develop":
docs_url = "https://django-oscar.readthedocs.io/en/latest/internals/contributing/index.html"
mailing_list = "django-oscar@googlegroups.com"
mailing_list_url = "https://groups.google.com/forum/?fromgroups#!forum/django-oscar"
twitter_url = "https://twitter.com/django_oscar"
msg = (
"You're installing Oscar in 'develop' mode so I presume you're thinking\n"
"of contributing:\n\n"
Expand All @@ -128,7 +134,7 @@
"(c) There are more detailed contributing guidelines that you should "
"have a look at:\n %s\n"
"(d) Consider following @django_oscar on Twitter to stay up-to-date\n"
" %s\n\nHappy hacking!") % (mailing_list, mailing_list_url,
docs_url, twitter_url)
line = '=' * 82
" %s\n\nHappy hacking!"
) % (mailing_list, mailing_list_url, docs_url, twitter_url)
line = "=" * 82
print(("\n%s\n%s\n%s" % (line, msg, line)))
4 changes: 2 additions & 2 deletions src/oscar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use 'alpha', 'beta', 'rc' or 'final' as the 4th element to indicate release type.
VERSION = (3, 2, 5, "alpha", 2)
VERSION = (3, 2, 5)


def get_short_version():
Expand All @@ -12,7 +12,7 @@ def get_version():
if VERSION[2]:
version = "%s.%s" % (version, VERSION[2])

if VERSION[3] != "final":
if len(VERSION) > 3 and VERSION[3] != "final":
mapping = {"alpha": "a", "beta": "b", "rc": "rc"}
version = "%s%s" % (version, mapping[VERSION[3]])
if len(VERSION) == 5:
Expand Down
3 changes: 2 additions & 1 deletion src/oscar/apps/customer/wishlists/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ def process_wishlist_forms(self, wishlist_form, shared_emails_formset):
"The shared accounts won't be able to access your wishlist "
"because the visiblity is set to private."
)
messages.warning(self.request, msg)
elif wishlist.visibility == WishList.PUBLIC:
msg = _(
"You have added shared accounts to your wishlist but the visiblity "
"is public, this means everyone with a link has access to it."
)
messages.warning(self.request, msg)
messages.warning(self.request, msg)

return wishlist

Expand Down
1 change: 1 addition & 0 deletions src/oscar/apps/offer/abstract_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ def hide_time_if_zero(dt):

if self.start_datetime or self.end_datetime:
today = now()
is_satisfied = False
if self.start_datetime and self.end_datetime:
desc = _("Available between %(start)s and %(end)s") % {
"start": hide_time_if_zero(self.start_datetime),
Expand Down

0 comments on commit 5f2061d

Please sign in to comment.