diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c58ce4..6f5588f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,17 @@ jobs: runCIsInMultipleProject: runs-on: ubuntu-latest steps: + # Step 1: Checkout the code - uses: actions/checkout@v3 + + # Step 2: Set up Golang - uses: actions/setup-go@v4 with: go-version: '>=1.17.0' + # Step 3: Set up Python + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + # Step 4: Run the combined script - run: bash run-ci.sh \ No newline at end of file diff --git a/advent_of_code/2024(python)/__init__.py b/advent_of_code/2024(python)/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/advent_of_code/2024(python)/day1.py b/advent_of_code/2024(python)/day1.py new file mode 100644 index 0000000..a672512 --- /dev/null +++ b/advent_of_code/2024(python)/day1.py @@ -0,0 +1,3 @@ + +def add(a:int, b:int) -> int : + return a+b \ No newline at end of file diff --git a/advent_of_code/2024(python)/test_day1.py b/advent_of_code/2024(python)/test_day1.py new file mode 100644 index 0000000..9249832 --- /dev/null +++ b/advent_of_code/2024(python)/test_day1.py @@ -0,0 +1,11 @@ +import unittest + +from day1 import add + +class TestSample(unittest.TestCase): + + def test_add(self): + self.assertEqual(add(2,4), 6) + +if __name__ == "__main__": + unittest.main() diff --git a/run-ci.sh b/run-ci.sh index 56f25bb..dfa7f9c 100644 --- a/run-ci.sh +++ b/run-ci.sh @@ -1 +1,24 @@ -cd advent_of_code && cd 2021 && go test && cd ../2022 && go test && cd ../2023 && go test \ No newline at end of file +cd advent_of_code + +# For solutions with go +dir_go_list="2021 2022 2023 2024" +for dir in $dir_go_list; do + if [ -d "$dir" ]; then + echo "Entering directory: $dir" + cd "$dir" || exit 1 + + if go test ; then + echo "Tests passed in $dir" + else + echo "Tests failed in $dir" + fi + + cd .. + fi +done + +# For solutions with Python +# may need to use another list for python folders next year +echo "==entering Python solution folder==" +cd "2024(python)" +python -m unittest discover \ No newline at end of file