From cbaa344c74a80df03421e6763a87674360ca8633 Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Thu, 23 Apr 2026 21:53:38 -0400 Subject: [PATCH 1/9] Added failure notifications --- .github/workflows/testsPython.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 452f71d..0525372 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -73,7 +73,13 @@ jobs: - name: Notify on test results run: | if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "success notifications go here" + echo "Tests passed successfully" else - echo "failure notifications go here" + echo "TESTS FAILED" + echo "Repository: ${{ github.repository }}" + echo "Triggered by: ${{ github.actor }}" + echo "Commit: ${{ github.sha }}" + echo "Check logs: https://github.com/${{ github.repository }}/actions" + exit 1 fi + From 30e0d54e9b1bd5b7488a95b9ae0046fd6a2a841e Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Thu, 23 Apr 2026 22:14:33 -0400 Subject: [PATCH 2/9] force failure using const.py~ --- app/tests/const.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/tests/const.py b/app/tests/const.py index 286cd1c..14ca4b7 100644 --- a/app/tests/const.py +++ b/app/tests/const.py @@ -14,3 +14,4 @@ sys.path.append(PYTHON_ROOT) # noqa: E402 __all__ = ["HERE", "PROJECT_ROOT", "PYTHON_ROOT"] +this will break From 763d7f7dad931ce4644c0a6fd274d00c13ae903f Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Thu, 23 Apr 2026 22:26:30 -0400 Subject: [PATCH 3/9] restore file after testing failure --- app/tests/const.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/tests/const.py b/app/tests/const.py index 14ca4b7..84bc8a9 100644 --- a/app/tests/const.py +++ b/app/tests/const.py @@ -13,5 +13,4 @@ if PYTHON_ROOT not in sys.path: sys.path.append(PYTHON_ROOT) # noqa: E402 -__all__ = ["HERE", "PROJECT_ROOT", "PYTHON_ROOT"] -this will break +__all__ = ["HERE", "PROJECT_ROOT", "PYTHON_ROOT"] \ No newline at end of file From 67a42324e7ce85d5c7049af9bffa94cf26c97437 Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Sat, 25 Apr 2026 07:53:35 -0400 Subject: [PATCH 4/9] fix notification condition --- .github/workflows/testsPython.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 0525372..cc41d56 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -69,6 +69,7 @@ jobs: notifications: needs: python-unit-tests runs-on: ubuntu-latest + if: always() && (needs.python-unit-tests.result == 'success' || needs.python-unit-tests.result == 'failure') steps: - name: Notify on test results run: | From 58af6ed2ea695fdeddef9c30dc54bec171198a6c Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Tue, 28 Apr 2026 19:46:21 -0400 Subject: [PATCH 5/9] Add failure notification to workflow --- .github/workflows/testsPython.yml | 28 +++++++++++--------------- Lab03/request.json | 33 +++++++++++++++++++++++++++++++ Lab03/weather.py | 11 +++++++++++ 3 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 Lab03/request.json create mode 100644 Lab03/weather.py diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index cc41d56..2c3074e 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -67,20 +67,16 @@ jobs: # is scaffolded to facilitate sending notifications based # on the test results. notifications: - needs: python-unit-tests - runs-on: ubuntu-latest - if: always() && (needs.python-unit-tests.result == 'success' || needs.python-unit-tests.result == 'failure') - steps: - - name: Notify on test results - run: | - if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "Tests passed successfully" - else - echo "TESTS FAILED" - echo "Repository: ${{ github.repository }}" - echo "Triggered by: ${{ github.actor }}" - echo "Commit: ${{ github.sha }}" - echo "Check logs: https://github.com/${{ github.repository }}/actions" - exit 1 - fi + needs: python-unit-tests + runs-on: ubuntu-latest + if: ${{ failure() }} + + steps: + - name: Notify on failure + run: | + echo "TESTS FAILED 🚨" + echo "Repository: ${{ github.repository }}" + echo "Triggered by: ${{ github.actor }}" + echo "Commit: ${{ github.sha }}" + echo "Check logs: https://github.com/${{ github.repository }}/actions" diff --git a/Lab03/request.json b/Lab03/request.json new file mode 100644 index 0000000..8831b41 --- /dev/null +++ b/Lab03/request.json @@ -0,0 +1,33 @@ +{ + "model": "gpt-4-turbo", + "temperature": 0.5, + "max_tokens": 1024, + "messages": [ + { "role": "system", "content": "You are a helpful travel assistant." }, + { "role": "user", "content": "I am traveling to Vancouver tomorrow. What should I pack?" } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "get_weather", + "description": "Retrieve the current weather for a given location.", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "Name of the city" + }, + "unit": { + "type": "string", + "enum": ["celsius", "fahrenheit"] + } + }, + "required": ["location"] + } + } + } + ], + "tool_choice": "auto" +} \ No newline at end of file diff --git a/Lab03/weather.py b/Lab03/weather.py new file mode 100644 index 0000000..5463c0b --- /dev/null +++ b/Lab03/weather.py @@ -0,0 +1,11 @@ +import json + +def get_weather(location: str, unit: str = "celsius"): + dummy_data = { + "Vancouver": {"celsius": "8°C", "fahrenheit": "46°F"}, + "Paris": {"celsius": "12°C", "fahrenheit": "54°F"} + } + return dummy_data.get(location, {"celsius": "N/A", "fahrenheit": "N/A"})[unit] + +result = get_weather("Vancouver", "celsius") +print(json.dumps({"celsius": result})) \ No newline at end of file From b2911c3992b166a7f98a1e890bd508d26b3a2289 Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Tue, 28 Apr 2026 19:57:04 -0400 Subject: [PATCH 6/9] Fix duplicate jobs block --- .github/workflows/testsPython.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 2c3074e..8db2555 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -66,17 +66,21 @@ jobs: # This job will run after the Python unit tests and # is scaffolded to facilitate sending notifications based # on the test results. + python-unit-tests: + runs-on: ubuntu-latest + steps: + # your existing test steps... + notifications: - needs: python-unit-tests - runs-on: ubuntu-latest - if: ${{ failure() }} + needs: python-unit-tests + runs-on: ubuntu-latest + if: ${{ failure() }} - steps: - - name: Notify on failure - run: | - echo "TESTS FAILED 🚨" - echo "Repository: ${{ github.repository }}" - echo "Triggered by: ${{ github.actor }}" - echo "Commit: ${{ github.sha }}" - echo "Check logs: https://github.com/${{ github.repository }}/actions" - + steps: + - name: Notify on failure + run: | + echo "TESTS FAILED 🚨" + echo "Repository: ${{ github.repository }}" + echo "Triggered by: ${{ github.actor }}" + echo "Commit: ${{ github.sha }}" + echo "Check logs: https://github.com/${{ github.repository }}/actions" \ No newline at end of file From 4ded7f65fb44a8a3355be98544c40127ca2c3f89 Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Tue, 28 Apr 2026 20:02:35 -0400 Subject: [PATCH 7/9] Remove duplicate job and fix notifications --- .github/workflows/testsPython.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 8db2555..d637007 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -36,12 +36,8 @@ env: python-version: "3.13" jobs: - # Job #1: Run Python unit tests - # - # This job will run on an Ubuntu runner and execute the Python - # tests by using a custom action located in ./.github/actions/tests/python. python-unit-tests: - runs-on: ubuntu-latest # the runner (remote machine) will use Ubuntu OS + runs-on: ubuntu-latest steps: - name: Checkout code id: checkout @@ -62,15 +58,6 @@ jobs: mysql-charset: "${{ secrets.MYSQL_CHARSET }}" codecov-token: "${{ secrets.CODECOV_TOKEN }}" - # Job #2: Notifications (Mini-capstone assignment) - # This job will run after the Python unit tests and - # is scaffolded to facilitate sending notifications based - # on the test results. - python-unit-tests: - runs-on: ubuntu-latest - steps: - # your existing test steps... - notifications: needs: python-unit-tests runs-on: ubuntu-latest From 7f4552be45f9eeaacfe70b866a047804ab5ef799 Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Mon, 4 May 2026 19:36:54 -0400 Subject: [PATCH 8/9] Add notifications for success and failure --- .github/workflows/testsPython.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index d637007..c249b1c 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -59,15 +59,22 @@ jobs: codecov-token: "${{ secrets.CODECOV_TOKEN }}" notifications: - needs: python-unit-tests - runs-on: ubuntu-latest - if: ${{ failure() }} + needs: python-unit-tests + runs-on: ubuntu-latest - steps: - - name: Notify on failure - run: | - echo "TESTS FAILED 🚨" + steps: + - name: Notify on test results + run: | + if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then + echo "TESTS PASSED" + echo "Repository: ${{ github.repository }}" + echo "Triggered by: ${{ github.actor }}" + echo "Commit: ${{ github.sha }}" + echo "Check logs: https://github.com/${{ github.repository }}/actions" + else + echo "TESTS FAILED" echo "Repository: ${{ github.repository }}" echo "Triggered by: ${{ github.actor }}" echo "Commit: ${{ github.sha }}" - echo "Check logs: https://github.com/${{ github.repository }}/actions" \ No newline at end of file + echo "Check logs: https://github.com/${{ github.repository }}/actions" + fi \ No newline at end of file From 30d12f1e8ddf657de6653cf79eb7d9d7591f07ec Mon Sep 17 00:00:00 2001 From: Yaaita01 Date: Mon, 4 May 2026 19:47:54 -0400 Subject: [PATCH 9/9] Fix notifications job placement --- .github/workflows/testsPython.yml | 42 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index c249b1c..3b74d73 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -58,23 +58,29 @@ jobs: mysql-charset: "${{ secrets.MYSQL_CHARSET }}" codecov-token: "${{ secrets.CODECOV_TOKEN }}" + jobs: + python-unit-tests: + runs-on: ubuntu-latest + steps: + # your test steps here... + notifications: - needs: python-unit-tests - runs-on: ubuntu-latest + needs: python-unit-tests + runs-on: ubuntu-latest - steps: - - name: Notify on test results - run: | - if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "TESTS PASSED" - echo "Repository: ${{ github.repository }}" - echo "Triggered by: ${{ github.actor }}" - echo "Commit: ${{ github.sha }}" - echo "Check logs: https://github.com/${{ github.repository }}/actions" - else - echo "TESTS FAILED" - echo "Repository: ${{ github.repository }}" - echo "Triggered by: ${{ github.actor }}" - echo "Commit: ${{ github.sha }}" - echo "Check logs: https://github.com/${{ github.repository }}/actions" - fi \ No newline at end of file + steps: + - name: Notify on test results + run: | + if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then + echo "TESTS PASSED" + echo "Repository: ${{ github.repository }}" + echo "Triggered by: ${{ github.actor }}" + echo "Commit: ${{ github.sha }}" + echo "Check logs: https://github.com/${{ github.repository }}/actions" + else + echo "TESTS FAILED" + echo "Repository: ${{ github.repository }}" + echo "Triggered by: ${{ github.actor }}" + echo "Commit: ${{ github.sha }}" + echo "Check logs: https://github.com/${{ github.repository }}/actions" + fi \ No newline at end of file