Skip to content

Commit

Permalink
Merge branch 'release/3.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
thatbudakguy committed Mar 30, 2021
2 parents 7b5bbb3 + 74e26a2 commit 74cc6f3
Show file tree
Hide file tree
Showing 264 changed files with 16,679 additions and 8,908 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = conftest.py
56 changes: 56 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "CodeQL"

on:
push:
branches: [ main, develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, develop ]
schedule:
- cron: '16 20 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
44 changes: 16 additions & 28 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ env:
DB_NAME: cdhweb
DB_USER: cdhweb
DB_PASSWORD: cdhweb
DJANGO_DB_BACKEND: postgresql

jobs:
python-unit:
name: Python unit tests
runs-on: ubuntu-latest
strategy:
matrix:
backend: [postgresql, mysql]
# We use service containers to avoid needing to set up a local copy of
# mysql or postgres on the test runner instance. This syntax is similar to
# the spec of a docker-compose file. For more, see:
Expand All @@ -32,24 +30,10 @@ jobs:
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
ports:
- 5432:5432
mysql:
image: mysql:5.6
env:
MYSQL_DATABASE: ${{ env.DB_NAME }}
MYSQL_USER: ${{ env.DB_USER }}
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }}
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASSWORD }}
ports:
- 3306:3306
steps:
# Set the value of DJANGO_DB_BACKEND which is used in ci/testsettings.py to
# configure django's ORM based on whether we're testing postgres or mysql
- name: Set django database backend adapter
env:
BACKEND: ${{ matrix.backend }}
run: echo "DJANGO_DB_BACKEND=$(echo "$BACKEND")" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v2

# We need node to install the JS dependencies used to build static assets.
# Because some unit tests use Django's test client to visit pages, we need
# to have JS and styles ready to be loaded on those pages or there will be
Expand All @@ -58,6 +42,7 @@ jobs:
uses: actions/setup-node@v2-beta
with:
node-version: ${{ env.NODE_VERSION }}

# Basing the cache on the hash of the lockfile means that the cache should
# only ever be invalidated when we update package-lock.json, which happens
# as part of a release. For more info, see:
Expand All @@ -70,8 +55,10 @@ jobs:
restore-keys: |
npm-${{ hashFiles('package-lock.json') }}
npm-
- name: Install JS dependencies
run: npm ci

# Python version to use is stored in the .python-version file, which is the
# convention for pyenv: https://github.com/pyenv/pyenv
- name: Get Python version
Expand All @@ -80,6 +67,7 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

# We base the python cache on the hash of all requirements files, so that
# if any change, the cache is invalidated.
- name: Cache pip
Expand All @@ -90,32 +78,32 @@ jobs:
restore-keys: |
pip-${{ hashFiles('requirements/*.txt') }}
pip-
- name: Install dependencies
run: pip install -r requirements/test.txt
# For mysql only, grant permission to the DB_USER to create databases so
# that it doesn't fail trying to create the django test database
- name: Grant permissions to mysql user
if: matrix.backend == 'mysql'
env:
GRANT_CMD: "grant all privileges on *.* to '${{ env.DB_USER }}'@'%';"
run: echo "$GRANT_CMD" | mysql -h 127.0.0.1 --user=root --password="$DB_PASSWORD"

- name: Setup local_settings.py
run: |
cp ci/testsettings.py cdhweb/local_settings.py
python -c "import uuid; print('SECRET_KEY = \'%s\'' % uuid.uuid4())" >> cdhweb/local_settings.py
- name: Build static assets
run: python manage.py compress

- name: Run pytest
run: py.test --cov=./ --cov-report=xml
run: py.test --cov=./ --cov-config=.coveragerc --cov-report=xml

- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v1

# Set the color of the slack message used in the next step based on the
# status of the build: "warning" for failure and "good" for success
- name: Set Slack message color based on build status
if: ${{ always() }}
env:
JOB_STATUS: ${{ job.status }}
run: echo "SLACK_COLOR=$(if [ "$JOB_STATUS" == "success" ]; then echo "good"; else echo "warning"; fi)" >> $GITHUB_ENV

# Send a message to slack to report the build status. The webhook is stored
# at the organization level and available to all repositories. Only run on
# scheduled builds & pushes, since PRs automatically report to Slack.
Expand All @@ -126,7 +114,7 @@ jobs:
env:
SLACK_COLOR: ${{ env.SLACK_COLOR }}
SLACK_WEBHOOK: ${{ secrets.ACTIONS_SLACK_WEBHOOK }}
SLACK_TITLE: "Run #${{ github.run_number }} for workflow `${{ github.workflow }} (${{ matrix.backend }})`: ${{ job.status }}"
SLACK_MESSAGE: "<https://github.com/${{ github.repository }}/|${{ github.repository }}@${{ github.ref }}>"
SLACK_TITLE: "Workflow `${{ github.workflow }}`: ${{ job.status }}"
SLACK_MESSAGE: "Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|#${{ github.run_number }}> on <https://github.com/${{ github.repository }}/|${{ github.repository }}@${{ github.ref }}>"
SLACK_FOOTER: "<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|View commit>"
MSG_MINIMAL: true # use compact slack message format
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# local ignores
local_settings.py
db.sqlite3
cdhweb.dbml

# Media ignores
static
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.10
3.6.12
34 changes: 34 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
CHANGELOG
=========

3.0
---

* As a moderator, I want to create and edit events in wagtail so that I can manage them just like other pages.
* As a moderator, I want to create and edit people in wagtail so that I can manage them just like pages.
* As an editor, I want to create and edit blog posts in wagtail so that I can take advantage of its editing capabilities.
* As an editor, I want upload and manage page attachments in wagtail so that I can associate them with pages.
* As an editor, I want existing attachments migrated to wagtail so that I can manage them in the new system.
* As a moderator, I want existing content pages migrated from mezzanine to wagtail so that I can manage them in the new system.
* As a moderator, I want existing uploaded images migrated to wagtail so that I can manage them in the new system.
* As a moderator, I want existing related links migrated to wagtail so that I can manage them in the new system.
* As an editor, I want existing blog posts migrated to wagtail so that I can manage them in the new system.
* As a moderator, I want existing projects migrated to wagtail so that I can manage them in the new system.
* As a moderator, I want existing events migrated to wagtail so that I can manage them in the new system.
* As a moderator, I want existing people migrated to wagtail so that I can manage them in the new system.
* As a moderator, I want People automatically organized into person list pages so I don't have to manually manage these pages.
* As a moderator, I want Projects automatically organized into list pages so I don't have to manually manage these pages.
* As a moderator, I want Events automatically organized by upcoming events and by semester, so that I don't have to manually manage these list pages.
* As a moderator, I want blog posts automatically listed by latest posts, by month, and by year so that I don't have to manually manage these pages.
* As a search engine, I want a sitemap of all pages on the CDH site so that I can index them for users to search.
* As an editor, I want to manage the menus displayed across the site in wagtail so that I can easily update them when needed.
* As an admin, I want to see the edit history for a page, including edits before the wagtail migration, so that I can see the history of edits to a page.
* chore: add apache rewrite rule to ansible for migrated media
* chore: Include DB diagrams in documentation
* chore: remove inactive user accounts
* chore: clean image EXIF metadata
* bugfix: superuser permissions required for editing content due to mezzanine site permissions
* bugfix: meta information for project pages is incorrect
* bugfix: Some past student profiles are displaying twice
* bugfix: slug logic doesn't ensure uniqueness
* bugfix: 500 error when trying to view admin blog post list if not superuser
* bugfix: working groups display on main project page


2.8.1
-----

Expand Down
6 changes: 6 additions & 0 deletions DEPLOYNOTES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Deploy Notes
============

3.0
---

- After deployment, the main exodus script should be run to move content from
mezzanine to wagtail with `python manage.py exodus`.

2.8.1
-----

Expand Down
12 changes: 9 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ CDH Website
:alt: dbdocs build

Python 3.6 / Django 2.2 / Node 10 / PostgreSQL 10

`cdhweb` is a Django+Mezzanine application that powers the CDH website
with custom models for people, events, and projects.

Expand All @@ -37,9 +36,9 @@ Development instructions

Initial setup and installation:

- Recommended: create and activate a python 3.5 virtualenv::
- Recommended: create and activate a python 3.6 virtualenv::

virtualenv cdhweb -p python3.5
virtualenv cdhweb -p python3.6
source cdhweb/bin/activate

- Use pip to install required python dependencies. To install production
Expand Down Expand Up @@ -78,6 +77,8 @@ Remember to add a ``SECRET_KEY`` setting!
See `MariaDB <https://mariadb.com/kb/en/library/mysql_tzinfo_to_sql/>`_'s
info on the utility for more information.

- Install OpenCV dependencies (if necessary) for [wagtail image feature detection](https://docs.wagtail.io/en/stable/advanced_topics/images/feature_detection.html)

Unit Testing
------------

Expand Down Expand Up @@ -109,6 +110,11 @@ directory::
When building documentation for a production release, use `make docs` to
update the published documentation on GitHub Pages.

On every commit, GitHub Actions will generate and then publish a database diagram to `dbdocs @ princetoncdh/cdh-web <https://dbdocs.io/princetoncdh/cdh-web>`_. But to generate locally, install and log into dbdocs. Then run::

python manage.py dbml > cdhweb.dbml
npx dbdocs build cdhweb.dbml --project cdhweb

License
-------
This project is licensed under the `Apache 2.0 License <https://github.com/Princeton-CDH/cdh-web/blob/main/LICENSE>`_.
Expand Down
2 changes: 1 addition & 1 deletion cdhweb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version_info__ = (2, 8, 1, None)
__version_info__ = (3, 0, 0, None)


# Dot-connect all but the last. Last is dash-connected if not None.
Expand Down
64 changes: 0 additions & 64 deletions cdhweb/blog/admin.py

This file was deleted.

Loading

0 comments on commit 74cc6f3

Please sign in to comment.