Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #71

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
682b798
Add example github action
abztrakt May 22, 2024
ad00cc6
Remove linters from test.sh, relying just on the step in cicd
abztrakt May 22, 2024
b4a4c33
Updates eslint and prettier configs.
charlon Oct 1, 2024
82a8e1e
Remove unused packages.
charlon Oct 1, 2024
0de0445
Updates stylelint cmd.
charlon Oct 1, 2024
2311996
Allow .vite to be collected by collectstatics
abztrakt Nov 19, 2024
b719518
This makes sure .vite gets collected.
abztrakt Nov 20, 2024
6e7c91c
Rename custom static config
abztrakt Nov 20, 2024
0254069
Return common installed apps to base container settings.
abztrakt Nov 20, 2024
fc5f7c3
Adds Black formatter single quote support. Updates formatting.
charlon Nov 20, 2024
315c67c
Merge pull request #64 from uw-it-aca/vite5v2
charlon Nov 20, 2024
eab9849
Merge branch 'develop' into char/version-updates
charlon Nov 20, 2024
fc409d7
Updates packages.
charlon Nov 21, 2024
d0c7e18
Updates to Vite6 and adds solstice-theme.
charlon Nov 26, 2024
1b32394
Merge pull request #65 from uw-it-aca/char/vite6
abztrakt Nov 26, 2024
018a065
Update vite config to silence BS deprecation warnings.
charlon Nov 26, 2024
5ee00c6
Merge pull request #66 from uw-it-aca/char/fix-dep-warns
charlon Nov 27, 2024
e7516b7
Updates eslint config.
charlon Dec 17, 2024
d22aebb
Updates pinia store example.
charlon Dec 17, 2024
06c3e97
Uncomment docker file.
charlon Dec 17, 2024
9872d26
Updates django container version.
charlon Dec 17, 2024
77f8f36
Updates django-container.
charlon Dec 17, 2024
8a09826
Allow pycodestyle to run.
charlon Dec 17, 2024
6e423f9
Updates dockerfile.
charlon Dec 17, 2024
13b82cb
Comment out pycodestyle.
charlon Dec 17, 2024
fb4b77c
Update action versions.
charlon Dec 18, 2024
d938326
Updates release name.
charlon Dec 18, 2024
0829859
Install coverage in virtualenv.
charlon Dec 18, 2024
f24537f
Updates app start script.
charlon Dec 18, 2024
bbe5578
Updates node and ubuntu images.
charlon Dec 18, 2024
b639026
Actually use django-test-container.
charlon Dec 18, 2024
5521882
Merge pull request #69 from uw-it-aca/char/update-pkgs
charlon Jan 10, 2025
93d3f85
Merge pull request #70 from uw-it-aca/char/testing
charlon Jan 24, 2025
5ea015b
update copyright
jlaney Feb 11, 2025
ca76958
fix build badge
jlaney Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .eslintrc.cjs

This file was deleted.

194 changes: 194 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -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: django-vue
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@v4

- name: Set up Python
uses: actions/setup-python@v5
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@v3

- name: Cache Docker layers
uses: actions/cache@v4
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@v6
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@v6
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 }}
2 changes: 0 additions & 2 deletions .stylelintignore

This file was deleted.

8 changes: 1 addition & 7 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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"]
}
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
ARG DJANGO_CONTAINER_VERSION=2.0.1
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

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

USER root

RUN apt-get update && apt-get install -y libpq-dev
RUN apt-get update && apt-get install libpq-dev -y

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
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
Expand All @@ -32,13 +32,13 @@
ENV VUE_DEVTOOLS=$VUE_DEVTOOLS
RUN npm run build

FROM app-prebundler-container as app-container

Check warning on line 35 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 35 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 35 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 35 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

COPY --chown=acait:acait --from=node-bundler /app/app_name/static /app/app_name/static

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/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 5 additions & 1 deletion app_name/apps.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# 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
from django.contrib.staticfiles.apps import StaticFilesConfig


class ViteStaticFilesConfig(StaticFilesConfig):
ignore_patterns = ['CVS', '*~']

class AppNameConfig(AppConfig):
name = "app_name"
2 changes: 1 addition & 1 deletion app_name/context_processors.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion app_name/models.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion app_name/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body {% if google_analytics %}data-google-analytics="{{ google_analytics }}"{% endif %}
{% if logout_url %}data-logout-url="{{ logout_url }}"{% endif %}
data-django-debug="{{ django_debug|lower }}"
class="bg-light">
class="bg-body">
{% csrf_token %}
<!-- vue app will be injected here -->
<div id="app"></div>
Expand Down
Loading
Loading