diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 0000000..98e69dd --- /dev/null +++ b/.github/workflows/CD.yml @@ -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 diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..c7f8fa7 --- /dev/null +++ b/.github/workflows/CI.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index b646ae4..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: ๐Ÿงช CI Tests - -on: - push: - branches: - - master - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: ๐Ÿ“ฐ Checkout - uses: actions/checkout@v3 - - - name: โ˜‘๏ธ Run Tests - run: ./ov test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..56876a5 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c2596db --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..51895df --- /dev/null +++ b/.github/workflows/update.yml @@ -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 diff --git a/dev.yml b/dev.yml index bd7e68a..c43eb32 100644 --- a/dev.yml +++ b/dev.yml @@ -8,9 +8,8 @@ services: - db environment: OV_DB_HOST: db - # OV_DB_PASSWORD: env_file: - .env db: env_file: - - .db + - .env diff --git a/docker-compose.yml b/docker-compose.yml index 61e4c6a..82caf00 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 @@ -15,22 +16,8 @@ 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 ports: - 5432:5432 @@ -38,3 +25,8 @@ services: - POSTGRES_DB=${OV_DB_NAME} - POSTGRES_USER=${OV_DB_USER} - POSTGRES_PASSWORD=${OV_DB_PASSWORD} + volumes: + - db:/var/lib/postgresql/data + +volumes: + db: diff --git a/ov b/ov index 0a38b96..48ded48 100755 --- a/ov +++ b/ov @@ -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" diff --git a/test.yml b/test.yml new file mode 100644 index 0000000..d47ba1d --- /dev/null +++ b/test.yml @@ -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