Skip to content

Commit

Permalink
Merge branch 'main' into docs
Browse files Browse the repository at this point in the history
* main:
  πŸ‘Š Version bump v0.4.0
  🐩 Upgrade Wagtail (#98)
  πŸ”„ Sync labels
  🏷 Labels (#100)
  πŸ›‘ GGShield (#96)
  πŸ’» CLI (#83)
  🧫 Pytest (#97)
  πŸ‘– Lint (#94)
  ⬛ Black (#93)
  πŸ•Έ VSCode Debugger (#85)
  🎬 Workflow Actions (#76)
  • Loading branch information
mrharpo committed Nov 14, 2023
2 parents ec6721b + 27ec908 commit 5018ff3
Show file tree
Hide file tree
Showing 61 changed files with 1,802 additions and 553 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OV_DB_ENGINE=django.db.backends.postgresql
OV_DB_HOST=0.0.0.0
OV_DB_PORT=5432
OV_DB_NAME=postgres
OV_DB_USER=postgres
OV_DB_PASSWORD=""
25 changes: 17 additions & 8 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@ changelog:
categories:
- title: Breaking Changes πŸͺ…
labels:
- 'breaking πŸ’”'
- breaking πŸ’”

- title: New Features πŸŽ‰
labels:
- 'enhancement βž•'
- enhancement βž•

- title: 'Bugfixes πŸ›'
- title: Bugfixes πŸ›
labels:
- 'bug πŸ›'
- bug πŸ›

- title: 'Maintenance πŸ”©'
- title: Deployment πŸš€
labels:
- 'maintenance πŸ”§'
- 'CI 🦾'
- 'CD πŸ—οΈ'
- production 🎭
- dev πŸ’»

- title: Maintenance πŸ”©
labels:
- maintenance πŸ”§
- CI 🦾
- CD πŸ—οΈ

- title: Documentation πŸ“š
labels:
- documentation πŸ“œ

- title: Other Changes
labels:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: πŸͺ‚ Deploy

on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [published, edited, prereleased]
workflow_dispatch:

jobs:
build:
name: πŸ”¨ Build and deploy docker image
uses: WGBH-MLA/.github/.github/workflows/build.yml@main
with:
target: production
20 changes: 20 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: πŸ§ͺ Integration Tests

on: [push, pull_request, workflow_dispatch]

jobs:
tests:
name: βš—οΈ App Tests
uses: WGBH-MLA/.github/.github/workflows/pytest-with-postgres.yml@main
secrets: inherit
with:
pdm_args: -G test
pytest_args: -n auto --nbmake -ra -s
pg_db: ov
lint:
name: πŸ‘• Lint
uses: WGBH-MLA/.github/.github/workflows/lint.yml@main

black:
name: πŸ–€ Black
uses: WGBH-MLA/.github/.github/workflows/black.yml@main
17 changes: 0 additions & 17 deletions .github/workflows/ci.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/draft-release.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 🏷 Sync labels
on:
workflow_dispatch:

permissions:
issues: write

jobs:
labels:
name: πŸ”„ Sync labels
uses: WGBH-MLA/.github/.github/workflows/labels.yml@main

46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: πŸ› Publish to PyPi
on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
build:
name: πŸ“¦ Build package
runs-on: ubuntu-latest
steps:
- name: πŸ“° Checkout
uses: actions/checkout@v3

- name: πŸ“² Setup PDM
uses: pdm-project/setup-pdm@v3
id: setup-python
with:
python-version: 3.x

- name: 🚚 Install dependencies
run: pdm install --prod

- name: πŸ—οΈ Build package
run: pdm build

- name: πŸ›« Export build files
uses: actions/upload-artifact@v3
with:
name: dist
path: dist

publish:
name: πŸ—ž Publish package
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: πŸ›¬ Download artifacts
uses: actions/download-artifact@v3

- name: πŸ—ž Publish package
uses: pypa/gh-action-pypi-publish@release/v1
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: πŸ“¦ Release

on:
milestone:
types: [closed]
workflow_dispatch:

jobs:
release:
name: πŸ“ Draft Release
uses: WGBH-MLA/.github/.github/workflows/draft_release.yml@main
24 changes: 0 additions & 24 deletions .github/workflows/test-coverage.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: πŸ› Update dependencies
# On Wednesdays, we update our dependencies.

on:
schedule:
- cron: 0 12 * * 3
workflow_dispatch:

jobs:
update:
name: 🦿 Update dependencies
uses: WGBH-MLA/.github/.github/workflows/update.yml@main
14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
__pycache__
*.pyc
.DS_Store
/venv/

# Database
db/
# Virtual environment
.venv

# Environment files
# Environment variable files
.env
.db
!.env.example

# VS Code
.vscode/
!.vscode/settings.json
!.vscode/launch.json
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/gitguardian/ggshield
rev: v1.20.0
hooks:
- id: ggshield
language_version: python3
stages: [commit]
64 changes: 64 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"inputs": [
{
"id": "numWorkers",
"type": "promptString",
"default": "4",
"description": "Number of Gunicorn workers to run"
}
],
"configurations": [
{
"name": "OV Wagtail - Django dev server",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"0.0.0.0:8000"
],
"django": true,
"justMyCode": false
},
{
"name": "OV Wagtail - Gunicorn",
"type": "python",
"request": "launch",
"program": "gunicorn",
"args": [
"-w ${input:numWorkers}",
"-b 0.0.0.0:4000",
"ov-wag.wsgi:applications",
],
"django": true,
"justMyCode": false
},
{
"name": "Run Migrations",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"migrate",
"--noinput"
],
"django": true,
"justMyCode": false
},
{
"name": "Run Tests",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"test",
],
"django": true,
"justMyCode": false
},
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"-v",
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false
}
33 changes: 20 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Use an official Python runtime based on Debian 10 "buster" as a parent image.
FROM python:3.10-slim-buster as base
FROM python:3.11-slim as base

WORKDIR /app
COPY docker_entrypoints /docker_entrypoints

# Install system packages required by Wagtail and Django.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
Expand All @@ -8,19 +11,25 @@ RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-r
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev \
&& rm -rf /var/lib/apt/lists/*

# Install the project requirements.
COPY requirements.txt /
RUN pip install -r /requirements.txt
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY pyproject.toml pdm.lock README.md ./
COPY ov_wag ov_wag
COPY authors authors
COPY exhibits exhibits
COPY ov_collections ov_collections
COPY search search

### Test ###
# Build the test image, which includes the test applications
FROM base as test
COPY requirements-test.txt /
RUN pip install -r /requirements-test.txt
# Install the test requirements.
RUN pip install pdm
RUN pdm install -dG test

ENTRYPOINT /docker_entrypoints/test.sh

### Production ###
# Build the production image, with the application server
FROM base as production

Expand All @@ -37,8 +46,6 @@ ENV PYTHONUNBUFFERED=1 \
EXPOSE 80

# Install the application server.
RUN pip install "gunicorn>=20.1.0,<20.2.0"

COPY . .
RUN pip install .[production]

ENTRYPOINT /app/docker_entrypoints/deploy.sh
ENTRYPOINT /docker_entrypoints/deploy.sh
Loading

0 comments on commit 5018ff3

Please sign in to comment.