diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fdee70408f1f37c72323e932f8ea74d830cb707a..e1b703fac514d4faf76b79d60e54141e21a9c622 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,8 +13,11 @@ before_script: - python3 -m coverage --version - echo "${CI_COMMIT_TAG}" | grep -qE "v[0-9]+[.][0-9]+[.][0-9]+.*" && export UFFD_PACKAGE_VERSION="${CI_COMMIT_TAG#v}" || export UFFD_PACKAGE_VERSION="${CI_COMMIT_SHA}" -build:pip: +.build: stage: build + +build:pip: + extends: .build script: - pip3 install build - PACKAGE_VERSION="${UFFD_PACKAGE_VERSION}" python3 -m build @@ -23,7 +26,7 @@ build:pip: - dist/* build:apt: - stage: build + extends: .build script: - apt update - apt-get install -y python3-all debhelper python3-pip git-buildpackage @@ -91,12 +94,17 @@ html5validator: - pages - html5validator.log -trans_de: +.trans: stage: test script: - - ./update_translations.sh de + - ./update_translations.sh $TRANSLATION_LANGUAGE coverage: '/^TOTAL.*\s+(\d+\%)$/' +trans_de: + extends: .trans + variables: + TRANSLATION_LANGUAGE: de + test:package:pip: stage: test script: @@ -111,22 +119,23 @@ test:package:apt: dependencies: - build:apt -publish:pip: +.publish: stage: deploy + rules: + - if: '$CI_COMMIT_TAG =~ /v[0-9]+[.][0-9]+[.][0-9]+.*/' + +publish:pip: + extends: .publish script: - pip3 install twine - TWINE_USERNAME="${GITLABPKGS_USERNAME}" TWINE_PASSWORD="${GITLABPKGS_PASSWORD}" python3 -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* - TWINE_USERNAME="${PYPI_USERNAME}" TWINE_PASSWORD="${PYPI_PASSWORD}" python3 -m twine upload dist/* dependencies: - build:pip - rules: - - if: '$CI_COMMIT_TAG =~ /v[0-9]+[.][0-9]+[.][0-9]+.*/' publish:apt: - stage: deploy + extends: .publish script: - exit 0 dependencies: - build:apt - rules: - - if: '$CI_COMMIT_TAG =~ /v[0-9]+[.][0-9]+[.][0-9]+.*/' diff --git a/MANIFEST.in b/MANIFEST.in index 76b04db4d822422966186691f11b115b7cdd9859..7e8a1c8a59eb3442fae1384bbc6b31194013df76 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ include setup.py +recursive-include uffd *.py *.html *.js *.css *.txt *.po *.cfg graft uffd/migrations graft uffd/templates graft uffd/*/templates diff --git a/debian/control b/debian/control index 5d85a101a4013f352c8c8cbc2072b0cd4cb703a4..f0c914efc59e5f104d23f5245e18b03782a009a7 100644 --- a/debian/control +++ b/debian/control @@ -24,6 +24,7 @@ Depends: python3-fido2, python3-flask-oauthlib, python3-flask-babel, +Recommends: nginx, uwsgi, uwsgi-plugin-python3, diff --git a/debian/uffd.dirs b/debian/dirs similarity index 100% rename from debian/uffd.dirs rename to debian/dirs diff --git a/debian/install b/debian/install new file mode 100644 index 0000000000000000000000000000000000000000..7d684bb988d82f9a134bcffb8f1cb515fec140bd --- /dev/null +++ b/debian/install @@ -0,0 +1,3 @@ +uwsgi.ini /etc/uffd/ +nginx.include.conf /etc/uffd/ +debian/uffd.cfg /etc/uffd/ diff --git a/debian/links b/debian/links new file mode 100644 index 0000000000000000000000000000000000000000..21a45dcfd9904e1009871b24b40837cfd771576b --- /dev/null +++ b/debian/links @@ -0,0 +1 @@ +/etc/uffd/uffd.cfg /usr/share/uffd/uffd/instance/config.cfg diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000000000000000000000000000000000000..9615da0b8c78a5e4ec6cc467c77bc7744c6ff0a3 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +case "$1" in + configure) + getent group uffd >/dev/null 2>&1 || addgroup --system uffd + adduser --system --home /var/lib/uffd --quiet uffd --ingroup uffd || true + + chown -R uffd:uffd /var/lib/uffd + chmod 0770 /var/lib/uffd + + chown root:uffd /etc/uffd/uffd.cfg + chmod 0640 /etc/uffd/uffd.cfg + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000000000000000000000000000000000000..835109bc830012c4746e435d1de0b565b83772e2 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +case "$1" in + purge) + delgroup uffd || true + userdel uffd || true + rm -rf /var/lib/uffd + ;; + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/uffd.cfg b/debian/uffd.cfg new file mode 100644 index 0000000000000000000000000000000000000000..f3740716faa231228f4aab35a845a05748de677a --- /dev/null +++ b/debian/uffd.cfg @@ -0,0 +1,2 @@ +FLASK_ENV=production +SQLALCHEMY_DATABASE_URI=sqlite:///var/lib/uffd/db.sqlite diff --git a/debian/uffd.install b/debian/uffd.install deleted file mode 100644 index f58a61a6f2db82fd56f8b66fbbb4a660e0709835..0000000000000000000000000000000000000000 --- a/debian/uffd.install +++ /dev/null @@ -1,2 +0,0 @@ -uwsgi.ini /etc/uwsgi/apps-available/uffd.ini -nginx.include.conf /etc/nginx/snippets/uffd-locations.conf diff --git a/debian/uffd.links b/debian/uffd.links deleted file mode 100644 index d9fac40f8366c725a68a6d9a734298014bdf50f1..0000000000000000000000000000000000000000 --- a/debian/uffd.links +++ /dev/null @@ -1 +0,0 @@ -/usr/share/uffd/uffd/instance/config.py /etc/uffd/config.py diff --git a/uwsgi.ini b/uwsgi.ini index 1ccf819f936aecbd36dc5f21612b761d68967f76..2fc0620517ea978a8cad8f872161b1331222880c 100644 --- a/uwsgi.ini +++ b/uwsgi.ini @@ -3,6 +3,7 @@ plugin = python3 env = PYTHONIOENCODING=UTF-8 env = LANG=en_GB.utf8 env = TZ=Europe/Berlin +env = CONFIG_FILENAME=/etc/uffd/uffd.cfg manage-script-name = true chdir = /usr/share/uffd module = uffd:create_app()