dev #2

Merged
wtukatyr merged 19 commits from dev into main 2025-06-05 23:09:25 +03:00
9 changed files with 67 additions and 4 deletions

View File

@@ -5,9 +5,54 @@ on:
branches:
- dev
pull_request:
branches:
- main
jobs:
docker-lint:
linters:
runs-on: ubuntu-latest
steps:
- name: lint dockerfile
run: echo hello
- name: Getting the codebase
uses: actions/checkout@v4
with:
ref: dev
- name: Lint the Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
- name: Lint the source code
uses: Silleellie/pylint-github-action@v2.1
with:
lint-path: |
mysite
polls
manage.py
requirements-path: requirements.txt
readme-path: README.md
python-version: 3.11 # python version which will lint the package
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest
- name: Notify in telegram about fail
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
Repository: ${{ github.repository }}
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
- name: Check fail
run: echo "Unreachable"

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ venv
polls/__pycache__
polls/migrations/__pycache__
.env
tests/__pycache__

View File

@@ -1,7 +1,7 @@
FROM python:3.11-alpine
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY ./mysite ./mysite
COPY ./polls ./polls

View File

@@ -1,3 +1,7 @@
# Django example app
Application made by django's instruction for **DevOps** education purposes
# Pylint
![pylint](https://img.shields.io/badge/PyLint-6.20-orange?logo=python&logoColor=white)

View File

@@ -123,3 +123,6 @@ class QuestionDetailViewTests(TestCase):
url = reverse("polls:detail", args=(past_question.id,))
response = self.client.get(url)
self.assertContains(response, past_question.question_text)
def test_fake_test(self):
self.assertEqual(0, 1)

View File

@@ -1,9 +1,14 @@
asgiref==3.8.1
Django==5.2.1
django-debug-toolbar==5.2.0
iniconfig==2.1.0
packaging==25.0
pip==23.0.1
pluggy==1.6.0
psycopg==3.2.9
psycopg-binary==3.2.9
Pygments==2.19.1
pytest==8.4.0
setuptools==66.1.1
sqlparse==0.5.3
typing_extensions==4.14.0

0
tests/__init__.py Normal file
View File

3
tests/test_fail.py Normal file
View File

@@ -0,0 +1,3 @@
def test_fail():
# Fixed
assert 1 == 1

2
tests/test_success.py Normal file
View File

@@ -0,0 +1,2 @@
def test_success():
assert True