From 504a9b77691ca7702594f08a2d32946ff6e36c97 Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Thu, 5 Jun 2025 23:14:59 +0300 Subject: [PATCH 1/6] change steps order --- .github/workflows/ci.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2612c31..4d63a14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,20 +17,7 @@ jobs: 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: @@ -54,5 +41,19 @@ jobs: Repository: ${{ github.repository }} See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} - - name: Check fail - run: echo "Unreachable" + - 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 + From 9ab643bfbfd3da563065cd6d7fbf4d520c1824fc Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Thu, 5 Jun 2025 23:16:41 +0300 Subject: [PATCH 2/6] add success notify --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d63a14..36b47a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,8 @@ jobs: to: ${{ secrets.TELEGRAM_TO }} token: ${{ secrets.TELEGRAM_TOKEN }} message: | - ${{ github.actor }} created commit: + PyTest failed + Commit message: ${{ github.event.commits[0].message }} Repository: ${{ github.repository }} See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} @@ -57,3 +58,14 @@ jobs: readme-path: README.md python-version: 3.11 # python version which will lint the package + - name: Notify in telegram about success + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + PyTest successed + + Commit message: ${{ github.event.commits[0].message }} + Repository: ${{ github.repository }} + See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} From 7dfcd13a7ceeac75e0cced68d07244985cbf6a96 Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Thu, 5 Jun 2025 23:29:50 +0300 Subject: [PATCH 3/6] add TODO --- .github/workflows/ci.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36b47a1..9c9ace8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,31 +17,6 @@ jobs: uses: actions/checkout@v4 with: ref: dev - - - 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: | - PyTest failed - - Commit message: ${{ github.event.commits[0].message }} - Repository: ${{ github.repository }} - See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} - - name: Lint the Dockerfile uses: hadolint/hadolint-action@v3.1.0 with: From 854fe0fbc4c432f7aac6f3fc8f39c2c4ca9b9735 Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Thu, 5 Jun 2025 23:29:57 +0300 Subject: [PATCH 4/6] init docker build workflow --- .github/workflows/docker-build.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/docker-build.yaml diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 0000000..9eb1e04 --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,17 @@ +name: Build and push Docker image +on: + workflow_dispatch: + pull_request: + branches: + - main + types: + - closed + +jobs: + if_merged: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - run: | + echo The PR was merged + From 89be94258842a9565a6c4eb0cc77093fe939794b Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Thu, 5 Jun 2025 23:32:19 +0300 Subject: [PATCH 5/6] some fixes --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c9ace8..c9cc12f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,12 +17,13 @@ jobs: 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 + - name: Lint the source code # TODO: use pylint from pip -- it can fail uses: Silleellie/pylint-github-action@v2.1 with: lint-path: | @@ -32,15 +33,41 @@ jobs: 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: Notify in telegram about success + - 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: | - PyTest successed - + PyTest success + 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" + + - name: Notify in telegram about success + if: ${{ failure() }} + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Workflow success Commit message: ${{ github.event.commits[0].message }} Repository: ${{ github.repository }} See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} From b8319deb6b119636e640cfbcc7db8b8b472cfbef Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Thu, 5 Jun 2025 23:33:32 +0300 Subject: [PATCH 6/6] fix notifying --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9cc12f..35d641e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,6 @@ jobs: run: echo "Unreachable" - name: Notify in telegram about success - if: ${{ failure() }} uses: appleboy/telegram-action@master with: to: ${{ secrets.TELEGRAM_TO }}