diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml new file mode 100644 index 0000000..38fcd42 --- /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, 2024/Day01 ] + 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/ 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 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..ecd92df --- /dev/null +++ b/2024/test_day/dayXX.py @@ -0,0 +1,16 @@ +# 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) + +def solve_part3(a, b): + return (a * b) + (a - b) + +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..ba638cf --- /dev/null +++ b/2024/test_day/test_dayXX.py @@ -0,0 +1,16 @@ +from .dayXX import solve_part1, solve_part2, solve_part3 + +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 + +def test_dayXX_part3(): + """Test Day XX Part 3 with example inputs.""" + assert solve_part3(EXAMPLE_ARG_1, EXAMPLE_ARG_2) == 7 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