-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flake8 config to pyproject, removed pre-commit, prune Employee old fi…
…elds, add DEFAULT_AUTO_FIELD setting
- Loading branch information
1 parent
d7919d0
commit c19fbff
Showing
13 changed files
with
218 additions
and
376 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,67 @@ | ||
name: CI/CD main workflow | ||
|
||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
|
||
jobs: | ||
|
||
build: | ||
test-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
cache: 'poetry' | ||
|
||
- run: python install_poetry.py | ||
- run: poetry install | ||
- run: make lint | ||
- run: make test | ||
|
||
build-push: | ||
runs-on: ubuntu-latest | ||
needs: [test-lint] | ||
steps: | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.CR_PAT }} | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-single-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-single-buildx | ||
- name: Build | ||
uses: docker/build-push-action@v2 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ./Dockerfile | ||
load: true | ||
push: true | ||
tags: | | ||
ghcr.io/romanmazyrin/salaries_project:latest | ||
salaries_project_temp | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
|
||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
lint: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- name: Lint | ||
run: docker run salaries_project_temp poetry run black . && poetry run flake8 . | ||
ghcr.io/${{ github.repository }}:latest | ||
tests: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- name: Tests | ||
run: docker run salaries_project_temp poetry run pytest -s . | ||
push: | ||
runs-on: ubuntu-latest | ||
needs: [lint, tests] | ||
steps: | ||
- name: Push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
file: ./Dockerfile | ||
push: true | ||
tags: | | ||
ghcr.io/romanmazyrin/salaries_project:latest | ||
|
||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [push] | ||
steps: | ||
- name: executing remote ssh docker stack deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.KEY }} | ||
script: | | ||
docker pull ghcr.io/romanmazyrin/salaries_project:latest | ||
docker stack deploy -c salary_service/docker-compose.yml --with-registry-auth django_salaries | ||
# deploy: | ||
# runs-on: ubuntu-latest | ||
# needs: [push] | ||
# steps: | ||
# - name: executing remote ssh docker stack deploy | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.HOST }} | ||
# username: ${{ secrets.USERNAME }} | ||
# key: ${{ secrets.KEY }} | ||
# script: | | ||
# docker pull ghcr.io/romanmazyrin/salaries_project:latest | ||
# docker stack deploy -c salary_service/docker-compose.yml --with-registry-auth django_salaries | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ bin/ | |
include/ | ||
venv/ | ||
.venv/ | ||
static/ | ||
static/ | ||
tmp/ |
This file was deleted.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ version: "3.8" | |
|
||
services: | ||
salaries: | ||
image: salaries:n1 | ||
build: | ||
context: ./ | ||
dockerfile: ./Dockerfile | ||
|
@@ -13,7 +12,7 @@ services: | |
DATABASE_URL: postgres://postgres:123456@db:5432/postgres | ||
RUN_MIGRATIONS: 1 | ||
CREATE_SUPERUSER: 1 | ||
DJANGO_SUPERUSER_PASSWORD: 123456 | ||
DJANGO_SUPERUSER_PASSWORD: '123456' | ||
DJANGO_SUPERUSER_USERNAME: admin | ||
DJANGO_SUPERUSER_EMAIL: [email protected] | ||
AMOCRM_ENTITIES_ENDPOINT_AUTH_KEY: xxxxxxx | ||
|
@@ -23,7 +22,7 @@ services: | |
- db | ||
|
||
db: | ||
image: postgres:13-alpine | ||
image: postgres:16-alpine | ||
environment: | ||
POSTGRES_PASSWORD: '123456' | ||
volumes: | ||
|
Oops, something went wrong.