From 804cac03db0aade20a9faa377d713906adaa003c Mon Sep 17 00:00:00 2001 From: Daniel Levy <daniell@aptivate.org> Date: Mon, 9 Mar 2020 12:17:26 +0000 Subject: [PATCH] Change CI config to split testing into stages --- .gitlab-ci.yml | 68 ++++++++++++++++++---- Pipfile | 4 +- Pipfile.lock | 153 ++++++++++++++++++++++++++++++++++--------------- 3 files changed, 167 insertions(+), 58 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4aec82f9..027fb3e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,25 +1,69 @@ --- -image: python:3.6 - -services: - - mysql:5.7 - variables: DJANGO_SECRET_KEY: foobarbazbazbarfoo MYSQL_ROOT_PASSWORD: internewshid MYSQL_DATABASE: internewshid -before_script: - - ln -srf internewshid/local_settings.py.gitlab internewshid/local_settings.py - - echo "SECRET_KEY = '$DJANGO_SECRET_KEY'" >> internewshid/private_settings.py - - echo "DB_PASSWORD = '$MYSQL_ROOT_PASSWORD'" >> internewshid/private_settings.py - - apt update && apt install -y default-libmysqlclient-dev python-pymysql python-mysqldb nodejs node-less - - pip install pipenv && pipenv sync --dev +cache: + paths: + - "$CI_PROJECT_DIR/.cache/pip" + - "$CI_PROJECT_DIR/.cache/pipenv" + +stages: + - sanity + - lint + - test -gitlab-ci: + +code-sanity: + image: python:3.6 + services: + - mysql:5.7 + stage: sanity + before_script: + - ln -srf internewshid/local_settings.py.gitlab internewshid/local_settings.py + - ln -srf internewshid/language_settings.py.english internewshid/language_settings.py + - echo "SECRET_KEY = '$DJANGO_SECRET_KEY'" >> internewshid/private_settings.py + - echo "DB_PASSWORD = '$MYSQL_ROOT_PASSWORD'" >> internewshid/private_settings.py + - apt update && apt install -y default-libmysqlclient-dev python-pymysql python-mysqldb nodejs node-less + - pip install pipenv && pipenv sync --dev script: + - pipenv run safety check --bare - pipenv run python manage.py check + - pipenv run python manage.py makemigrations --check + - pipenv run python manage.py migrate --noinput + + +code-lint: + image: python:3.6 + services: + - mysql:5.7 + stage: lint + before_script: + - ln -srf internewshid/local_settings.py.gitlab internewshid/local_settings.py + - ln -srf internewshid/language_settings.py.english internewshid/language_settings.py + - echo "SECRET_KEY = '$DJANGO_SECRET_KEY'" >> internewshid/private_settings.py + - echo "DB_PASSWORD = '$MYSQL_ROOT_PASSWORD'" >> internewshid/private_settings.py + - apt update && apt install -y default-libmysqlclient-dev python-pymysql python-mysqldb nodejs node-less + - pip install pipenv && pipenv sync --dev + script: - pipenv run pylava -o setup.cfg - pipenv run isort -q -rc -c -df -sp setup.cfg + + +unit-test: + image: python:3.6 + services: + - mysql:5.7 + stage: test + before_script: + - ln -srf internewshid/local_settings.py.gitlab internewshid/local_settings.py + - ln -srf internewshid/language_settings.py.english internewshid/language_settings.py + - echo "SECRET_KEY = '$DJANGO_SECRET_KEY'" >> internewshid/private_settings.py + - echo "DB_PASSWORD = '$MYSQL_ROOT_PASSWORD'" >> internewshid/private_settings.py + - apt update && apt install -y default-libmysqlclient-dev python-pymysql python-mysqldb nodejs node-less + - pip install pipenv && pipenv sync --dev + script: - pipenv run pytest -v --cov + diff --git a/Pipfile b/Pipfile index 0320c2c5..a06a11cc 100644 --- a/Pipfile +++ b/Pipfile @@ -7,9 +7,10 @@ verify_ssl = true python_version = "3.6" [packages] +asgiref = "*" "django-bootstrap3" = "*" "django-tables2" = "*" -"django.js" = {editable = true,git = "https://git@github.com/aptivate/django.js.git",ref = "ca328a94b00023bd64f4fc1c908675edaaf2ac19"} +"django.js" = {ref = "ca328a94b00023bd64f4fc1c908675edaaf2ac19",git = "https://git@github.com/aptivate/django.js.git",editable = true} "linecache2" = "*" Django = ">2.2.8,<3.0" Pillow = "*" @@ -48,3 +49,4 @@ pytest-pythonpath = "*" werkzeug = "*" pydocstyle = "*" django-dynamic-fixture = "*" +safety = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 0990bc9b..7e26ea66 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "055641fba96483e962cb6694740ae3899da572d1da746c73accceab1a7e98008" + "sha256": "8a5bc8f5d57faebea7b5e6fc4f117b54ae9dbc2410c85feca8332dc7831aa7dd" }, "pipfile-spec": 6, "requires": { @@ -21,6 +21,7 @@ "sha256:7e06d934a7718bf3975acbf87780ba678957b87c7adc056f13b6215d610695a0", "sha256:ea448f92fc35a0ef4b1508f53a04c4670255a3f33d22a81c8fc9c872036adbe5" ], + "index": "pypi", "version": "==3.2.3" }, "cssmin": { @@ -32,12 +33,11 @@ }, "django": { "hashes": [ - "sha256:1226168be1b1c7efd0e66ee79b0e0b58b2caa7ed87717909cd8a57bb13a7079a", - "sha256:9a4635813e2d498a3c01b10c701fe4a515d76dd290aaa792ccb65ca4ccb6b038" + "sha256:65e2387e6bde531d3bb803244a2b74e0253550a9612c64a60c8c5be267b30f50", + "sha256:b51c9c548d5c3b3ccbb133d0bebc992e8ec3f14899bce8936e6fdda6b23a1881" ], "index": "pypi", - "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", - "version": "==2.2.10" + "version": "==2.2.11" }, "django-assets": { "hashes": [ @@ -64,11 +64,13 @@ "version": "==1.14.0" }, "django-constance": { + "extras": [ + "database" + ], "hashes": [ "sha256:12d827f9d5552ee39884fb6fb356f231f32b1ab8958acc715e3d1a6ecf913653" ], "index": "pypi", - "markers": null, "version": "==2.6.0" }, "django-debug-toolbar": { @@ -109,6 +111,11 @@ "index": "pypi", "version": "==1.0.3" }, + "django-js": { + "editable": true, + "git": "https://git@github.com/aptivate/django.js.git", + "ref": "ca328a94b00023bd64f4fc1c908675edaaf2ac19" + }, "django-picklefield": { "hashes": [ "sha256:67a5e156343e3b032cac2f65565f0faa81635a99c7da74b0f07a0f5db467b646", @@ -174,11 +181,11 @@ }, "jsonfield": { "hashes": [ - "sha256:1a17efe9a26850e9175900cb37cf30c6182fc2251989f8af44ef47fbbf48eaff", - "sha256:a6616f38db42542d1f2434f5eae1a91550e5cc15dff27edd87b4358493ef2a92" + "sha256:7e4e84597de21eeaeeaaa7cc5da08c61c48a9b64d0c446b2d71255d01812887a", + "sha256:df857811587f252b97bafba42e02805e70a398a7a47870bc6358a0308dd689ed" ], "index": "pypi", - "version": "==3.0.0" + "version": "==3.1.0" }, "linecache2": { "hashes": [ @@ -222,7 +229,6 @@ "sha256:e840f552a509e3380b0f0ec977e8124d0dc34dc0e68289ca28f4d7c1d0d79474", "sha256:f3d0a94ad151870978fb93538e95411c83899c9dc63e6fb65542f769568ecfa5" ], - "markers": "python_version >= '3.5'", "version": "==1.18.1" }, "openpyxl": { @@ -249,7 +255,6 @@ "sha256:d10e83866b48c0cdb83281f786564e2a2b51a7ae7b8a950c3442ad3c9e36b48c", "sha256:e2140e1bbf9c46db9936ee70f4be6584d15ff8dc3dfff1da022d71227d53bad3" ], - "markers": "python_version != '3.2.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", "version": "==1.0.1" }, "pillow": { @@ -278,7 +283,6 @@ "sha256:ff3797f2f16bf9d17d53257612da84dd0758db33935777149b3334c01ff68865" ], "index": "pypi", - "markers": "python_version >= '3.5'", "version": "==7.0.0" }, "python-dateutil": { @@ -310,16 +314,14 @@ "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a", "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c" ], - "markers": "python_version != '3.2.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", "version": "==1.14.0" }, "sqlparse": { "hashes": [ - "sha256:40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177", - "sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873" + "sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e", + "sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548" ], - "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", - "version": "==0.3.0" + "version": "==0.3.1" }, "webassets": { "hashes": [ @@ -335,6 +337,7 @@ "sha256:7e06d934a7718bf3975acbf87780ba678957b87c7adc056f13b6215d610695a0", "sha256:ea448f92fc35a0ef4b1508f53a04c4670255a3f33d22a81c8fc9c872036adbe5" ], + "index": "pypi", "version": "==3.2.3" }, "attrs": { @@ -342,9 +345,29 @@ "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c", "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72" ], - "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", "version": "==19.3.0" }, + "certifi": { + "hashes": [ + "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3", + "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f" + ], + "version": "==2019.11.28" + }, + "chardet": { + "hashes": [ + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + ], + "version": "==3.0.4" + }, + "click": { + "hashes": [ + "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", + "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" + ], + "version": "==7.0" + }, "coverage": { "hashes": [ "sha256:15cf13a6896048d6d947bf7d222f36e4809ab926894beb748fc9caa14605d9c3", @@ -379,17 +402,15 @@ "sha256:ea9525e0fef2de9208250d6c5aeeee0138921057cd67fcef90fbed49c4d62d37", "sha256:fca1669d464f0c9831fd10be2eef6b86f5ebd76c724d1e0706ebdff86bb4adf0" ], - "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version != '3.4.*' and python_version < '4' and python_version >= '2.7'", "version": "==5.0.3" }, "django": { "hashes": [ - "sha256:1226168be1b1c7efd0e66ee79b0e0b58b2caa7ed87717909cd8a57bb13a7079a", - "sha256:9a4635813e2d498a3c01b10c701fe4a515d76dd290aaa792ccb65ca4ccb6b038" + "sha256:65e2387e6bde531d3bb803244a2b74e0253550a9612c64a60c8c5be267b30f50", + "sha256:b51c9c548d5c3b3ccbb133d0bebc992e8ec3f14899bce8936e6fdda6b23a1881" ], "index": "pypi", - "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", - "version": "==2.2.10" + "version": "==2.2.11" }, "django-debug-toolbar": { "hashes": [ @@ -400,10 +421,10 @@ }, "django-dynamic-fixture": { "hashes": [ - "sha256:78cfa4c32b39ce38dc0647c97e460d206a2e97affc34ab2a1986812cd65dfbc0" + "sha256:cb6fac74b60ced901ce1f8f9e4dd8c438ab6e9021301a5ce2550fb424add4c33" ], "index": "pypi", - "version": "==3.0.2" + "version": "==3.0.3" }, "django-extensions": { "hashes": [ @@ -413,12 +434,19 @@ "index": "pypi", "version": "==2.2.8" }, + "dparse": { + "hashes": [ + "sha256:00a5fdfa900629e5159bf3600d44905b333f4059a3366f28e0dbd13eeab17b19", + "sha256:cef95156fa0adedaf042cd42f9990974bec76f25dfeca4dc01f381a243d5aa5b" + ], + "version": "==0.4.1" + }, "factory-boy": { "hashes": [ "sha256:728df59b372c9588b83153facf26d3d28947fc750e8e3c95cefa9bed0e6394ee", "sha256:faf48d608a1735f0d0a3c9cbf536d64f9132b547dae7ba452c4d99a79e84a370" ], - "markers": "python_version != '3.2.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", + "index": "pypi", "version": "==2.12.0" }, "faker": { @@ -426,9 +454,15 @@ "sha256:440d68fe0e46c1658b1975b2497abe0c24a7f772e3892253f31e713ffcc48965", "sha256:ee24608768549c2c69e593e9d7a3b53c9498ae735534243ec8390cae5d529f8b" ], - "markers": "python_version >= '2.7' and python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.0.*'", "version": "==4.0.1" }, + "idna": { + "hashes": [ + "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb", + "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa" + ], + "version": "==2.9" + }, "importlib-metadata": { "hashes": [ "sha256:06f5b3a99029c7134207dd882428a66992a9de2bef7c2b699b5641f9886c3302", @@ -465,23 +499,20 @@ "sha256:5dd8bcf33e5f9513ffa06d5ad33d78f31e1931ac9a18f33d37e77a180d393a7c", "sha256:b1ddb932186d8a6ac451e1d95844b382f55e12686d51ca0c68b6f61f2ab7a507" ], - "markers": "python_version >= '3.5'", "version": "==8.2.0" }, "packaging": { "hashes": [ - "sha256:170748228214b70b672c581a3dd610ee51f733018650740e98c7df862a583f73", - "sha256:e665345f9eef0c621aa0bf2f8d78cf6d21904eef16a93f020240b704a57f1334" + "sha256:3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3", + "sha256:82f77b9bee21c1bafbf35a84905d604d5d1223801d639cf3ed140bd651c08752" ], - "markers": "python_version != '3.0.*' and python_version >= '2.7' and python_version != '3.2.*' and python_version != '3.1.*'", - "version": "==20.1" + "version": "==20.3" }, "pluggy": { "hashes": [ "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d" ], - "markers": "python_version >= '3.5'", "version": "==0.13.1" }, "py": { @@ -497,7 +528,6 @@ "sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56", "sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c" ], - "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", "version": "==2.5.0" }, "pydocstyle": { @@ -513,7 +543,6 @@ "sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0", "sha256:d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2" ], - "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", "version": "==2.1.1" }, "pylava": { @@ -537,7 +566,6 @@ "sha256:0d5fe9189a148acc3c3eb2ac8e1ac0742cb7618c084f3d228baaec0c254b318d", "sha256:ff615c761e25eb25df19edddc0b970302d2a9091fbce0e7213298d85fb61fef6" ], - "markers": "python_version >= '3.6'", "version": "==5.3.5" }, "pytest-cov": { @@ -586,12 +614,42 @@ "index": "pypi", "version": "==2019.3" }, + "pyyaml": { + "hashes": [ + "sha256:059b2ee3194d718896c0ad077dd8c043e5e909d9180f387ce42012662a4946d6", + "sha256:1cf708e2ac57f3aabc87405f04b86354f66799c8e62c28c5fc5f88b5521b2dbf", + "sha256:24521fa2890642614558b492b473bee0ac1f8057a7263156b02e8b14c88ce6f5", + "sha256:4fee71aa5bc6ed9d5f116327c04273e25ae31a3020386916905767ec4fc5317e", + "sha256:70024e02197337533eef7b85b068212420f950319cc8c580261963aefc75f811", + "sha256:74782fbd4d4f87ff04159e986886931456a1894c61229be9eaf4de6f6e44b99e", + "sha256:940532b111b1952befd7db542c370887a8611660d2b9becff75d39355303d82d", + "sha256:cb1f2f5e426dc9f07a7681419fe39cee823bb74f723f36f70399123f439e9b20", + "sha256:dbbb2379c19ed6042e8f11f2a2c66d39cceb8aeace421bfc29d085d93eda3689", + "sha256:e3a057b7a64f1222b56e47bcff5e4b94c4f61faac04c7c4ecb1985e18caa3994", + "sha256:e9f45bd5b92c7974e59bcd2dcc8631a6b6cc380a904725fce7bc08872e691615" + ], + "version": "==5.3" + }, + "requests": { + "hashes": [ + "sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee", + "sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6" + ], + "version": "==2.23.0" + }, + "safety": { + "hashes": [ + "sha256:0a3a8a178a9c96242b224f033ee8d1d130c0448b0e6622d12deaf37f6c3b4e59", + "sha256:5059f3ffab3648330548ea9c7403405bbfaf085b11235770825d14c58f24cb78" + ], + "index": "pypi", + "version": "==1.8.5" + }, "six": { "hashes": [ "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a", "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c" ], - "markers": "python_version != '3.2.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", "version": "==1.14.0" }, "snowballstemmer": { @@ -603,11 +661,10 @@ }, "sqlparse": { "hashes": [ - "sha256:40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177", - "sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873" + "sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e", + "sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548" ], - "markers": "python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.7'", - "version": "==0.3.0" + "version": "==0.3.1" }, "text-unidecode": { "hashes": [ @@ -616,6 +673,13 @@ ], "version": "==1.3" }, + "urllib3": { + "hashes": [ + "sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc", + "sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc" + ], + "version": "==1.25.8" + }, "wcwidth": { "hashes": [ "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603", @@ -633,11 +697,10 @@ }, "zipp": { "hashes": [ - "sha256:12248a63bbdf7548f89cb4c7cda4681e537031eda29c02ea29674bc6854460c2", - "sha256:7c0f8e91abc0dc07a5068f315c52cb30c66bfbc581e5b50704c8a2f6ebae794a" + "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b", + "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96" ], - "markers": "python_version >= '3.6'", - "version": "==3.0.0" + "version": "==3.1.0" } } } -- GitLab