From 065352c8be51204d5b44e1149bd4cad11fe4a337 Mon Sep 17 00:00:00 2001 From: Jeremy Brent Date: Wed, 25 Sep 2024 23:15:59 -0400 Subject: [PATCH 1/6] added github action --- .github/workflows/unittest.yml | 26 ++++++++++++++++++++++++++ .python-version | 1 + 2 files changed, 27 insertions(+) create mode 100644 .github/workflows/unittest.yml create mode 100644 .python-version diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 0000000..49b6812 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,26 @@ +name: Submodule Unittests +run-name: Automated Github action for Unittests - ${{ github.actor }} +on: + pull_request +jobs: + unittests: + runs-on: self-hosted + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server in ${{ runner.workspace}}!" + + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: '.python-version' + + - name: Install dependencies + run: | + pip install -r requirements.txt + + - name: Run tests + run: | + python -m unittest discover -s tests \ No newline at end of file diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..4328eab --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.9.13 \ No newline at end of file From 24d1904f982cd09e306aedabff7d47aa4bfa1824 Mon Sep 17 00:00:00 2001 From: Jeremy Brent Date: Wed, 25 Sep 2024 23:17:53 -0400 Subject: [PATCH 2/6] fixed runs on --- .github/workflows/unittest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 49b6812..bd3b9a6 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -4,7 +4,7 @@ on: pull_request jobs: unittests: - runs-on: self-hosted + runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server in ${{ runner.workspace}}!" From 293f8e27c1e76c1c83d0a5ba31f06312101e9d77 Mon Sep 17 00:00:00 2001 From: Jeremy Brent Date: Wed, 25 Sep 2024 23:29:11 -0400 Subject: [PATCH 3/6] fixed timezone issue --- src/utils.py | 5 +++-- tests/test_utils.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils.py b/src/utils.py index c35abf6..91c8e09 100644 --- a/src/utils.py +++ b/src/utils.py @@ -1,5 +1,6 @@ import datetime as dt from src.consts import DATE_FORMAT +from zoneinfo import ZoneInfo class Utils: @@ -14,8 +15,8 @@ def convert_datetime(timestamp: int) -> tuple[str, str]: :param timestamp: :return: """ - # Convert to datetime object - original_date = dt.datetime.fromtimestamp(timestamp) + # Ensure datetime is in NY Timezone bc that's were the NYSE is located + original_date = dt.datetime.fromtimestamp(timestamp, tz=ZoneInfo("America/New_York")) dt_object = original_date # Define 4 PM as the time to compare against diff --git a/tests/test_utils.py b/tests/test_utils.py index 3085a1d..a3e9353 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -19,4 +19,4 @@ def test_convert_datetime(self): for input, expected_data in test_data.items(): actual_output = self.utils.convert_datetime(input) - self.assertEqual(actual_output, expected_data) \ No newline at end of file + self.assertEqual(actual_output, expected_data) From a7c4ef16d1cf67270533529e1712872e43b012c4 Mon Sep 17 00:00:00 2001 From: Jeremy Brent Date: Wed, 25 Sep 2024 23:33:01 -0400 Subject: [PATCH 4/6] updated readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 186a966..c08adee 100644 --- a/README.md +++ b/README.md @@ -67,3 +67,12 @@ Any new models should be replicated based on existing research found We should also implement a more sophisticated metric for measuring the performance of the FSA models. Currently, we are only using a raw accuracy. + +# The Code Base +Given the timeframe of the project, I put together a small, end-to-end project. Some of these end +to end features include unittests, CICD with Github actions, and environment creation with Make and +requirements.txt. + +With more time, some things I would build upon would be, +expanding unittest portfolio would need to build out, and further developing the Github actions +if we were deploying this model as a service \ No newline at end of file From d534e2e564a095fe500b9c4806c6530a476703a6 Mon Sep 17 00:00:00 2001 From: Jeremy Brent Date: Wed, 25 Sep 2024 23:33:44 -0400 Subject: [PATCH 5/6] updated workflow name --- .github/workflows/unittest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index bd3b9a6..f55342c 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -1,4 +1,4 @@ -name: Submodule Unittests +name: Unittests run-name: Automated Github action for Unittests - ${{ github.actor }} on: pull_request From db02c647a96c24bd38640ada6ecc1fb7fede1cdf Mon Sep 17 00:00:00 2001 From: Jeremy Brent Date: Wed, 25 Sep 2024 23:35:12 -0400 Subject: [PATCH 6/6] updated readme --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c08adee..89a8b1f 100644 --- a/README.md +++ b/README.md @@ -70,8 +70,10 @@ measuring the performance of the FSA models. Currently, we are only using a raw # The Code Base Given the timeframe of the project, I put together a small, end-to-end project. Some of these end -to end features include unittests, CICD with Github actions, and environment creation with Make and -requirements.txt. +to end features include unittests, CICD with Github actions, environment creation with Make and +requirements.txt, and github branch protection rules found +[here](https://github.com/JeremyBrent/stock_market_analyzer/settings/branch_protection_rules/54816872) +which require 1. PRs and 2. passing Github actions in order to update the main branch. With more time, some things I would build upon would be, expanding unittest portfolio would need to build out, and further developing the Github actions