From 5873dd46c3ef695e6e95d5c1c7594d7d0435bf02 Mon Sep 17 00:00:00 2001 From: Jorrit Strikwerda Date: Mon, 18 Mar 2024 16:02:46 +0100 Subject: [PATCH 01/11] Add auto test deploy to merge develop --- .github/workflows/ci-cd.yaml | 53 +++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index 8311db9..d7d4599 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -21,8 +21,8 @@ jobs: - name: Linting run: bash bin/cleanup_pre_commit.sh - docker-build-and-test: - name: Create Docker image and test + create-docker-test-image-and-test: + name: Create Docker test image and test runs-on: ubuntu-latest needs: django-lint steps: @@ -41,15 +41,10 @@ jobs: - name: Run Tests run: docker compose -f docker-compose.test.yaml run app python manage.py test - deploy-acc: - name: Acceptance release - environment: acc - if: github.ref == 'refs/heads/develop' - needs: docker-build-and-test + build-and-push-docker-image: + name: Build and push Docker image runs-on: ubuntu-latest - permissions: - contents: read - packages: write + needs: create-docker-test-image-and-test steps: - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -80,6 +75,44 @@ jobs: build-args: | GIT_SHA=${{ github.sha }} + deploy-acc: + name: Acceptance release + if: github.ref == 'refs/heads/develop' + needs: build-and-push-docker-image + runs-on: ubuntu-latest + environment: acc + permissions: + contents: read + packages: write + steps: + - name: Start rollout on k8s platform + uses: actions-hub/kubectl@master + env: + KUBE_HOST: ${{ vars.KUBE_HOST }} + KUBE_CERTIFICATE: ${{ vars.KUBE_CERTIFICATE }} + KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }} + with: + args: rollout restart deployment/app --namespace=${{ vars.KUBE_NAMESPACE }} + + - name: Status rollout on k8s platform + uses: actions-hub/kubectl@master + env: + KUBE_HOST: ${{ vars.KUBE_HOST }} + KUBE_CERTIFICATE: ${{ vars.KUBE_CERTIFICATE }} + KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }} + with: + args: rollout status deployment/app --namespace=${{ vars.KUBE_NAMESPACE }} + + deploy-test: + name: Test release + if: github.ref == 'refs/heads/develop' + needs: build-and-push-docker-image + runs-on: ubuntu-latest + environment: test + permissions: + contents: read + packages: write + steps: - name: Start rollout on k8s platform uses: actions-hub/kubectl@master env: From 653fb9c0f3b2439dba86acf21f64eeb8637e75d4 Mon Sep 17 00:00:00 2001 From: Jorrit Strikwerda Date: Mon, 18 Mar 2024 17:03:51 +0100 Subject: [PATCH 02/11] Added prettier, eslint and djlint to mbc. Updated pre-commit. Formatted and linted. --- .djlintrc | 3 + .pre-commit-config.yaml | 50 +- app/apps/main/templates/404.html | 29 +- app/apps/main/templates/500.html | 29 +- app/apps/main/templates/base.html | 56 +- app/apps/main/templates/email/email.html | 386 +- .../email/email_melding_aanmaken.html | 366 +- .../templates/email/melding_behandeld.html | 296 +- app/apps/main/templates/melding/aanmaken.html | 152 +- .../main/templates/melding/verzonden.html | 18 +- app/apps/main/templates/snippets/legend.html | 2 +- .../main/templates/snippets/pageheader.html | 205 +- .../main/templates/widgets/radio_option.html | 11 +- .../rotterdam_formulier_html/attrs.html | 3 +- .../rotterdam_formulier_html/field.html | 354 +- .../rotterdam_formulier_html/field_icon.html | 6 +- .../rotterdam_formulier_html/form.html | 12 +- .../rotterdam_formulier_html/formset.html | 5 +- app/frontend/.eslintignore | 1 + app/frontend/.eslintrc.js | 19 + app/frontend/.prettierrc | 18 + app/frontend/.stylelintrc | 18 + app/frontend/assets/app.js | 4 +- app/frontend/assets/bootstrap.js | 8 +- .../assets/controllers/request_controller.js | 481 +- app/frontend/assets/styles/_base.scss | 122 +- app/frontend/assets/styles/_theme.scss | 177 +- app/frontend/assets/styles/app.scss | 2 +- .../assets/styles/components/_alert.scss | 4 +- .../assets/styles/components/_buttons.scss | 171 +- .../assets/styles/components/_filters.scss | 19 +- .../assets/styles/components/_fonts.scss | 42 +- .../assets/styles/components/_forms.scss | 251 +- .../styles/components/_full-page-view.scss | 6 +- .../styles/components/_incident-details.scss | 21 +- .../styles/components/_list-incidents.scss | 23 +- .../styles/components/_list-mutations.scss | 4 +- .../assets/styles/components/_modal.scss | 5 +- .../assets/styles/components/_navigation.scss | 3 +- .../assets/styles/components/_pageHeader.scss | 2 +- .../assets/styles/components/_spinner.scss | 14 +- app/frontend/package-lock.json | 12043 ++++++++++++---- app/frontend/package.json | 19 +- app/frontend/webpack.config.js | 214 +- 44 files changed, 10589 insertions(+), 5085 deletions(-) create mode 100644 .djlintrc create mode 100644 app/frontend/.eslintignore create mode 100644 app/frontend/.eslintrc.js create mode 100644 app/frontend/.prettierrc create mode 100644 app/frontend/.stylelintrc diff --git a/.djlintrc b/.djlintrc new file mode 100644 index 0000000..a8a6c96 --- /dev/null +++ b/.djlintrc @@ -0,0 +1,3 @@ +{ + "ignore": "H006, H013, H023" +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index df31eb6..dfd2262 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,26 +1,44 @@ repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 - hooks: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - id: detect-private-key - - repo: https://github.com/humitos/mirrors-autoflake.git - rev: v1.1 - hooks: + - repo: https://github.com/humitos/mirrors-autoflake.git + rev: v1.1 + hooks: - id: autoflake - args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] - - repo: https://github.com/timothycrosley/isort - rev: '5.12.0' - hooks: + args: + [ + "--in-place", + "--remove-all-unused-imports", + "--remove-unused-variable", + ] + - repo: https://github.com/timothycrosley/isort + rev: "5.13.2" + hooks: - id: isort - - repo: https://github.com/ambv/black - rev: '23.10.1' - hooks: + - repo: https://github.com/ambv/black + rev: "23.10.1" + hooks: - id: black language_version: python3 - - repo: https://github.com/pycqa/flake8 - rev: '6.1.0' - hooks: + - repo: https://github.com/pycqa/flake8 + rev: "6.1.0" + hooks: - id: flake8 + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v3.0.3" + hooks: + - id: prettier + additional_dependencies: + - prettier@3.0.3 + files: '\.(js|ts|jsx|tsx|scss|css)$' + - repo: https://github.com/djlint/djLint + rev: v1.34.1 + hooks: + - id: djlint-reformat-django + - id: djlint-django + args: ["--ignore", "H006,H013,H023"] diff --git a/app/apps/main/templates/404.html b/app/apps/main/templates/404.html index 7e9b3b8..d9cc83c 100644 --- a/app/apps/main/templates/404.html +++ b/app/apps/main/templates/404.html @@ -1,17 +1,16 @@ -{% extends 'base.html' %} -{% block title %}404 Pagina niet gevonden{% endblock %} - +{% extends "base.html" %} +{% block title %} + 404 Pagina niet gevonden +{% endblock title %} {% block javascripts %} -{% endblock %} - +{% endblock javascripts %} {% block body %} -
-
-
-

De pagina is niet gevonden

- 404 -
-
- -
-{% endblock %} +
+
+
+

De pagina is niet gevonden

+ 404 +
+
+
+{% endblock body %} diff --git a/app/apps/main/templates/500.html b/app/apps/main/templates/500.html index eeec940..df66d4d 100644 --- a/app/apps/main/templates/500.html +++ b/app/apps/main/templates/500.html @@ -1,17 +1,16 @@ -{% extends 'base.html' %} -{% block title %}500 Er ging iets mis{% endblock %} - +{% extends "base.html" %} +{% block title %} + 500 Er ging iets mis +{% endblock title %} {% block javascripts %} -{% endblock %} - +{% endblock javascripts %} {% block body %} -
-
-
-

Er ging iets mis!

- 500 -
-
- -
-{% endblock %} +
+
+
+

Er ging iets mis!

+ 500 +
+
+
+{% endblock body %} diff --git a/app/apps/main/templates/base.html b/app/apps/main/templates/base.html index 3885622..c4947a5 100644 --- a/app/apps/main/templates/base.html +++ b/app/apps/main/templates/base.html @@ -5,22 +5,41 @@ + + - {% block title %}Begraven en Cremeren{% endblock %} - - - - - - - - + + {% block title %} + Begraven en Cremeren + {% endblock title %} + + + + + + + + {% block stylesheets %} {% render_bundle 'app' 'css' %} - {% endblock %} - + {% endblock stylesheets %} {% if DEBUG %} - + {% endif %} - {% block javascripts %} {% render_bundle 'app' 'js' %} - - {% endblock %} + + {% endblock javascripts %} - {% include 'snippets/pageheader.html' %} + {% include "snippets/pageheader.html" %}
- {% block body %}{% endblock %} + {% block body %} + {% endblock body %}
diff --git a/app/apps/main/templates/email/email.html b/app/apps/main/templates/email/email.html index 605f7d4..909a546 100644 --- a/app/apps/main/templates/email/email.html +++ b/app/apps/main/templates/email/email.html @@ -1,8 +1,13 @@ - + + + Serviceverzoek - - + +
- - - + + - + + -