CHORE: Update dependencies (#1287) #373
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
paths: | |
# Host config | |
- '.plaform/**' | |
- '.platform.app.yaml' | |
- 'gunicorn.conf.py' | |
# Python config | |
- 'poetry.lock' | |
- 'pyproject.toml' | |
# NPM config | |
- 'package.json' | |
- 'package-lock.json' | |
- 'webpack.config.js' | |
# App changes | |
- 'config/**' | |
- 'sass/**' | |
- 'scripts/**' | |
- 'templates/**' | |
- 'etna/**' | |
env: | |
PYTHON_VERSION: "3.11" | |
POETRY_VERSION: "1.5.1" | |
jobs: | |
notify-slack: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_TITLE: "A deployment to ${{ github.head_ref || github.ref_name }} is imminent" | |
test-python: | |
runs-on: ubuntu-latest | |
env: | |
DJANGO_SETTINGS_MODULE: config.settings.test | |
DATABASE_ENGINE: django.db.backends.postgresql | |
DATABASE_NAME: postgres | |
DATABASE_USER: postgres | |
DATABASE_PASSWORD: postgres | |
DATABASE_HOST: localhost | |
DATABASE_PORT: 5432 | |
services: | |
postgres: | |
image: postgres:12.3 | |
env: | |
POSTGRES_USER: ${{ env.DATABASE_USER }} | |
POSTGRES_PASSWORD: ${{ env.DATABASE_PASSWORD }} | |
POSTGRES_DB: ${{ env.DATABASE_NAME }} | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 1s --health-timeout 3s --health-retries 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-dir: .venv | |
- id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: ds-wagtail-venv-${{ runner.os }}-${{ env.POETRY_VERSION }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
- name: Run Django checks | |
run: poetry run python manage.py check | |
- name: Run test suite | |
run: poetry run python manage.py test etna | |
- name: Check for missing migrations | |
run: poetry run python manage.py makemigrations --check --noinput | |
test-javascript: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install npm modules | |
run: npm install | |
- name: Run jest tests | |
run: npm test | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
- name: Install npm modules | |
run: npm install | |
- name: Lint SCSS and JS | |
run: npm run lint | |
compile-sass: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
- name: Install npm modules | |
run: npm install | |
- name: Compile SCSS | |
run: npm run compile:css | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [notify-slack, test-python, test-javascript, prettier, compile-sass] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: axelerant/platformsh-deploy-action@v1 | |
with: | |
project-id: ${{ secrets.PLATFORM_PROJECT_ID }} | |
cli-token: ${{ secrets.PLATFORM_CLI_TOKEN }} | |
ssh-private-key: ${{ secrets.PLATFORM_SSH_KEY }} | |
force-push: true |