Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing cd #3

Merged
merged 21 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__pycache__
Dockerfile
docke-compose.yaml
requirements-dev.txt
.pylintrc
.pre-commit-config.yaml
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MONGO_URI=
25 changes: 25 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy to self-hosted

on:
workflow_run:
workflows: [ "Python application CI" ]
branches: [ "main" ]
types:
- completed

env:
PORT: ${{ secrets.PORT }}
MONGO_URI: ${{ secrets.MONGO_URI }}

jobs:
deploy:
runs-on: self-hosted

steps:
- uses: actions/checkout@v3

- name: Build docker-compose
run: docker-compose up -d --build

- name: Clear Docker Cache
run: docker system prune -af
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Python application CI

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pylint autopep8
if [ -f requirements.txt ]; then pip install -r requirements-dev.txt; fi

- name: Format with autopep8
run: |
autopep8 --in-place --recursive --max-line-length 120 --exclude="venv" .

- name: Lint with pylint
run: |
pylint **/*.py --rcfile=.pylintrc --fail-under=8.0 --exit-zero
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
__pycache__/
evn/
__pycache__/
evn/
venv/
.env
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- repo: local
hooks:
- id: autopep8
name: Run Formatter
entry: autopep8
language: python
types: [python]
args: [-i]
- id: pylint
name: Run Linter
entry: pylint
language: python
types: [python]
args:
[
"-rn",
"-sn",
"--rcfile=.pylintrc",
]
Loading