chore(deps): update dependency django-ipware to v5.0.1 (#2025) #12079
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
id: setup-python | |
with: | |
python-version-file: '.python-version' | |
- uses: actions/cache@v3 | |
id: cache-dependencies | |
with: | |
path: | | |
venv | |
key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/*requirements.txt') }} | |
- name: Install dependencies | |
if: steps.cache-dependencies.outputs.cache-hit != 'true' | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
pip install --upgrade pip pip-tools | |
pip-sync requirements.txt dev-requirements.txt | |
- name: Run the linter | |
run: | | |
. venv/bin/activate | |
cp src/app/.env.ci src/app/.env | |
make lint | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:13.9-alpine | |
env: | |
POSTGRES_PASSWORD: secret | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:6.2.10-alpine | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
id: setup-python | |
with: | |
python-version-file: '.python-version' | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
venv | |
key: ${{ runner.os }}-venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/*requirements.txt') }} | |
- name: Install locale stuff | |
run: | | |
sudo apt-get update | |
sudo apt-get --no-install-recommends install -y locales-all gettext | |
- name: Run the tests | |
env: | |
DATABASE_URL: postgres://postgres:secret@localhost:5432/postgres | |
REDISCLOUD_URL: redis://localhost:6379/5 | |
run: | | |
. venv/bin/activate | |
cp src/app/.env.ci src/app/.env | |
make test | |
- name: Upload code coverage to codeclimate | |
uses: paambaati/[email protected] | |
env: | |
CC_TEST_REPORTER_ID: dd4cac59d43b52ee4c29cfed9d5162098a49ff65d9e72003abc1fa65cd608f1d | |
with: | |
coverageLocations: | | |
${{github.workspace}}/src/coverage.xml:coverage.py | |
build-docker-image: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
id: setup-python | |
with: | |
python-version-file: '.python-version' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Store default envfironment file to be runnable at the developer machine | |
run: cp src/app/.env.ci src/app/.env | |
- name: Generate image identifier | |
id: image | |
uses: ASzc/change-string-case-action@v5 | |
with: | |
string: ${{ github.repository_owner }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build web image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
target: web | |
push: ${{ github.ref == 'refs/heads/master' }} | |
tags: | | |
ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-web:latest | |
ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-web:${{ github.sha }} | |
build-args: | | |
PYTHON_VERSION=${{ steps.setup-python.outputs.python-version }} | |
RELEASE=${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build worker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
target: worker | |
push: ${{ github.ref == 'refs/heads/master' }} | |
tags: | | |
ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-worker:latest | |
ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-worker:${{ github.sha }} | |
build-args: | | |
PYTHON_VERSION=${{ steps.setup-python.outputs.python-version }} | |
RELEASE=${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build scheduler image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
target: scheduler | |
push: ${{ github.ref == 'refs/heads/master' }} | |
tags: | | |
ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-scheduler:latest | |
ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-scheduler:${{ github.sha }} | |
build-args: | | |
PYTHON_VERSION=${{ steps.setup-python.outputs.python-version }} | |
RELEASE=${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy: | |
needs: build-docker-image | |
if: github.ref == 'refs/heads/master' && github.repository_owner == 'tough-dev-school' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Draft Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: production | |
finalize: false | |
- name: Read image identifiers | |
id: image | |
uses: ASzc/change-string-case-action@v5 | |
with: | |
string: ${{ github.repository_owner }} | |
- name: Update backend image | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: circle | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: docker service update app_backend --image ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-web:${{ github.sha }} --with-registry-auth | |
- name: Update celery worker image | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: circle | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: docker service update app_worker --image ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-worker:${{ github.sha }} --with-registry-auth | |
- name: Update celery amocrm worker image | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: circle | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: docker service update app_amocrm-worker --image ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-worker:${{ github.sha }} --with-registry-auth | |
- name: Update celery scheduler image | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: circle | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: | | |
docker service update app_scheduler --detach --image ghcr.io/${{ steps.image.outputs.lowercase }}/monolith-scheduler:${{ github.sha }} --with-registry-auth | |
- name: Finalize Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: production | |
finalize: true |