From b0bcc2e35ac448aef70efd9990ebcb175dd61c82 Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Fri, 2 May 2025 23:41:16 -0700 Subject: [PATCH 01/10] Added day 01 --- 2024/day_01.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 2024/day_01.py diff --git a/2024/day_01.py b/2024/day_01.py new file mode 100644 index 0000000..57362f0 --- /dev/null +++ b/2024/day_01.py @@ -0,0 +1 @@ +# Day 01 From 6d5719b291e6a4843806d200d9ab1e91de09a71d Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Tue, 6 May 2025 20:47:28 -0700 Subject: [PATCH 02/10] Adding test files for CI Pipeline and a requirements file --- 2024/test_day/__init__.py | 0 2024/test_day/dayXX.py | 13 ++++++++++ 2024/test_day/test_dayXX.py | 12 ++++++++++ requirements.txt | 47 +++++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 2024/test_day/__init__.py create mode 100644 2024/test_day/dayXX.py create mode 100644 2024/test_day/test_dayXX.py create mode 100644 requirements.txt diff --git a/2024/test_day/__init__.py b/2024/test_day/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/2024/test_day/dayXX.py b/2024/test_day/dayXX.py new file mode 100644 index 0000000..a309e5a --- /dev/null +++ b/2024/test_day/dayXX.py @@ -0,0 +1,13 @@ +# Day XX Test for Setting Up CI Pipeline + +def solve_part1(a, b): + return (a ** b) - (b ** a) + +def solve_part2(a, b): + return (a + b) // (b - a) + +arg_1 = 2 +arg_2 = 5 + +print(solve_part1(arg_1, arg_2)) +print(solve_part2(arg_1, arg_2)) diff --git a/2024/test_day/test_dayXX.py b/2024/test_day/test_dayXX.py new file mode 100644 index 0000000..cc8a6d5 --- /dev/null +++ b/2024/test_day/test_dayXX.py @@ -0,0 +1,12 @@ +from .dayXX import solve_part1, solve_part2 + +EXAMPLE_ARG_1 = 2 +EXAMPLE_ARG_2 = 5 + +def test_dayXX_part1(): + """Test Day XX Part 1 with example inputs.""" + assert solve_part1(EXAMPLE_ARG_1, EXAMPLE_ARG_2) == 7 + +def test_dayXX_part2(): + """Test Day XX Part 2 with example inputs.""" + assert solve_part2(EXAMPLE_ARG_1, EXAMPLE_ARG_2) == 2 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0fc7349 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,47 @@ +beautifulsoup4==4.13.4 +black==25.1.0 +certifi==2025.4.26 +cffi==1.17.1 +charset-normalizer==3.4.2 +click==8.1.8 +colorama==0.4.6 +contourpy==1.3.2 +curl_cffi==0.10.0 +cycler==0.12.1 +DateTime==5.5 +eventregistry==9.1 +flake8==7.2.0 +fonttools==4.57.0 +frozendict==2.4.6 +idna==3.10 +iniconfig==2.1.0 +kiwisolver==1.4.8 +matplotlib==3.10.1 +mccabe==0.7.0 +mplcursors==0.6 +multitasking==0.0.11 +mypy_extensions==1.1.0 +numpy==2.2.5 +packaging==25.0 +pandas==2.2.3 +pathspec==0.12.1 +peewee==3.18.1 +pillow==11.2.1 +platformdirs==4.3.7 +pluggy==1.5.0 +pycodestyle==2.13.0 +pycparser==2.22 +pyflakes==3.3.2 +pyparsing==3.2.3 +pytest==8.3.5 +python-dateutil==2.9.0.post0 +pytz==2025.2 +requests==2.32.3 +setuptools==80.2.0 +six==1.17.0 +soupsieve==2.7 +typing_extensions==4.13.2 +tzdata==2025.2 +urllib3==2.4.0 +yfinance==0.2.58 +zope.interface==7.2 From 34f1fc4b8aeb45df58bb53d89a51d41cd1f22426 Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Tue, 6 May 2025 21:01:36 -0700 Subject: [PATCH 03/10] Added GitHub Actions CI workflow --- .github/workflows/python_ci.yml | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/python_ci.yml diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml new file mode 100644 index 0000000..725a44f --- /dev/null +++ b/.github/workflows/python_ci.yml @@ -0,0 +1,36 @@ +name: Python CI + +# When should the workflow run +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +# Define the jobs to run +jobs: + build-and-test: + runs-on: ubuntu-latest + + # Steps to run inside a job + steps: + - name: 4.1 Checkout code + uses: actions/checkout@v4 + + - name: 4.2 Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: 4.3 Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: 4.4 Run linters + run: | + flake8 2024/ --count --select=E9,F63,F7, F82 --show-source --statistics + + - name: 4.5 Run tests + run: | + pytest 2024/ From 9a679754377709ad0722db4f375e79d34c55abaf Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Tue, 6 May 2025 21:07:02 -0700 Subject: [PATCH 04/10] Fix YAML indentation error --- .github/workflows/python_ci.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 725a44f..c852574 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -10,27 +10,27 @@ on: # Define the jobs to run jobs: build-and-test: - runs-on: ubuntu-latest + runs-on: ubuntu-latest # Steps to run inside a job - steps: - - name: 4.1 Checkout code - uses: actions/checkout@v4 + steps: + - name: 4.1 Checkout code + uses: actions/checkout@v4 - - name: 4.2 Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' + - name: 4.2 Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' - - name: 4.3 Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + - name: 4.3 Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt - - name: 4.4 Run linters - run: | + - name: 4.4 Run linters + run: | flake8 2024/ --count --select=E9,F63,F7, F82 --show-source --statistics - - name: 4.5 Run tests - run: | + - name: 4.5 Run tests + run: | pytest 2024/ From ad4e2e20e05c47ac3e92208d6408c9c77ab08ec0 Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Tue, 6 May 2025 21:11:26 -0700 Subject: [PATCH 05/10] Added '2024/Day01' branch to YAML file --- .github/workflows/python_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index c852574..baf06b6 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -3,7 +3,7 @@ name: Python CI # When should the workflow run on: push: - branches: [ main, master ] + branches: [ main, master, 2024/Day01 ] pull_request: branches: [ main, master ] From 807c968d2975762aed3133ce3f98953cfafe881a Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Tue, 6 May 2025 21:13:50 -0700 Subject: [PATCH 06/10] Fixed 4.4 Run linters section (extra space) --- .github/workflows/python_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index baf06b6..38fcd42 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -29,7 +29,7 @@ jobs: - name: 4.4 Run linters run: | - flake8 2024/ --count --select=E9,F63,F7, F82 --show-source --statistics + flake8 2024/ --count --select=E9,F63,F7,F82 --show-source --statistics - name: 4.5 Run tests run: | From 5a743270bce829dd24ae08c9ff32e5832648f328 Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Thu, 8 May 2025 19:39:10 -0700 Subject: [PATCH 07/10] Added solve_part3() concurrently with its test function; TDD --- 2024/test_day/test_dayXX.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/2024/test_day/test_dayXX.py b/2024/test_day/test_dayXX.py index cc8a6d5..642193e 100644 --- a/2024/test_day/test_dayXX.py +++ b/2024/test_day/test_dayXX.py @@ -10,3 +10,7 @@ def test_dayXX_part1(): def test_dayXX_part2(): """Test Day XX Part 2 with example inputs.""" assert solve_part2(EXAMPLE_ARG_1, EXAMPLE_ARG_2) == 2 + +def test_dayXX_part3(): + """Test Day XX Part 3 with example inputs.""" + assert solve_part3(EXAMPLE_ARG_1, EXAMPLE_ARG_2) == 7 From 20d73df485dc52cda253cd06f8d48182617e289d Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Thu, 8 May 2025 19:43:50 -0700 Subject: [PATCH 08/10] Forgot to add solve_part3 to testing file import --- 2024/test_day/test_dayXX.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2024/test_day/test_dayXX.py b/2024/test_day/test_dayXX.py index 642193e..ba638cf 100644 --- a/2024/test_day/test_dayXX.py +++ b/2024/test_day/test_dayXX.py @@ -1,4 +1,4 @@ -from .dayXX import solve_part1, solve_part2 +from .dayXX import solve_part1, solve_part2, solve_part3 EXAMPLE_ARG_1 = 2 EXAMPLE_ARG_2 = 5 From d9db5c71908cd504a9355b1c45ed39e84da263bc Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Thu, 8 May 2025 19:58:33 -0700 Subject: [PATCH 09/10] Attempted fixing pytest not running, added file and directory verification --- .github/workflows/python_ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 38fcd42..be6ee74 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -33,4 +33,6 @@ jobs: - name: 4.5 Run tests run: | - pytest 2024/ + pwd + ls 2024/ + pytest 2024/ -v From ba2055245a3cda7077a7578babb05693cb60a50f Mon Sep 17 00:00:00 2001 From: Anthony Toro Date: Thu, 8 May 2025 20:03:07 -0700 Subject: [PATCH 10/10] I forgot to write changes to dayXX.py; Fixed --- .github/workflows/python_ci.yml | 4 +--- 2024/test_day/dayXX.py | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index be6ee74..38fcd42 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -33,6 +33,4 @@ jobs: - name: 4.5 Run tests run: | - pwd - ls 2024/ - pytest 2024/ -v + pytest 2024/ diff --git a/2024/test_day/dayXX.py b/2024/test_day/dayXX.py index a309e5a..ecd92df 100644 --- a/2024/test_day/dayXX.py +++ b/2024/test_day/dayXX.py @@ -6,6 +6,9 @@ def solve_part1(a, b): def solve_part2(a, b): return (a + b) // (b - a) +def solve_part3(a, b): + return (a * b) + (a - b) + arg_1 = 2 arg_2 = 5