From 682b79858306a90ba9b5391c9d3032e73b864744 Mon Sep 17 00:00:00 2001 From: "Craig M. Stimmel" Date: Wed, 22 May 2024 11:10:52 -0700 Subject: [PATCH 01/29] Add example github action --- .github/workflows/cicd.yml | 194 +++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 .github/workflows/cicd.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..c047486 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,194 @@ +# +# Example GitHub Actions config that drives UW-IT AXD2 integration and deployment +# +# Preconditions: +# +# 1) Application docker build is based on django-container +# +# 2) Application test suite is kicked off in docker/test.sh +# +# 3) Application repo has access to the two secrets +# at https://github.com/organizations/uw-it-aca/settings/secrets: +# +# GH_AUTH_TOKEN: Grants access to private flux deployment repo +# GCP_JSON_KEY: Grants access to Google Cloud Registry +# +# To adapt this config file to a specific django project: +# +# 1) Set RELEASE_NAME suitable for deployment to k8s. RELEASE_NAME must +# match the "repo" value in docker/*-values.yml. +# +# 2) Set DJANGO_APP to the name of the django project name/directory. +# +# 3) Verify that the lists of branches for push/pull_request is appropriate, +# and add other branch names if needed. Additional branch names must +# also have steps defined in the deploy job +# +# 4) Confirm that the build steps are suitable. Likely they are, but +# some projects have an intermediate build step that could benefit +# from caching, so it may be useful to augment the build steps. +# +--- +name: Build, Test and Deploy + +env: + RELEASE_NAME: app_name + DJANGO_APP: app_name + +# Be sure that branches defined here have corresponding steps +# defined in the "deploy" job +on: + push: + branches: [main, master, qa, develop, feature/eval-me] + pull_request: + branches: [main, master, qa, develop, feature/eval-me] + types: [opened, reopened, synchronize] + +jobs: + context: + runs-on: ubuntu-22.04 + + outputs: + commit_hash: ${{ steps.context.outputs.commit_hash }} + git_repo_branch: ${{ steps.context.outputs.git_repo_branch }} + image_tag: ${{ steps.context.outputs.image_tag }} + + steps: + - name: Set up Context + id: context + uses: uw-it-aca/actions/cicd-context@main + with: + release_name: ${{ env.RELEASE_NAME }} + + build: + runs-on: ubuntu-22.04 + + needs: context + + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Run Python Linters + uses: uw-it-aca/actions/python-linters@main + with: + app_name: ${DJANGO_APP} + exclude_paths: 'migrations' + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-$(echo ${{ hashFiles('Dockerfile') }} | head -c 16) + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build App Image + uses: docker/build-push-action@v3 + with: + context: . + target: app-container + tags: ${{ needs.context.outputs.image_tag }} + push: false + load: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Build Test Image + uses: docker/build-push-action@v3 + with: + target: app-test-container + tags: app-test-container + push: false + load: true + + - name: Run Tests in Image + id: tests + shell: bash + run: >- + docker run -u root -t + -v ${PWD}:/coverage + -e DJANGO_APP="$DJANGO_APP" + -e "ENV=localdev" -e "AUTH=SAML_MOCK" + app-test-container + bash -c ". ./docker/test.sh" + + - name: Record Test Results + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + python -m pip install --upgrade pip coverage coveralls==3.3.1 + coverage combine + coveralls + +# - name: Push Image to Repository +# if: github.event_name == 'push' +# uses: uw-it-aca/actions/gcr-push@main +# with: +# image_tag: ${{ needs.context.outputs.image_tag }} +# gcp_json_key: ${{ secrets.GCP_JSON_KEY }} +# +# deploy: +# if: github.event_name == 'push' +# +# needs: [context, build] +# +# outputs: +# context: ${{ steps.context.outputs.context }} +# +# runs-on: ubuntu-22.04 +# +# steps: +# - name: Checkout Repo +# uses: actions/checkout@v3 +# +# - name: Deployment Pipeline +# if: >- +# contains(fromJSON('["main", "master", "develop", "qa"]'), +# needs.context.outputs.git_repo_branch) +# uses: uw-it-aca/actions/cicd-deploy@main +# with: +# release_name: ${{ env.RELEASE_NAME }} +# commit_hash: ${{ needs.context.outputs.commit_hash }} +# git_repo_branch: ${{ needs.context.outputs.git_repo_branch }} +# gh_auth_token: ${{ secrets.GH_AUTH_TOKEN }} +# +# - name: Deploy Evaluation Branch +# if: needs.context.outputs.git_repo_branch == 'feature/eval-me' +# uses: uw-it-aca/actions/cicd-deploy@main +# with: +# release_name: ${{ env.RELEASE_NAME }} +# commit_hash: ${{ needs.context.outputs.commit_hash }} +# git_repo_branch: ${{ needs.context.outputs.git_repo_branch }} +# gh_auth_token: ${{ secrets.GH_AUTH_TOKEN }} +# app_instance: eval +# +# - name: 'Surface context from executed build step' +# id: context +# shell: bash +# run: echo "context=$(< ${CONTEXT_FILENAME})" >> $GITHUB_OUTPUT +# +# housekeeping: +# if: github.event_name == 'push' +# +# needs: [context, build, deploy] +# +# runs-on: ubuntu-22.04 +# +# steps: +# - name: House Keeping +# uses: uw-it-aca/actions/cicd-housekeeping@main +# with: +# release_name: ${{ env.RELEASE_NAME }} +# gh_auth_token: ${{ secrets.GH_AUTH_TOKEN }} +# registry_password: ${{ secrets.GCP_JSON_KEY }} +# context: ${{ needs.deploy.outputs.context }} From ad00cc6cec81cdbbd35f5c32287074b9fa1eb6ba Mon Sep 17 00:00:00 2001 From: "Craig M. Stimmel" Date: Wed, 22 May 2024 11:21:10 -0700 Subject: [PATCH 02/29] Remove linters from test.sh, relying just on the step in cicd --- docker/test.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docker/test.sh b/docker/test.sh index 035774c..88e9ff0 100644 --- a/docker/test.sh +++ b/docker/test.sh @@ -13,13 +13,14 @@ function run_test { eval $1 } -run_test "pycodestyle ${DJANGO_APP}/ --exclude=migrations,static" - -if [ -d ${DJANGO_APP}/static/${DJANGO_APP}/js ]; then - run_test "jshint ${DJANGO_APP}/static/${DJANGO_APP}/js --verbose" -elif [ -d ${DJANGO_APP}/static/js ]; then - run_test "jshint ${DJANGO_APP}/static/js --verbose" -fi +# Moving to github action - remove this when successful +#run_test "pycodestyle ${DJANGO_APP}/ --exclude=migrations,static" +# +#if [ -d ${DJANGO_APP}/static/${DJANGO_APP}/js ]; then +# run_test "jshint ${DJANGO_APP}/static/${DJANGO_APP}/js --verbose" +#elif [ -d ${DJANGO_APP}/static/js ]; then +# run_test "jshint ${DJANGO_APP}/static/js --verbose" +#fi run_test "python -Wd -m coverage run --source=${DJANGO_APP} '--omit=*/migrations/*' manage.py test ${DJANGO_APP}" From b4a4c33793cad362ced98d17c77df5fbfa12ab1a Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Mon, 30 Sep 2024 22:17:41 -0700 Subject: [PATCH 03/29] Updates eslint and prettier configs. --- .eslintrc.cjs | 18 ------------ .stylelintignore | 2 -- .stylelintrc | 8 +----- app_name/templates/index.html | 2 +- app_name_vue/main.js | 18 ++++++------ app_name_vue/pages/customize.vue | 3 +- eslint.config.js | 16 +++++++++++ package.json | 49 ++++++++++++++++++-------------- 8 files changed, 56 insertions(+), 60 deletions(-) delete mode 100644 .eslintrc.cjs delete mode 100644 .stylelintignore create mode 100644 eslint.config.js diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index f486dac..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-env node */ -require("@rushstack/eslint-patch/modern-module-resolution"); - -module.exports = { - root: true, - extends: [ - "plugin:vue/vue3-essential", - "eslint:recommended", - "@vue/eslint-config-prettier", - ], - parserOptions: { - ecmaVersion: "latest", - }, - env: { - "vue/setup-compiler-macros": true, - node: true, - }, -}; diff --git a/.stylelintignore b/.stylelintignore deleted file mode 100644 index eeec074..0000000 --- a/.stylelintignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore bundles for stylelinting -bundles/ \ No newline at end of file diff --git a/.stylelintrc b/.stylelintrc index 2691235..e6c1776 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -5,12 +5,6 @@ ], "rules": { "scss/no-global-function-names": null, - "no-invalid-position-at-import-rule": null, - "scss/at-import-partial-extension": [ - "never", - { - "severity": "warning" - } - ] + "no-invalid-position-at-import-rule": null } } diff --git a/app_name/templates/index.html b/app_name/templates/index.html index f7efe62..bf0ca7a 100644 --- a/app_name/templates/index.html +++ b/app_name/templates/index.html @@ -17,7 +17,7 @@ + class="bg-body"> {% csrf_token %}
diff --git a/app_name_vue/main.js b/app_name_vue/main.js index 37bfb8b..96226f2 100644 --- a/app_name_vue/main.js +++ b/app_name_vue/main.js @@ -1,10 +1,10 @@ import { createApp } from "vue"; import { createPinia } from "pinia"; // import VueGtag from "vue-gtag-next"; -import { Vue3Mq, MqResponsive } from "vue3-mq"; +import { Vue3Mq } from "vue3-mq"; // import solstice-vue -import SolsticeVue from "solstice-vue"; +//import SolsticeVue from "solstice-vue"; import App from "@/app.vue"; import router from "@/router"; @@ -13,12 +13,13 @@ import router from "@/router"; import "bootstrap"; import "bootstrap-icons/font/bootstrap-icons.css"; -// bootstrap (all default bs styles) -// import "./css/basic.scss"; - -// bootstrap + solstice-vue -import "@/css/custom.scss"; +// solstice-vue (1.1.0) import "solstice-vue/dist/style.css"; +import "solstice-vue/dist/solstice.scss"; + +// bootstrap-vue-next +// import "bootstrap/dist/css/bootstrap.css"; +import "bootstrap-vue-next/dist/bootstrap-vue-next.css"; const app = createApp(App); app.config.productionTip = false; @@ -47,14 +48,13 @@ app.use(VueGtag, { app.use(Vue3Mq, { preset: "bootstrap5", }); -app.component("mq-responsive", MqResponsive); // pinia (vuex) state management const pinia = createPinia(); app.use(pinia); // solstice-vue -app.use(SolsticeVue); +//app.use(SolsticeVue); // vue-router app.use(router); diff --git a/app_name_vue/pages/customize.vue b/app_name_vue/pages/customize.vue index be8ca50..ff87bce 100644 --- a/app_name_vue/pages/customize.vue +++ b/app_name_vue/pages/customize.vue @@ -126,11 +126,12 @@ import { formatPhoneNumber } from "@/utils/format"; export default { name: "PagesCustomize", - inject: ["mq"], + components: { DefaultLayout, HelloWorld, }, + inject: ["mq"], // setup() is needed for Composition API setup() { // instantiate composable diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..5fa4e1a --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,16 @@ +import pluginVue from "eslint-plugin-vue"; +import eslintConfigPrettier from "eslint-config-prettier"; + +export default [ + // add more generic rulesets here, such as: + // js.configs.recommended, + ...pluginVue.configs["flat/recommended"], + eslintConfigPrettier, + // ...pluginVue.configs['flat/vue2-recommended'], // Use this if you are using Vue.js 2.x. + { + rules: { + // override/add rules settings here, such as: + // 'vue/no-unused-vars': 'error' + }, + }, +]; diff --git a/package.json b/package.json index a0e1062..338f7d3 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "watch": "vite build --watch --mode development", "test": "vitest --environment jsdom", "coverage": "vitest run --coverage", - "eslint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --ignore-path .gitignore", + "eslint": "eslint 'app_name_vue/**/*.{js,vue}'", "stylelint": "stylelint '**/*.{vue,scss}'" }, "repository": { @@ -23,34 +23,39 @@ "homepage": "https://github.com/uw-it-aca/app_name#readme", "dependencies": { "@popperjs/core": "^2.11.8", - "axios": "^1.6.7", + "@vueuse/core": "^11.1.0", + "@vueuse/integrations": "^10.11.1", + "axios": "^1.7.7", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", - "pinia": "^2.1.7", - "solstice-vue": "github:uw-it-aca/solstice-vue#1.0.6", - "vue": "^3.4.21", + "bootstrap-vue-next": "^0.24.23", + "i": "^0.3.7", + "npm": "^10.8.3", + "pinia": "^2.2.3", + "solstice-vue": "github:uw-it-aca/solstice-vue#1.1.0", + "vue": "^3.5.10", "vue-gtag-next": "^1.14.0", - "vue-router": "^4.3.0", + "vue-router": "^4.4.5", "vue3-cookies": "^1.0.6", "vue3-mq": "^3.2.0" }, "devDependencies": { - "@rushstack/eslint-patch": "^1.7.2", - "@vitejs/plugin-vue": "^5.0.4", - "@vitest/coverage-v8": "^1.3.1", - "@vue/eslint-config-prettier": "^9.0.0", - "@vue/test-utils": "^2.4.4", - "eslint": "^8.57.0", - "eslint-plugin-vue": "^9.22.0", - "jsdom": "^24.0.0", - "postcss-html": "^1.6.0", - "prettier": "^3.2.5", - "sass": "^1.71.1", - "stylelint": "^16.2.1", - "stylelint-config-recommended-scss": "^14.0.0", + "@rushstack/eslint-patch": "^1.10.4", + "@vitejs/plugin-vue": "^5.1.4", + "@vitest/coverage-v8": "^2.1.1", + "@vue/test-utils": "^2.4.6", + "eslint": "^9.11.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-vue": "^9.28.0", + "jsdom": "^25.0.1", + "postcss-html": "^1.7.0", + "prettier": "^3.3.3", + "sass": "^1.79.4", + "stylelint": "^16.9.0", + "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-vue": "^1.5.0", - "stylelint-config-standard-scss": "^13.0.0", - "vite": "^5.1.4", - "vitest": "^1.3.1" + "stylelint-config-standard-scss": "^13.1.0", + "vite": "^5.4.8", + "vitest": "^2.1.1" } } From 82a8e1ef44c00f46e1b3388d55a23c939f87769d Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Mon, 30 Sep 2024 22:31:12 -0700 Subject: [PATCH 04/29] Remove unused packages. --- package.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 338f7d3..3896100 100644 --- a/package.json +++ b/package.json @@ -24,23 +24,20 @@ "dependencies": { "@popperjs/core": "^2.11.8", "@vueuse/core": "^11.1.0", - "@vueuse/integrations": "^10.11.1", + "@vueuse/integrations": "^11.1.0", "axios": "^1.7.7", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", "bootstrap-vue-next": "^0.24.23", - "i": "^0.3.7", - "npm": "^10.8.3", "pinia": "^2.2.3", "solstice-vue": "github:uw-it-aca/solstice-vue#1.1.0", "vue": "^3.5.10", "vue-gtag-next": "^1.14.0", "vue-router": "^4.4.5", "vue3-cookies": "^1.0.6", - "vue3-mq": "^3.2.0" + "vue3-mq": "^4.0.0" }, "devDependencies": { - "@rushstack/eslint-patch": "^1.10.4", "@vitejs/plugin-vue": "^5.1.4", "@vitest/coverage-v8": "^2.1.1", "@vue/test-utils": "^2.4.6", From 0de04451263f149305a14ba1d85e76ef0dafc182 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Mon, 30 Sep 2024 22:55:24 -0700 Subject: [PATCH 05/29] Updates stylelint cmd. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3896100..6214013 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test": "vitest --environment jsdom", "coverage": "vitest run --coverage", "eslint": "eslint 'app_name_vue/**/*.{js,vue}'", - "stylelint": "stylelint '**/*.{vue,scss}'" + "stylelint": "stylelint 'app_name_vue/**/*.{vue,scss}'" }, "repository": { "type": "git", From 2311996974f14b15dd391df13015647479ad05e5 Mon Sep 17 00:00:00 2001 From: "Craig M. Stimmel" Date: Tue, 19 Nov 2024 14:25:43 -0800 Subject: [PATCH 06/29] Allow .vite to be collected by collectstatics --- app_name/apps.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app_name/apps.py b/app_name/apps.py index c086b8b..2a931c5 100644 --- a/app_name/apps.py +++ b/app_name/apps.py @@ -2,7 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 from django.apps import AppConfig +from django.contrib.staticfiles.apps import StaticFilesConfig +class MyStaticFilesConfig(StaticFilesConfig): + ignore_patterns = ['CVS', '*~'] + class AppNameConfig(AppConfig): name = "app_name" From b71951881785dd78f408363da1ef17fe2018dd3d Mon Sep 17 00:00:00 2001 From: "Craig M. Stimmel" Date: Wed, 20 Nov 2024 13:48:23 -0800 Subject: [PATCH 07/29] This makes sure .vite gets collected. --- docker/settings.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docker/settings.py b/docker/settings.py index a0e3a3b..5926605 100644 --- a/docker/settings.py +++ b/docker/settings.py @@ -1,7 +1,13 @@ from .base_settings import * -INSTALLED_APPS += [ +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', "app_name.apps.AppNameConfig", + "app_name.apps.MyStaticFilesConfig", ] # If you have file data, define the path here From 6e7c91c31bdb322bbb4a213690213270a8cc948c Mon Sep 17 00:00:00 2001 From: "Craig M. Stimmel" Date: Wed, 20 Nov 2024 13:58:57 -0800 Subject: [PATCH 08/29] Rename custom static config --- app_name/apps.py | 2 +- docker/settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app_name/apps.py b/app_name/apps.py index 2a931c5..5a77ba6 100644 --- a/app_name/apps.py +++ b/app_name/apps.py @@ -5,7 +5,7 @@ from django.contrib.staticfiles.apps import StaticFilesConfig -class MyStaticFilesConfig(StaticFilesConfig): +class ViteStaticFilesConfig(StaticFilesConfig): ignore_patterns = ['CVS', '*~'] class AppNameConfig(AppConfig): diff --git a/docker/settings.py b/docker/settings.py index 5926605..ff34f1d 100644 --- a/docker/settings.py +++ b/docker/settings.py @@ -7,7 +7,7 @@ 'django.contrib.sessions', 'django.contrib.messages', "app_name.apps.AppNameConfig", - "app_name.apps.MyStaticFilesConfig", + "app_name.apps.ViteStaticFilesConfig", ] # If you have file data, define the path here From 0254069bde4227b42ad10e68dc10febfa14a0a47 Mon Sep 17 00:00:00 2001 From: "Craig M. Stimmel" Date: Wed, 20 Nov 2024 14:08:25 -0800 Subject: [PATCH 09/29] Return common installed apps to base container settings. --- docker/settings.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docker/settings.py b/docker/settings.py index ff34f1d..3ad3b4f 100644 --- a/docker/settings.py +++ b/docker/settings.py @@ -1,15 +1,12 @@ from .base_settings import * -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', +INSTALLED_APPS += [ "app_name.apps.AppNameConfig", "app_name.apps.ViteStaticFilesConfig", ] +INSTALLED_APPS.remove('django.contrib.staticfiles') + # If you have file data, define the path here # DATA_ROOT = os.path.join(BASE_DIR, "app_name/data") From fc5f7c30474ffd897b6538574d064ebe97307004 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Wed, 20 Nov 2024 15:43:50 -0800 Subject: [PATCH 10/29] Adds Black formatter single quote support. Updates formatting. --- .vscode/settings.json | 6 ++++-- app_name/templatetags/vite.py | 26 ++++++++++++------------ docker/settings.py | 38 +++++++++++++++++------------------ docker/urls.py | 2 +- 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b2e240c..47aaca3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,7 @@ { - "black-formatter.args": ["--line-length=79"], - "autopep8.args": ["--max-line-length=79"], + "black-formatter.args": [ + "--line-length","79", + "--skip-string-normalization","true" + ], "stylelint.validate": ["vue", "scss"] } diff --git a/app_name/templatetags/vite.py b/app_name/templatetags/vite.py index a566644..9c0c6c8 100644 --- a/app_name/templatetags/vite.py +++ b/app_name/templatetags/vite.py @@ -17,8 +17,8 @@ def vite_manifest(entries_names): # updated to support Vite 5 (.vite/manifest.json output) manifest_filepath = getattr( settings, - "VITE_MANIFEST_PATH", - os.path.join(os.sep, "static", ".vite", "manifest.json"), + 'VITE_MANIFEST_PATH', + os.path.join(os.sep, 'static', '.vite', 'manifest.json'), ) with open(manifest_filepath) as fp: @@ -36,13 +36,13 @@ def _process_entries(names): chunk = manifest[name] import_scripts, import_styles = _process_entries( - chunk.get("imports", []) + chunk.get('imports', []) ) scripts += import_scripts styles += import_styles - scripts += [chunk["file"]] - styles += [css for css in chunk.get("css", [])] + scripts += [chunk['file']] + styles += [css for css in chunk.get('css', [])] _processed.add(name) @@ -51,9 +51,9 @@ def _process_entries(names): return _process_entries(entries_names) -@register.simple_tag(name="vite_styles") +@register.simple_tag(name='vite_styles') def vite_styles(*entries_names): - """ + ''' Populate an html template with styles generated by vite Usage:: @@ -65,19 +65,19 @@ def vite_styles(*entries_names): ... {% vite_styles 'main.js' 'other-entry.js' %} - """ + ''' _, styles = vite_manifest(entries_names) styles = map(lambda href: static(href), styles) def as_link_tag(href): return f'' - return mark_safe("\n".join(map(as_link_tag, styles))) + return mark_safe('\n'.join(map(as_link_tag, styles))) -@register.simple_tag(name="vite_scripts") +@register.simple_tag(name='vite_scripts') def vite_scripts(*entries_names): - """ + ''' Populate an html template with script tags generated by vite Usage:: @@ -89,11 +89,11 @@ def vite_scripts(*entries_names): {% vite_scripts 'main.js' 'other-entry.js' %} - """ + ''' scripts, _ = vite_manifest(entries_names) scripts = map(lambda src: static(src), scripts) def as_script_tag(src): return f'' - return mark_safe("\n".join(map(as_script_tag, scripts))) + return mark_safe('\n'.join(map(as_script_tag, scripts))) diff --git a/docker/settings.py b/docker/settings.py index 3ad3b4f..9b1fea8 100644 --- a/docker/settings.py +++ b/docker/settings.py @@ -1,40 +1,40 @@ from .base_settings import * INSTALLED_APPS += [ - "app_name.apps.AppNameConfig", - "app_name.apps.ViteStaticFilesConfig", + 'app_name.apps.AppNameConfig', + 'app_name.apps.ViteStaticFilesConfig', ] INSTALLED_APPS.remove('django.contrib.staticfiles') # If you have file data, define the path here -# DATA_ROOT = os.path.join(BASE_DIR, "app_name/data") +# DATA_ROOT = os.path.join(BASE_DIR, 'app_name/data') -GOOGLE_ANALYTICS_KEY = os.getenv("GOOGLE_ANALYTICS_KEY", default=" ") +GOOGLE_ANALYTICS_KEY = os.getenv('GOOGLE_ANALYTICS_KEY', default=' ') TEMPLATES = [ { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "APP_DIRS": True, - "OPTIONS": { - "debug": True, - "context_processors": [ - "django.template.context_processors.debug", - "django.template.context_processors.request", - "django.contrib.auth.context_processors.auth", - "django.contrib.messages.context_processors.messages", - "app_name.context_processors.google_analytics", - "app_name.context_processors.django_debug", - # "app_name.context_processors.auth_user", + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'APP_DIRS': True, + 'OPTIONS': { + 'debug': True, + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + 'app_name.context_processors.google_analytics', + 'app_name.context_processors.django_debug', + # 'app_name.context_processors.auth_user', ], }, } ] -if os.getenv("ENV") == "localdev": +if os.getenv('ENV') == 'localdev': DEBUG = True VITE_MANIFEST_PATH = os.path.join( - BASE_DIR, "app_name", "static", ".vite", "manifest.json" + BASE_DIR, 'app_name', 'static', '.vite', 'manifest.json' ) else: - VITE_MANIFEST_PATH = os.path.join(os.sep, "static", ".vite", "manifest.json") + VITE_MANIFEST_PATH = os.path.join(os.sep, 'static', '.vite', 'manifest.json') diff --git a/docker/urls.py b/docker/urls.py index 5b5bac8..400f879 100644 --- a/docker/urls.py +++ b/docker/urls.py @@ -2,4 +2,4 @@ from django.conf.urls import include from django.urls import re_path -urlpatterns += [re_path(r"^", include("app_name.urls"))] +urlpatterns += [re_path(r'^', include('app_name.urls'))] From fc409d74d7bfd20f57943cc72e0e01ad28d26bd4 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Wed, 20 Nov 2024 16:05:23 -0800 Subject: [PATCH 11/29] Updates packages. --- package.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 6214013..11162ed 100644 --- a/package.json +++ b/package.json @@ -23,36 +23,36 @@ "homepage": "https://github.com/uw-it-aca/app_name#readme", "dependencies": { "@popperjs/core": "^2.11.8", - "@vueuse/core": "^11.1.0", - "@vueuse/integrations": "^11.1.0", + "@vueuse/core": "^11.2.0", + "@vueuse/integrations": "^11.2.0", "axios": "^1.7.7", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", "bootstrap-vue-next": "^0.24.23", - "pinia": "^2.2.3", + "pinia": "^2.2.6", "solstice-vue": "github:uw-it-aca/solstice-vue#1.1.0", - "vue": "^3.5.10", + "vue": "^3.5.13", "vue-gtag-next": "^1.14.0", "vue-router": "^4.4.5", "vue3-cookies": "^1.0.6", "vue3-mq": "^4.0.0" }, "devDependencies": { - "@vitejs/plugin-vue": "^5.1.4", - "@vitest/coverage-v8": "^2.1.1", + "@vitejs/plugin-vue": "^5.2.0", + "@vitest/coverage-v8": "^2.1.5", "@vue/test-utils": "^2.4.6", - "eslint": "^9.11.1", + "eslint": "^9.15.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-vue": "^9.28.0", + "eslint-plugin-vue": "^9.31.0", "jsdom": "^25.0.1", "postcss-html": "^1.7.0", "prettier": "^3.3.3", - "sass": "^1.79.4", - "stylelint": "^16.9.0", + "sass": "^1.81.0", + "stylelint": "^16.10.0", "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-standard-scss": "^13.1.0", - "vite": "^5.4.8", - "vitest": "^2.1.1" + "vite": "^5.4.11", + "vitest": "^2.1.5" } } From d0c7e18961fa1adf39cd7f4b0c50a35538ea0b8e Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 26 Nov 2024 11:52:54 -0800 Subject: [PATCH 12/29] Updates to Vite6 and adds solstice-theme. --- app_name_vue/main.js | 17 ++++++++--------- package.json | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app_name_vue/main.js b/app_name_vue/main.js index 96226f2..d82ad66 100644 --- a/app_name_vue/main.js +++ b/app_name_vue/main.js @@ -1,11 +1,9 @@ import { createApp } from "vue"; +import { createBootstrap } from "bootstrap-vue-next"; import { createPinia } from "pinia"; // import VueGtag from "vue-gtag-next"; import { Vue3Mq } from "vue3-mq"; -// import solstice-vue -//import SolsticeVue from "solstice-vue"; - import App from "@/app.vue"; import router from "@/router"; @@ -13,12 +11,13 @@ import router from "@/router"; import "bootstrap"; import "bootstrap-icons/font/bootstrap-icons.css"; -// solstice-vue (1.1.0) +// solstice bootstrap theme +import "solstice-theme/dist/solstice.scss"; + +// solstice-vue comps import "solstice-vue/dist/style.css"; -import "solstice-vue/dist/solstice.scss"; -// bootstrap-vue-next -// import "bootstrap/dist/css/bootstrap.css"; +// bootstrap-vue-next css import "bootstrap-vue-next/dist/bootstrap-vue-next.css"; const app = createApp(App); @@ -53,8 +52,8 @@ app.use(Vue3Mq, { const pinia = createPinia(); app.use(pinia); -// solstice-vue -//app.use(SolsticeVue); +// bootstrap-vue-next +app.use(createBootstrap()); // vue-router app.use(router); diff --git a/package.json b/package.json index 11162ed..c4d7b12 100644 --- a/package.json +++ b/package.json @@ -23,36 +23,37 @@ "homepage": "https://github.com/uw-it-aca/app_name#readme", "dependencies": { "@popperjs/core": "^2.11.8", - "@vueuse/core": "^11.2.0", - "@vueuse/integrations": "^11.2.0", - "axios": "^1.7.7", + "@vueuse/core": "^11.3.0", + "@vueuse/integrations": "^11.3.0", + "axios": "^1.7.8", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", - "bootstrap-vue-next": "^0.24.23", + "bootstrap-vue-next": "^0.26.5", "pinia": "^2.2.6", + "solstice-theme": "github:uw-it-aca/solstice-theme#1.0.2", "solstice-vue": "github:uw-it-aca/solstice-vue#1.1.0", "vue": "^3.5.13", "vue-gtag-next": "^1.14.0", - "vue-router": "^4.4.5", + "vue-router": "^4.5.0", "vue3-cookies": "^1.0.6", "vue3-mq": "^4.0.0" }, "devDependencies": { - "@vitejs/plugin-vue": "^5.2.0", - "@vitest/coverage-v8": "^2.1.5", + "@vitejs/plugin-vue": "^5.2.1", + "@vitest/coverage-v8": "^2.1.6", "@vue/test-utils": "^2.4.6", "eslint": "^9.15.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-vue": "^9.31.0", "jsdom": "^25.0.1", "postcss-html": "^1.7.0", - "prettier": "^3.3.3", + "prettier": "^3.4.1", "sass": "^1.81.0", "stylelint": "^16.10.0", "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-vue": "^1.5.0", "stylelint-config-standard-scss": "^13.1.0", - "vite": "^5.4.11", - "vitest": "^2.1.5" + "vite": "^6.0.0", + "vitest": "^2.1.6" } } From 018a065d9ed1ef42ae31ef6e38a09a05b81b1d25 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 26 Nov 2024 14:43:31 -0800 Subject: [PATCH 13/29] Update vite config to silence BS deprecation warnings. --- vite.config.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vite.config.js b/vite.config.js index d5fe14c..3bd9046 100644 --- a/vite.config.js +++ b/vite.config.js @@ -32,4 +32,12 @@ export default defineConfig({ "@": fileURLToPath(new URL("./app_name_vue", import.meta.url)), }, }, + css: { + preprocessorOptions: { + scss: { + quietDeps: true, + silenceDeprecations: ["global-builtin", "import"], // silence bootstrap5 related deprecations + }, + }, + }, }); From e7516b72f99dfde8ff488f74e4cf92ab492f24df Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Mon, 16 Dec 2024 21:51:10 -0800 Subject: [PATCH 14/29] Updates eslint config. --- eslint.config.js | 2 +- package.json | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 5fa4e1a..375fe22 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,5 +1,5 @@ import pluginVue from "eslint-plugin-vue"; -import eslintConfigPrettier from "eslint-config-prettier"; +import eslintConfigPrettier from "@vue/eslint-config-prettier"; export default [ // add more generic rulesets here, such as: diff --git a/package.json b/package.json index c4d7b12..409a678 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,11 @@ "@popperjs/core": "^2.11.8", "@vueuse/core": "^11.3.0", "@vueuse/integrations": "^11.3.0", - "axios": "^1.7.8", + "axios": "^1.7.9", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", - "bootstrap-vue-next": "^0.26.5", - "pinia": "^2.2.6", + "bootstrap-vue-next": "^0.26.15", + "pinia": "^2.3.0", "solstice-theme": "github:uw-it-aca/solstice-theme#1.0.2", "solstice-vue": "github:uw-it-aca/solstice-vue#1.1.0", "vue": "^3.5.13", @@ -40,20 +40,20 @@ }, "devDependencies": { "@vitejs/plugin-vue": "^5.2.1", - "@vitest/coverage-v8": "^2.1.6", + "@vitest/coverage-v8": "^2.1.8", + "@vue/eslint-config-prettier": "^10.1.0", "@vue/test-utils": "^2.4.6", - "eslint": "^9.15.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-vue": "^9.31.0", + "eslint": "^9.17.0", + "eslint-plugin-vue": "^9.32.0", "jsdom": "^25.0.1", "postcss-html": "^1.7.0", - "prettier": "^3.4.1", - "sass": "^1.81.0", - "stylelint": "^16.10.0", + "prettier": "^3.4.2", + "sass": "^1.83.0", + "stylelint": "^16.12.0", "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-vue": "^1.5.0", - "stylelint-config-standard-scss": "^13.1.0", - "vite": "^6.0.0", - "vitest": "^2.1.6" + "stylelint-config-standard-scss": "^14.0.0", + "vite": "^6.0.3", + "vitest": "^2.1.8" } } From d22aebbed13a670534adb36127995693d22db53d Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 17 Dec 2024 14:02:52 -0800 Subject: [PATCH 15/29] Updates pinia store example. --- app_name_vue/stores/hello.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app_name_vue/stores/hello.js b/app_name_vue/stores/hello.js index fcc71f7..3076765 100644 --- a/app_name_vue/stores/hello.js +++ b/app_name_vue/stores/hello.js @@ -1,8 +1,6 @@ import { defineStore } from "pinia"; -export const useHelloStore = defineStore({ - // id is required so that Pinia can connect the store to the devtools - id: "hello", +export const useHelloStore = defineStore("hello", { state: () => ({ message: "Hello world, from the Pinia store!" }), getters: {}, actions: {}, From 06c3e97545ceba568fd9a9f8ff3ced90e687ccdf Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 17 Dec 2024 14:26:42 -0800 Subject: [PATCH 16/29] Uncomment docker file. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a35dbc4..4f2607d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,12 +11,12 @@ USER acait ADD --chown=acait:acait . /app/ ADD --chown=acait:acait docker/ /app/project/ -# ADD --chown=acait:acait docker/app_start.sh /scripts -# RUN chmod u+x /scripts/app_start.sh - RUN /app/bin/pip install -r requirements.txt RUN /app/bin/pip install psycopg2 +ADD --chown=acait:acait docker/app_start.sh /scripts +RUN chmod u+x /scripts/app_start.sh + # latest node + ubuntu FROM node:20 AS node-base FROM ubuntu:22.04 AS node-bundler From 9872d26338c9f4586dd6621b0a3c8a9af2fc2e55 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 17 Dec 2024 14:38:56 -0800 Subject: [PATCH 17/29] Updates django container version. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4f2607d..098d31f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG DJANGO_CONTAINER_VERSION=2.0.1 +ARG DJANGO_CONTAINER_VERSION=2.0.2 FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-container:${DJANGO_CONTAINER_VERSION} as app-prebundler-container @@ -14,8 +14,8 @@ ADD --chown=acait:acait docker/ /app/project/ RUN /app/bin/pip install -r requirements.txt RUN /app/bin/pip install psycopg2 -ADD --chown=acait:acait docker/app_start.sh /scripts -RUN chmod u+x /scripts/app_start.sh +# ADD --chown=acait:acait docker/app_start.sh /scripts +# RUN chmod u+x /scripts/app_start.sh # latest node + ubuntu FROM node:20 AS node-base From 77f8f368be31506515725262177d40e259a20ba4 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 17 Dec 2024 14:41:47 -0800 Subject: [PATCH 18/29] Updates django-container. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 098d31f..e594052 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG DJANGO_CONTAINER_VERSION=2.0.2 +ARG DJANGO_CONTAINER_VERSION=2.0.6 FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-container:${DJANGO_CONTAINER_VERSION} as app-prebundler-container From 8a09826e28a37b3d70f6b2b1da0cd8bac91d6f12 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 17 Dec 2024 14:54:46 -0800 Subject: [PATCH 19/29] Allow pycodestyle to run. --- docker/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/test.sh b/docker/test.sh index 88e9ff0..a6b411a 100644 --- a/docker/test.sh +++ b/docker/test.sh @@ -14,7 +14,7 @@ function run_test { } # Moving to github action - remove this when successful -#run_test "pycodestyle ${DJANGO_APP}/ --exclude=migrations,static" +run_test "pycodestyle ${DJANGO_APP}/ --exclude=migrations,static" # #if [ -d ${DJANGO_APP}/static/${DJANGO_APP}/js ]; then # run_test "jshint ${DJANGO_APP}/static/${DJANGO_APP}/js --verbose" From 6e423f936a0a71b304682cfacee48d32f7541ed4 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 17 Dec 2024 15:02:00 -0800 Subject: [PATCH 20/29] Updates dockerfile. --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index e594052..7634ab1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-container:${DJANGO_CONTAI USER root -RUN apt-get update && apt-get install -y libpq-dev +RUN apt-get update && apt-get install libpq-dev -y USER acait @@ -18,8 +18,8 @@ RUN /app/bin/pip install psycopg2 # RUN chmod u+x /scripts/app_start.sh # latest node + ubuntu -FROM node:20 AS node-base -FROM ubuntu:22.04 AS node-bundler +FROM node:lts AS node-base +FROM ubuntu:latest AS node-bundler COPY --from=node-base / / ADD ./package.json /app/ @@ -36,7 +36,7 @@ FROM app-prebundler-container as app-container COPY --chown=acait:acait --from=node-bundler /app/app_name/static /app/app_name/static -RUN /app/bin/python manage.py collectstatic --noinput +RUN . /app/bin/activate && python manage.py collectstatic --noinput FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-container:${DJANGO_CONTAINER_VERSION} as app-test-container From 13b82cbddcf4a5bf359784eccdc559eae03a7828 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 17 Dec 2024 15:06:53 -0800 Subject: [PATCH 21/29] Comment out pycodestyle. --- docker/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/test.sh b/docker/test.sh index a6b411a..578ab34 100644 --- a/docker/test.sh +++ b/docker/test.sh @@ -14,7 +14,7 @@ function run_test { } # Moving to github action - remove this when successful -run_test "pycodestyle ${DJANGO_APP}/ --exclude=migrations,static" +# run_test "pycodestyle ${DJANGO_APP}/ --exclude=migrations,static" # #if [ -d ${DJANGO_APP}/static/${DJANGO_APP}/js ]; then # run_test "jshint ${DJANGO_APP}/static/${DJANGO_APP}/js --verbose" From fb4b77c078dcbd93c29e73a58d404a64374a2f80 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Tue, 17 Dec 2024 17:47:54 -0800 Subject: [PATCH 22/29] Update action versions. --- .github/workflows/cicd.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index c047486..a7062a6 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -67,10 +67,10 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' @@ -81,10 +81,10 @@ jobs: exclude_paths: 'migrations' - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Cache Docker layers - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-$(echo ${{ hashFiles('Dockerfile') }} | head -c 16) @@ -92,7 +92,7 @@ jobs: ${{ runner.os }}-buildx- - name: Build App Image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v6 with: context: . target: app-container @@ -103,7 +103,7 @@ jobs: cache-to: type=local,dest=/tmp/.buildx-cache - name: Build Test Image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v6 with: target: app-test-container tags: app-test-container From d93832622d1350f21bc17ca722c0575762022e60 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Wed, 18 Dec 2024 08:07:29 -0800 Subject: [PATCH 23/29] Updates release name. --- .github/workflows/cicd.yml | 2 +- Dockerfile | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index a7062a6..db6622e 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -32,7 +32,7 @@ name: Build, Test and Deploy env: - RELEASE_NAME: app_name + RELEASE_NAME: django-vue DJANGO_APP: app_name # Be sure that branches defined here have corresponding steps diff --git a/Dockerfile b/Dockerfile index 7634ab1..f662121 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,12 +11,12 @@ USER acait ADD --chown=acait:acait . /app/ ADD --chown=acait:acait docker/ /app/project/ +ADD --chown=acait:acait docker/app_start.sh /scripts +RUN chmod u+x /scripts/app_start.sh + RUN /app/bin/pip install -r requirements.txt RUN /app/bin/pip install psycopg2 -# ADD --chown=acait:acait docker/app_start.sh /scripts -# RUN chmod u+x /scripts/app_start.sh - # latest node + ubuntu FROM node:lts AS node-base FROM ubuntu:latest AS node-bundler @@ -36,7 +36,7 @@ FROM app-prebundler-container as app-container COPY --chown=acait:acait --from=node-bundler /app/app_name/static /app/app_name/static -RUN . /app/bin/activate && python manage.py collectstatic --noinput +RUN /app/bin/python manage.py collectstatic --noinput FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-container:${DJANGO_CONTAINER_VERSION} as app-test-container From 08298592ac3c81c1d2cdd888eccf3cc7c194a151 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Wed, 18 Dec 2024 08:20:28 -0800 Subject: [PATCH 24/29] Install coverage in virtualenv. --- .github/workflows/cicd.yml | 4 ++-- docker/test.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index db6622e..a08a2e3 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -72,13 +72,13 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.10" - name: Run Python Linters uses: uw-it-aca/actions/python-linters@main with: app_name: ${DJANGO_APP} - exclude_paths: 'migrations' + exclude_paths: "migrations" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/docker/test.sh b/docker/test.sh index 578ab34..169475e 100644 --- a/docker/test.sh +++ b/docker/test.sh @@ -7,6 +7,9 @@ trap 'exit 1' ERR # start virtualenv source bin/activate +# force install coverage in virtualenv +pip install coverage + function run_test { echo "##########################" echo "TEST: $1" From f24537fe8c94842c21149f2a12290981cc8ca2c0 Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Wed, 18 Dec 2024 08:42:42 -0800 Subject: [PATCH 25/29] Updates app start script. --- docker/app_start.sh | 2 +- docker/test.sh | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/docker/app_start.sh b/docker/app_start.sh index 7a11421..11aa0da 100644 --- a/docker/app_start.sh +++ b/docker/app_start.sh @@ -1,6 +1,6 @@ if [ "$ENV" = "localdev" ] then - . /scripts/app_deploy.sh + python manage.py migrate fi diff --git a/docker/test.sh b/docker/test.sh index 169475e..578ab34 100644 --- a/docker/test.sh +++ b/docker/test.sh @@ -7,9 +7,6 @@ trap 'exit 1' ERR # start virtualenv source bin/activate -# force install coverage in virtualenv -pip install coverage - function run_test { echo "##########################" echo "TEST: $1" From bbe557820af48a26ed12488aaf3aa2b21cfdd16a Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Wed, 18 Dec 2024 08:49:48 -0800 Subject: [PATCH 26/29] Updates node and ubuntu images. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f662121..db59cdf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,8 +18,8 @@ RUN /app/bin/pip install -r requirements.txt RUN /app/bin/pip install psycopg2 # latest node + ubuntu -FROM node:lts AS node-base -FROM ubuntu:latest AS node-bundler +FROM node:20 AS node-base +FROM ubuntu:22.04 AS node-bundler COPY --from=node-base / / ADD ./package.json /app/ From b639026a8de7e0270d9bf8ff4b2791c17f2f2e1f Mon Sep 17 00:00:00 2001 From: Charlon Palacay Date: Wed, 18 Dec 2024 09:11:55 -0800 Subject: [PATCH 27/29] Actually use django-test-container. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index db59cdf..b65ca63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ COPY --chown=acait:acait --from=node-bundler /app/app_name/static /app/app_name/ RUN /app/bin/python manage.py collectstatic --noinput -FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-container:${DJANGO_CONTAINER_VERSION} as app-test-container +FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-test-container:${DJANGO_CONTAINER_VERSION} AS app-test-container ENV NODE_PATH=/app/lib/node_modules COPY --from=app-container /app/ /app/ From 5ea015bfc59918a2250d8c56b568c108658bb304 Mon Sep 17 00:00:00 2001 From: Jim Laney Date: Tue, 11 Feb 2025 14:22:23 -0800 Subject: [PATCH 28/29] update copyright --- app_name/apps.py | 2 +- app_name/context_processors.py | 2 +- app_name/models.py | 2 +- app_name/templatetags/vite.py | 2 +- app_name/tests/test_example.py | 2 +- app_name/tests/test_templatetags.py | 2 +- app_name/urls.py | 2 +- app_name/views/pages.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app_name/apps.py b/app_name/apps.py index 5a77ba6..ed6c2a7 100644 --- a/app_name/apps.py +++ b/app_name/apps.py @@ -1,4 +1,4 @@ -# Copyright 2024 UW-IT, University of Washington +# Copyright 2025 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.apps import AppConfig diff --git a/app_name/context_processors.py b/app_name/context_processors.py index 6489434..e9b12bd 100644 --- a/app_name/context_processors.py +++ b/app_name/context_processors.py @@ -1,4 +1,4 @@ -# Copyright 2024 UW-IT, University of Washington +# Copyright 2025 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.conf import settings diff --git a/app_name/models.py b/app_name/models.py index 844d86e..59cb68a 100644 --- a/app_name/models.py +++ b/app_name/models.py @@ -1,4 +1,4 @@ -# Copyright 2024 UW-IT, University of Washington +# Copyright 2025 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.db import models diff --git a/app_name/templatetags/vite.py b/app_name/templatetags/vite.py index 9c0c6c8..2b6e266 100644 --- a/app_name/templatetags/vite.py +++ b/app_name/templatetags/vite.py @@ -1,4 +1,4 @@ -# Copyright 2024 UW-IT, University of Washington +# Copyright 2025 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 import os diff --git a/app_name/tests/test_example.py b/app_name/tests/test_example.py index c11f7c2..6c2802a 100644 --- a/app_name/tests/test_example.py +++ b/app_name/tests/test_example.py @@ -1,4 +1,4 @@ -# Copyright 2024 UW-IT, University of Washington +# Copyright 2025 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.test import TestCase diff --git a/app_name/tests/test_templatetags.py b/app_name/tests/test_templatetags.py index 9086bb4..04dfe30 100644 --- a/app_name/tests/test_templatetags.py +++ b/app_name/tests/test_templatetags.py @@ -1,4 +1,4 @@ -# Copyright 2024 UW-IT, University of Washington +# Copyright 2025 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 import re diff --git a/app_name/urls.py b/app_name/urls.py index 1a617b0..a1a39d2 100644 --- a/app_name/urls.py +++ b/app_name/urls.py @@ -1,4 +1,4 @@ -# Copyright 2024 UW-IT, University of Washington +# Copyright 2025 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.conf import settings diff --git a/app_name/views/pages.py b/app_name/views/pages.py index f9f1624..98e5387 100644 --- a/app_name/views/pages.py +++ b/app_name/views/pages.py @@ -1,4 +1,4 @@ -# Copyright 2024 UW-IT, University of Washington +# Copyright 2025 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.views.generic import TemplateView From ca769588e4a3966ebf663632693e6035a06ef086 Mon Sep 17 00:00:00 2001 From: Jim Laney Date: Tue, 11 Feb 2025 14:23:18 -0800 Subject: [PATCH 29/29] fix build badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index deadb06..ecf1c5a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # app_name -[![Build Status](https://github.com/uw-it-aca/django-vue/workflows/Build%2C%20Test%20and%20Deploy/badge.svg?branch=main)](https://github.com/uw-it-aca/django-vue/actions) +[![Build Status](https://github.com/uw-it-aca/django-vue/workflows/Build%2C%20Test%20and%20Deploy/badge.svg)](https://github.com/uw-it-aca/django-vue/actions) [![Coverage Status](https://coveralls.io/repos/github/uw-it-aca/django-vue/badge.svg?branch=main)](https://coveralls.io/github/uw-it-aca/django-vue?branch=main) This is a template repository used for creating Django-Vue applications. Use this template to create a new project repository.