From 2d1b50a3951cb8e82393abcd0650fbf6ba6f2629 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 19:18:05 +0300
Subject: [PATCH 01/28] Add easy func for searching info via API
---
truth_seeker.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 truth_seeker.py
diff --git a/truth_seeker.py b/truth_seeker.py
new file mode 100644
index 0000000..7b3b5af
--- /dev/null
+++ b/truth_seeker.py
@@ -0,0 +1,22 @@
+from newsapi import NewsApiClient
+# https://newsapi.org/
+
+API_KEY = ""
+
+newsapi = NewsApiClient(api_key=API_KEY)
+
+# TRY
+all_articles = newsapi.get_everything(q="test",
+ sort_by="popularity")
+
+# print(all_articles)
+
+for k_a, v_a in all_articles.items():
+ print(k_a, v_a)
+ if k_a == "articles":
+ for list_i in v_a:
+ print("=======================")
+ print("NEW NEWS")
+ print("=======================")
+ for k, v in list_i.items():
+ print(k, v)
From 1629a6ec9c0ef4bb313104b8f8b4c09bf9751d6a Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 19:26:02 +0300
Subject: [PATCH 02/28] Add security & requirements.txt; update .gitignore &
truth_seeker.py
---
.gitignore | 3 +++
dynaconfig.py | 5 +++++
requirements.txt | 1 +
truth_seeker.py | 3 ++-
4 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 dynaconfig.py
create mode 100644 requirements.txt
diff --git a/.gitignore b/.gitignore
index b6e4761..141afac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,3 +127,6 @@ dmypy.json
# Pyre type checker
.pyre/
+
+# Secret file
+.secrets.toml
\ No newline at end of file
diff --git a/dynaconfig.py b/dynaconfig.py
new file mode 100644
index 0000000..c3b9b37
--- /dev/null
+++ b/dynaconfig.py
@@ -0,0 +1,5 @@
+from dynaconf import Dynaconf
+
+config = Dynaconf(
+ settings_files=['.secrets.toml'],
+)
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..7db616d
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+dynaconf~=3.1.11
\ No newline at end of file
diff --git a/truth_seeker.py b/truth_seeker.py
index 7b3b5af..fe67439 100644
--- a/truth_seeker.py
+++ b/truth_seeker.py
@@ -1,7 +1,8 @@
from newsapi import NewsApiClient
+import dynaconfig
# https://newsapi.org/
-API_KEY = ""
+API_KEY = dynaconfig.config["API_KEY"]
newsapi = NewsApiClient(api_key=API_KEY)
From f2222d9d5deb16eeef26147296a36de159bbbf0f Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 19:28:10 +0300
Subject: [PATCH 03/28] Blacked & isorted
---
dynaconfig.py | 4 ++--
requirements.txt | 2 ++
truth_seeker.py | 5 +++--
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dynaconfig.py b/dynaconfig.py
index c3b9b37..9977d2a 100644
--- a/dynaconfig.py
+++ b/dynaconfig.py
@@ -1,5 +1,5 @@
from dynaconf import Dynaconf
config = Dynaconf(
- settings_files=['.secrets.toml'],
-)
\ No newline at end of file
+ settings_files=[".secrets.toml"],
+)
diff --git a/requirements.txt b/requirements.txt
index 7db616d..629a07b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1,3 @@
+black
+isort
dynaconf~=3.1.11
\ No newline at end of file
diff --git a/truth_seeker.py b/truth_seeker.py
index fe67439..46cbf7b 100644
--- a/truth_seeker.py
+++ b/truth_seeker.py
@@ -1,5 +1,7 @@
from newsapi import NewsApiClient
+
import dynaconfig
+
# https://newsapi.org/
API_KEY = dynaconfig.config["API_KEY"]
@@ -7,8 +9,7 @@
newsapi = NewsApiClient(api_key=API_KEY)
# TRY
-all_articles = newsapi.get_everything(q="test",
- sort_by="popularity")
+all_articles = newsapi.get_everything(q="test", sort_by="popularity")
# print(all_articles)
From ee34c23e2b793a1c029e5a843903d3358dc8d2ff Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 20:55:05 +0300
Subject: [PATCH 04/28] Update requirements.txt
---
requirements.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/requirements.txt b/requirements.txt
index 629a07b..0e4c012 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,4 @@
black
isort
+pyinstaller
dynaconf~=3.1.11
\ No newline at end of file
From 82ff37c3ab5d22ffedd86e45f5aca4fdc83fad9a Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 21:05:21 +0300
Subject: [PATCH 05/28] Update requirements.txt & truth_seeker.py
---
requirements.txt | 3 ++-
truth_seeker.py | 8 ++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 0e4c012..cd7980f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,5 @@
black
isort
pyinstaller
-dynaconf~=3.1.11
\ No newline at end of file
+dynaconf~=3.1.11
+newsapi-python~=0.2.6
diff --git a/truth_seeker.py b/truth_seeker.py
index 46cbf7b..b985cba 100644
--- a/truth_seeker.py
+++ b/truth_seeker.py
@@ -8,8 +8,12 @@
newsapi = NewsApiClient(api_key=API_KEY)
-# TRY
-all_articles = newsapi.get_everything(q="test", sort_by="popularity")
+try:
+ all_articles = newsapi.get_everything(q="test", sort_by="popularity")
+except ConnectionError as con_err:
+ print(con_err)
+except BaseException as base_err:
+ print(base_err)
# print(all_articles)
From 692866c663f937b7d25dc1df6c915b86ead85013 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 21:05:47 +0300
Subject: [PATCH 06/28] Update requirements.txt & truth_seeker.py
---
truth_seeker.py | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/truth_seeker.py b/truth_seeker.py
index b985cba..f0da4bc 100644
--- a/truth_seeker.py
+++ b/truth_seeker.py
@@ -10,6 +10,17 @@
try:
all_articles = newsapi.get_everything(q="test", sort_by="popularity")
+
+ for k_a, v_a in all_articles.items():
+ print(k_a, v_a)
+ if k_a == "articles":
+ for list_i in v_a:
+ print("=======================")
+ print("NEW NEWS")
+ print("=======================")
+ for k, v in list_i.items():
+ print(k, v)
+
except ConnectionError as con_err:
print(con_err)
except BaseException as base_err:
@@ -17,12 +28,4 @@
# print(all_articles)
-for k_a, v_a in all_articles.items():
- print(k_a, v_a)
- if k_a == "articles":
- for list_i in v_a:
- print("=======================")
- print("NEW NEWS")
- print("=======================")
- for k, v in list_i.items():
- print(k, v)
+
From 80b7302d1a489b6f1cd641343b4d1f7811edfe60 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 21:20:52 +0300
Subject: [PATCH 07/28] Change output method in build.yaml
---
.github/workflows/build.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce4170c..cf9c419 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -39,7 +39,7 @@ jobs:
- name: Set tag version to output
id: set_current_tag_id
- run: echo "::set-output name=current_tag::${{ steps.tag_version.outputs.new_tag }}"
+ run: echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT
- name: Notify if failure
if: ${{ failure() }}
@@ -126,7 +126,7 @@ jobs:
WorkFlows: ActionsList
- Commit with tag: ${{ needs.prepare.outputs.get_current_tag }}
+ Commit with tag: ${{ needs.prepare.outputs.CURRENT_TAG }}
Repository: ${{ github.repository }}
From fb6b0a5f1e9769a97c7dc140d4b0ddde046094f9 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 21:33:26 +0300
Subject: [PATCH 08/28] Change output method in build.yaml & release.yaml
---
.github/workflows/build.yaml | 2 --
.github/workflows/release.yaml | 12 +++++-------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index cf9c419..dbbb696 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -13,8 +13,6 @@ jobs:
prepare:
name: Prepare env & label
runs-on: ubuntu-latest
- outputs:
- get_current_tag: ${{ steps.set_current_tag_id.outputs.current_tag }}
steps:
- name: Checkout code
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 4f08284..cd1693d 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -39,7 +39,7 @@ jobs:
- name: Set tag version to output
id: set_current_tag_id
- run: echo "::set-output name=current_tag::${{ steps.tag_version.outputs.new_tag }}"
+ run: echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT
- name: Notify if failure
if: ${{ failure() }}
@@ -57,8 +57,6 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
needs: prepare
- outputs:
- get_release_url: ${{ steps.set_release_url.outputs.release_url }}
steps:
- name: Build Changelog
@@ -76,12 +74,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.REPOS_TOKEN }}
with:
tag_name: ${{ needs.prepare.outputs.get_current_tag }}
- release_name: Release ${{ needs.prepare.outputs.get_current_tag }}
+ release_name: Release ${{ needs.prepare.outputs.CURRENT_TAG }}
body: ${{ steps.github_release.outputs.changelog }}
- name: Set Release URL
id: set_release_url
- run: echo "::set-output name=release_url::${{ steps.create_release.outputs.upload_url }}"
+ run: echo "RELEASE_URL=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT
- name: Notify if failure
if: ${{ failure() }}
@@ -145,7 +143,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- upload_url: ${{ needs.release.outputs.get_release_url }}
+ upload_url: ${{ needs.release.outputs.RELEASE_URL }}
asset_path: ./dist/${{ matrix.OUT_FILE_NAME }}
asset_name: ${{ matrix.OUT_FILE_NAME }}
asset_content_type: ${{ matrix.ASSET_MIME }}
@@ -180,7 +178,7 @@ jobs:
WorkFlows: ActionsList
- Commit with tag: ${{ needs.prepare.outputs.get_current_tag }}
+ Commit with tag: ${{ needs.prepare.outputs.CURRENT_TAG }}
Repository: ${{ github.repository }}
From 62dfc55fd01772bca4fd350d96ddbc3dd069c4d4 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Mon, 17 Oct 2022 21:52:41 +0300
Subject: [PATCH 09/28] Add funcs & logging
---
truth_seeker.py | 40 +++++++++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 11 deletions(-)
diff --git a/truth_seeker.py b/truth_seeker.py
index f0da4bc..4a1a969 100644
--- a/truth_seeker.py
+++ b/truth_seeker.py
@@ -1,3 +1,5 @@
+import logging
+
from newsapi import NewsApiClient
import dynaconfig
@@ -8,10 +10,31 @@
newsapi = NewsApiClient(api_key=API_KEY)
-try:
- all_articles = newsapi.get_everything(q="test", sort_by="popularity")
-
- for k_a, v_a in all_articles.items():
+# Logging
+logging.basicConfig(
+ format="%(asctime)s - %(levelname)s - %(message)s", level=logging.INFO
+)
+logging.basicConfig(
+ format="%(asctime)s - %(levelname)s - %(message)s", level=logging.WARNING
+)
+logging.basicConfig(
+ format="%(asctime)s - %(levelname)s - %(message)s", level=logging.ERROR
+)
+
+
+def fetch_info(query: str):
+ try:
+ result = newsapi.get_everything(q=query, sort_by="popularity")
+ logging.info(f"Searching for {query}")
+ return result
+ except ConnectionError as con_err:
+ logging.error(con_err)
+ except BaseException as base_err:
+ logging.error(base_err)
+
+
+def list_info():
+ for k_a, v_a in fetch_info("test").items():
print(k_a, v_a)
if k_a == "articles":
for list_i in v_a:
@@ -21,11 +44,6 @@
for k, v in list_i.items():
print(k, v)
-except ConnectionError as con_err:
- print(con_err)
-except BaseException as base_err:
- print(base_err)
-
-# print(all_articles)
-
+if __name__ == "__main__":
+ list_info()
From 5e4b803acc5c7db3a47863e728794314eb1ef3b2 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 12:30:38 +0300
Subject: [PATCH 10/28] Update truth_seeker.py
---
truth_seeker.py | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/truth_seeker.py b/truth_seeker.py
index 4a1a969..d050d73 100644
--- a/truth_seeker.py
+++ b/truth_seeker.py
@@ -22,28 +22,33 @@
)
-def fetch_info(query: str):
+def fetch_info(query: str) -> dict:
try:
result = newsapi.get_everything(q=query, sort_by="popularity")
logging.info(f"Searching for {query}")
return result
except ConnectionError as con_err:
logging.error(con_err)
+ return {}
except BaseException as base_err:
logging.error(base_err)
+ return {}
-def list_info():
- for k_a, v_a in fetch_info("test").items():
- print(k_a, v_a)
- if k_a == "articles":
- for list_i in v_a:
- print("=======================")
- print("NEW NEWS")
- print("=======================")
- for k, v in list_i.items():
- print(k, v)
+def list_info(fetch_info: dict):
+ if fetch_info:
+ for article in fetch_info.get("articles"):
+ for article_point, article_data in article.items():
+ if article_point == "urlToImage":
+ continue
+ elif article_point == "source":
+ print(article_point.capitalize(), article_data.get("name"))
+ else:
+ print(article_point.capitalize(), article_data)
+ else:
+ logging.warning("Empty response from API")
+ raise IndexError
if __name__ == "__main__":
- list_info()
+ list_info(fetch_info("test"))
From 3133b1f1aa30cff4c4057eb6999044bdabc2aeea Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 12:52:01 +0300
Subject: [PATCH 11/28] Add testing with pytest
---
.github/workflows/code_quality.yaml | 29 +++++++++++++++++++++++++++++
requirements.txt | 4 +++-
tests/truth_tester.py | 19 +++++++++++++++++++
3 files changed, 51 insertions(+), 1 deletion(-)
create mode 100644 tests/truth_tester.py
diff --git a/.github/workflows/code_quality.yaml b/.github/workflows/code_quality.yaml
index b9bfc80..1c15cf6 100644
--- a/.github/workflows/code_quality.yaml
+++ b/.github/workflows/code_quality.yaml
@@ -35,3 +35,32 @@ jobs:
!!! FAILED !!!
Failed job: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
+
+ pytesting:
+ runs-on: ubuntu-latest
+ name: Testing with pytest
+ container: python:3.9
+ needs: [ code_quality ]
+
+ steps:
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Run script
+ run: pip install -r requirements.txt
+
+ - name: Testing
+ run: pytest -v tests/truth_tester.py
+
+ - name: Notify if failure
+ if: ${{ failure() }}
+ uses: appleboy/telegram-action@master
+ with:
+ to: ${{ secrets.TELEGRAM_CHAT }}
+ token: ${{ secrets.TELEGRAM_TOKEN }}
+ format: html
+ message: |
+ !!! FAILED !!!
+ Failed job: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
+ See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index cd7980f..a1d7bb1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,7 @@
black
isort
pyinstaller
-dynaconf~=3.1.11
+pytest~=7.1.3
+dynaconfig~=0.4
newsapi-python~=0.2.6
+
diff --git a/tests/truth_tester.py b/tests/truth_tester.py
new file mode 100644
index 0000000..867b86a
--- /dev/null
+++ b/tests/truth_tester.py
@@ -0,0 +1,19 @@
+import truth_seeker
+
+
+def test_fetch_info():
+ """
+ Simple test for fetching func
+ :return:
+ """
+ return isinstance(truth_seeker.fetch_info("test"), dict)
+
+
+def test_fetch_info_empty():
+ """
+ Empty query
+ :return:
+ """
+ return isinstance(truth_seeker.fetch_info(""), dict)
+
+
From 8cafa81c2c735d38e1ff4e3c7c453e104afb7725 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 12:58:53 +0300
Subject: [PATCH 12/28] Blacked & isorted
---
tests/truth_tester.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/tests/truth_tester.py b/tests/truth_tester.py
index 867b86a..600c181 100644
--- a/tests/truth_tester.py
+++ b/tests/truth_tester.py
@@ -15,5 +15,3 @@ def test_fetch_info_empty():
:return:
"""
return isinstance(truth_seeker.fetch_info(""), dict)
-
-
From 347fdf5ab71a66317ffd0965ae2a96cb6e701da2 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:07:47 +0300
Subject: [PATCH 13/28] Update code_quality.yaml
---
.github/workflows/code_quality.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/code_quality.yaml b/.github/workflows/code_quality.yaml
index 1c15cf6..efbffaa 100644
--- a/.github/workflows/code_quality.yaml
+++ b/.github/workflows/code_quality.yaml
@@ -51,7 +51,7 @@ jobs:
run: pip install -r requirements.txt
- name: Testing
- run: pytest -v tests/truth_tester.py
+ run: pytest -v
- name: Notify if failure
if: ${{ failure() }}
From 52e83b32154e559d4c9849e79950fb1c0e39f328 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:09:55 +0300
Subject: [PATCH 14/28] Renamed to test_truth_seeker.py
---
tests/{truth_tester.py => test_truth_seeker.py} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename tests/{truth_tester.py => test_truth_seeker.py} (100%)
diff --git a/tests/truth_tester.py b/tests/test_truth_seeker.py
similarity index 100%
rename from tests/truth_tester.py
rename to tests/test_truth_seeker.py
From c9f4f6add7230431f1df3d9b3b39b27f8ce4a31c Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:16:27 +0300
Subject: [PATCH 15/28] Update project structure
---
truth_seeker.py => app/truth_seeker.py | 0
tests/test_truth_seeker.py | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename truth_seeker.py => app/truth_seeker.py (100%)
diff --git a/truth_seeker.py b/app/truth_seeker.py
similarity index 100%
rename from truth_seeker.py
rename to app/truth_seeker.py
diff --git a/tests/test_truth_seeker.py b/tests/test_truth_seeker.py
index 600c181..ed05354 100644
--- a/tests/test_truth_seeker.py
+++ b/tests/test_truth_seeker.py
@@ -1,4 +1,4 @@
-import truth_seeker
+from app import truth_seeker
def test_fetch_info():
From a74a1756e1640c5b8f52360a9817dcc4daa9412e Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:21:12 +0300
Subject: [PATCH 16/28] Update code_quality.yaml
---
.github/workflows/code_quality.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/code_quality.yaml b/.github/workflows/code_quality.yaml
index efbffaa..b6c1f1c 100644
--- a/.github/workflows/code_quality.yaml
+++ b/.github/workflows/code_quality.yaml
@@ -51,7 +51,7 @@ jobs:
run: pip install -r requirements.txt
- name: Testing
- run: pytest -v
+ run: pytest -v ./tests
- name: Notify if failure
if: ${{ failure() }}
From 06e883d1480d840ea7e52ed003b3a4ea44a52c88 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:28:44 +0300
Subject: [PATCH 17/28] Update CI; package tests
---
.github/workflows/build.yaml | 6 +++---
.github/workflows/code_quality.yaml | 2 +-
.github/workflows/release.yaml | 6 +++---
tests/__init__.py | 0
4 files changed, 7 insertions(+), 7 deletions(-)
create mode 100644 tests/__init__.py
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index dbbb696..0fe296c 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -60,12 +60,12 @@ jobs:
include:
- os: windows-latest
TARGET: windows
- CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F truth_seeker.py
+ CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F ./app/truth_seeker.py
OUT_FILE_NAME: truth_seeker.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
- os: ubuntu-latest
TARGET: ubuntu
- CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F truth_seeker.py
+ CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F ./app/truth_seeker.py
OUT_FILE_NAME: truth_seeker
ASSET_MIME: application/x-binary
@@ -124,7 +124,7 @@ jobs:
WorkFlows: ActionsList
- Commit with tag: ${{ needs.prepare.outputs.CURRENT_TAG }}
+ Commit with tag: ${{ env.CURRENT_TAG }}
Repository: ${{ github.repository }}
diff --git a/.github/workflows/code_quality.yaml b/.github/workflows/code_quality.yaml
index b6c1f1c..8e8c21d 100644
--- a/.github/workflows/code_quality.yaml
+++ b/.github/workflows/code_quality.yaml
@@ -51,7 +51,7 @@ jobs:
run: pip install -r requirements.txt
- name: Testing
- run: pytest -v ./tests
+ run: pytest -v ./tests/
- name: Notify if failure
if: ${{ failure() }}
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index cd1693d..207acba 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -103,12 +103,12 @@ jobs:
include:
- os: windows-latest
TARGET: windows
- CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F truth_seeker.py
+ CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F ./app/truth_seeker.py
OUT_FILE_NAME: truth_seeker.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
- os: ubuntu-latest
TARGET: ubuntu
- CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F truth_seeker.py
+ CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F ./app/truth_seeker.py
OUT_FILE_NAME: truth_seeker
ASSET_MIME: application/x-binary
@@ -143,7 +143,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- upload_url: ${{ needs.release.outputs.RELEASE_URL }}
+ upload_url: ${{ env.RELEASE_URL }}
asset_path: ./dist/${{ matrix.OUT_FILE_NAME }}
asset_name: ${{ matrix.OUT_FILE_NAME }}
asset_content_type: ${{ matrix.ASSET_MIME }}
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
From 950d40888ac382ae753faa6e44c0aca54b9a9942 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:34:23 +0300
Subject: [PATCH 18/28] Update requirements.txt
---
requirements.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index a1d7bb1..58a8e0e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,5 +3,5 @@ isort
pyinstaller
pytest~=7.1.3
dynaconfig~=0.4
-newsapi-python~=0.2.6
-
+dynaconf~=3.1.11
+newsapi-python~=0.2.6
\ No newline at end of file
From 33016390d78a9aed51ae602ef3433957fcdece47 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:45:20 +0300
Subject: [PATCH 19/28] Update CI
---
.github/workflows/build.yaml | 2 +-
.github/workflows/release.yaml | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 0fe296c..f950f33 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -37,7 +37,7 @@ jobs:
- name: Set tag version to output
id: set_current_tag_id
- run: echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT
+ run: echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_ENV
- name: Notify if failure
if: ${{ failure() }}
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 207acba..926a6f8 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -79,7 +79,7 @@ jobs:
- name: Set Release URL
id: set_release_url
- run: echo "RELEASE_URL=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT
+ run: echo "RELEASE_URL=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_ENV
- name: Notify if failure
if: ${{ failure() }}
@@ -178,12 +178,12 @@ jobs:
WorkFlows: ActionsList
- Commit with tag: ${{ needs.prepare.outputs.CURRENT_TAG }}
+ Commit with tag: ${{ env.CURRENT_TAG }}
Repository: ${{ github.repository }}
Branch: ${{ github.ref }}
- Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ needs.prepare.outputs.get_current_tag }}
+ Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ env.CURRENT_TAG }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
\ No newline at end of file
From a9d7ab0df65310e115b4e310c298007d0d06cd5b Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:52:47 +0300
Subject: [PATCH 20/28] Update CI
---
.github/workflows/release.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 926a6f8..7bd26b1 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -126,6 +126,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
+ echo "${{ env.RELEASE_URL }}"
- name: Build with pyinstaller for ${{ matrix.TARGET }}
run: ${{ matrix.CMD_BUILD }}
From 51e680aa65aeb3c9d0cb286cfb7b7a41b2c03dd7 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:53:12 +0300
Subject: [PATCH 21/28] Update CI
---
.github/workflows/release.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 7bd26b1..e95bb50 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -2,7 +2,7 @@ name: Release
on:
pull_request:
- branches: [ main ]
+ branches: [ feature/* ]
paths-ignore:
- 'README.md'
- '.gitignore'
From 184bd9e8f456d5a7323f5268935a7bc0499d2b60 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:54:05 +0300
Subject: [PATCH 22/28] Update CI
---
.github/workflows/release.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index e95bb50..6927360 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -1,7 +1,7 @@
name: Release
on:
- pull_request:
+ push:
branches: [ feature/* ]
paths-ignore:
- 'README.md'
From 6a5809fd2fac86c7161677b14d9a73e38e757978 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:55:24 +0300
Subject: [PATCH 23/28] Update CI
---
.github/workflows/release.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 6927360..7bd26b1 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -1,8 +1,8 @@
name: Release
on:
- push:
- branches: [ feature/* ]
+ pull_request:
+ branches: [ main ]
paths-ignore:
- 'README.md'
- '.gitignore'
From 886956f8a088869812a2b7084973336d737d8498 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 13:59:24 +0300
Subject: [PATCH 24/28] Update CI
---
.github/workflows/build.yaml | 1 +
.github/workflows/release.yaml | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index f950f33..1431836 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -83,6 +83,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
+ echo "${{ env.CURRENT_TAG }}"
- name: Build with pyinstaller for ${{ matrix.TARGET }}
run: ${{ matrix.CMD_BUILD }}
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 7bd26b1..01bb77d 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -39,7 +39,7 @@ jobs:
- name: Set tag version to output
id: set_current_tag_id
- run: echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT
+ run: echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_ENV
- name: Notify if failure
if: ${{ failure() }}
From c0f095e7176a6d09fefc5b13dd3038c8e31da23d Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 14:05:56 +0300
Subject: [PATCH 25/28] Update CI
---
.github/workflows/build.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 1431836..58c4713 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -37,7 +37,9 @@ jobs:
- name: Set tag version to output
id: set_current_tag_id
- run: echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_ENV
+ run: |
+ echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}"
+ echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_ENV
- name: Notify if failure
if: ${{ failure() }}
From 49fd1f606e69a6b572a06f4f022abd2366611984 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 14:09:55 +0300
Subject: [PATCH 26/28] Update CI
---
.github/workflows/build.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 58c4713..478af7d 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -41,6 +41,11 @@ jobs:
echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}"
echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_ENV
+ - name: Echo env var
+ run: |
+ echo "${{ env.CURRENT_TAG }}"
+
+
- name: Notify if failure
if: ${{ failure() }}
uses: appleboy/telegram-action@master
From b2c0fa948a6e11382738e7dcc3670afb44dc5752 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 14:17:46 +0300
Subject: [PATCH 27/28] Update CI
---
.github/workflows/build.yaml | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 478af7d..a590d78 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -39,13 +39,12 @@ jobs:
id: set_current_tag_id
run: |
echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}"
- echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_ENV
+ echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT
- name: Echo env var
run: |
echo "${{ env.CURRENT_TAG }}"
-
- name: Notify if failure
if: ${{ failure() }}
uses: appleboy/telegram-action@master
@@ -90,7 +89,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- echo "${{ env.CURRENT_TAG }}"
+ echo "${{ needs.prepare.outputs.CURRENT_TAG }}"
- name: Build with pyinstaller for ${{ matrix.TARGET }}
run: ${{ matrix.CMD_BUILD }}
@@ -132,7 +131,7 @@ jobs:
WorkFlows: ActionsList
- Commit with tag: ${{ env.CURRENT_TAG }}
+ Commit with tag: ${{ needs.prepare.outputs.CURRENT_TAG }}
Repository: ${{ github.repository }}
From 0a1cf75276836654a843c9e519872e5c01fb4466 Mon Sep 17 00:00:00 2001
From: CoolCoderCarl <123qwekir2wl@gmail.com>
Date: Tue, 18 Oct 2022 14:23:35 +0300
Subject: [PATCH 28/28] Update CI
---
.github/workflows/build.yaml | 13 ++++---------
.github/workflows/release.yaml | 15 ++++++++-------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index a590d78..188a052 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -13,6 +13,8 @@ jobs:
prepare:
name: Prepare env & label
runs-on: ubuntu-latest
+ outputs:
+ get_current_tag: ${{ steps.set_current_tag_id.outputs.current_tag }}
steps:
- name: Checkout code
@@ -37,13 +39,7 @@ jobs:
- name: Set tag version to output
id: set_current_tag_id
- run: |
- echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}"
- echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT
-
- - name: Echo env var
- run: |
- echo "${{ env.CURRENT_TAG }}"
+ run: echo "::set-output name=current_tag::${{ steps.tag_version.outputs.new_tag }}"
- name: Notify if failure
if: ${{ failure() }}
@@ -89,7 +85,6 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- echo "${{ needs.prepare.outputs.CURRENT_TAG }}"
- name: Build with pyinstaller for ${{ matrix.TARGET }}
run: ${{ matrix.CMD_BUILD }}
@@ -131,7 +126,7 @@ jobs:
WorkFlows: ActionsList
- Commit with tag: ${{ needs.prepare.outputs.CURRENT_TAG }}
+ Commit with tag: ${{ needs.prepare.outputs.get_current_tag }}
Repository: ${{ github.repository }}
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 01bb77d..da3b597 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -39,7 +39,7 @@ jobs:
- name: Set tag version to output
id: set_current_tag_id
- run: echo "CURRENT_TAG=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_ENV
+ run: echo "::set-output name=current_tag::${{ steps.tag_version.outputs.new_tag }}"
- name: Notify if failure
if: ${{ failure() }}
@@ -57,6 +57,8 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
needs: prepare
+ outputs:
+ get_release_url: ${{ steps.set_release_url.outputs.release_url }}
steps:
- name: Build Changelog
@@ -74,12 +76,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.REPOS_TOKEN }}
with:
tag_name: ${{ needs.prepare.outputs.get_current_tag }}
- release_name: Release ${{ needs.prepare.outputs.CURRENT_TAG }}
+ release_name: Release ${{ needs.prepare.outputs.get_current_tag }}
body: ${{ steps.github_release.outputs.changelog }}
- name: Set Release URL
id: set_release_url
- run: echo "RELEASE_URL=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_ENV
+ run: echo "::set-output name=release_url::${{ steps.create_release.outputs.upload_url }}"
- name: Notify if failure
if: ${{ failure() }}
@@ -126,7 +128,6 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- echo "${{ env.RELEASE_URL }}"
- name: Build with pyinstaller for ${{ matrix.TARGET }}
run: ${{ matrix.CMD_BUILD }}
@@ -144,7 +145,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- upload_url: ${{ env.RELEASE_URL }}
+ upload_url: ${{ needs.release.outputs.get_release_url }}
asset_path: ./dist/${{ matrix.OUT_FILE_NAME }}
asset_name: ${{ matrix.OUT_FILE_NAME }}
asset_content_type: ${{ matrix.ASSET_MIME }}
@@ -179,12 +180,12 @@ jobs:
WorkFlows: ActionsList
- Commit with tag: ${{ env.CURRENT_TAG }}
+ Commit with tag: ${{ needs.prepare.outputs.get_current_tag }}
Repository: ${{ github.repository }}
Branch: ${{ github.ref }}
- Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ env.CURRENT_TAG }}
+ Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ needs.prepare.outputs.get_current_tag }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
\ No newline at end of file