Skip to content

Commit

Permalink
🎬 Workflow Actions (#76)
Browse files Browse the repository at this point in the history
* Adds actions from Chowda

* Splits wagtail-tests

* Uses docker volume, upgrades to postgres16

* Adds documentation on image tag usage

* Renames ci.yml to CI.yml

* Renames test db in Actions
  • Loading branch information
mrharpo authored Nov 3, 2023
1 parent 57a87ae commit 6985044
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 42 deletions.
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
21 changes: 21 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 🧪 Integration Tests

on: [push, pull_request, workflow_dispatch]

jobs:
tests:
name: ⚗️ Application Tests
uses: WGBH-MLA/.github/.github/workflows/pytest-with-postgres.yml@main
secrets: inherit
with:
pdm_args: -G test,ci
pytest_args: -n auto --nbmake -ra -s
pg_db: ov-test

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.

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
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
1 change: 0 additions & 1 deletion dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ services:
- db
environment:
OV_DB_HOST: db
# OV_DB_PASSWORD:
env_file:
- .env
db:
Expand Down
24 changes: 8 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ services:
build:
context: .
target: base
image: ov-wag
# Use the `image` property to run a prebuilt image from GHCR instead of building locally. Requires disabling the `build` section above.
# image: ghcr.io/wgbh-mla/ov-wag:main
volumes:
- ./:/app/
entrypoint: /app/docker_entrypoints/dev.sh
Expand All @@ -15,20 +16,11 @@ services:
delay: 5s
max_attempts: 3
window: 5s
wagtail-tests:
build:
context: .
target: test
image: ov-tests
volumes:
- ./:/app/
entrypoint: /app/docker_entrypoints/test.sh
environment:
- OV_DB_ENGINE=django.db.backends.sqlite3
- OV_DB_NAME=testdb
db:
image: postgres:14.2-alpine
volumes:
- ./db:/var/lib/postgresql/data:Z
user: ${UID}:${GID}
image: postgres:16-alpine
restart: always
volumes:
- db:/var/lib/postgresql/data

volumes:
db:
16 changes: 8 additions & 8 deletions ov
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ USAGE:\n\n
COMMANDS:\n\n
\t b | build \t build the docker image\n
\t c | cmd \t run a bash command with the wagtail docker image\n
\t coverage \t run the coverage tests
\t d | dev \t start a development server\n
\t h | help \t prints this help text\n
\t s | shell \t enter into a python shell with the app context\n
\t t | test \t run the wagtail test suite
\t m | manage \t run a manage.py command
\t b | build \t build the docker image\n
\t c | cmd \t run a bash command with the wagtail docker image\n
\t cov | coverage\t run the coverage tests\n
\t d | dev \t start a development server\n
\t h | help \t prints this help text\n
\t s | shell \t enter into a python shell with the app context\n
\t t | test \t run the wagtail test suite\n
\t m | manage \t run a manage.py command\n\n
"

COMPOSE="docker compose -f docker-compose.yml"
Expand Down
14 changes: 14 additions & 0 deletions test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.8'

services:
tests:
build:
context: .
target: test
image: ov-tests
volumes:
- ./:/app/
entrypoint: /app/docker_entrypoints/test.sh
environment:
- OV_DB_ENGINE=django.db.backends.sqlite3
- OV_DB_NAME=testdb

0 comments on commit 6985044

Please sign in to comment.