From e527dcda69ed4c94d329eadb72f4dedc6cca88ee Mon Sep 17 00:00:00 2001 From: tonygill649 Date: Mon, 4 May 2026 10:55:46 -0700 Subject: [PATCH 1/2] Update testsPython.yml --- .github/workflows/testsPython.yml | 146 +++++++++++++++++++++++++++--- 1 file changed, 134 insertions(+), 12 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index 452f71d..bcf63d9 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -1,79 +1,201 @@ ############################################################################### + # Workflow: Python Unit Tests + # + # Purpose: + # Runs Python unit tests automatically on pull requests and pushes to main/next. + # + # Triggers: + # - On push to main or next branches (Python files only) + # - On pull requests affecting Python files + # - Manual dispatch + # + # Key Steps: + # 1. Checkout repository code + # 2. Set up Python environment using a custom action + # 3. Run unit tests and report results + # + # Notes: + # - secrets are set in https://github.com/smarter-sh/smarter/settings/secrets/actions + # - Integrates with Codecov for coverage reporting + ############################################################################### -name: Python Unit Tests +name: Python Unit Tests + on: + workflow_dispatch: # Allows the workflow to be manually triggered from the GitHub Actions tab + pull_request: # + paths: # Trigger workflow on pull requests, but + - "**.py" # only if Python files are changed + push: + branches: # + - main # + - next # Trigger workflow on pushes to main and next + paths: # branches, but only if Python files are changed - - "**.py" # + - "**.py" # + env: - python-version: "3.13" + 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 + steps: + - name: Checkout code + id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v6 + - name: Run Python tests + uses: ./.github/actions/tests/python + with: + environment: "local" + python-version: "${{ env.python-version}}" + openai-api-organization: "${{ secrets.OPENAI_API_ORGANIZATION }}" + openai-api-key: "${{ secrets.OPENAI_API_KEY }}" + mysql-host: "${{ secrets.MYSQL_HOST }}" + mysql-port: "${{ secrets.MYSQL_PORT }}" + mysql-user: "${{ secrets.MYSQL_USER }}" + mysql-password: "${{ secrets.MYSQL_PASSWORD }}" + mysql-database: "${{ secrets.MYSQL_DATABASE }}" + mysql-charset: "${{ secrets.MYSQL_CHARSET }}" - codecov-token: "${{ secrets.CODECOV_TOKEN }}" + 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. + + # notifications: + + # needs: python-unit-tests + + # runs-on: ubuntu-latest + + # steps: + + # - name: Notify on test results + + # run: | + + # if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then + + # echo "success notifications go here" + + # else + + # echo "failure notifications go here" + + # fi + + # Job #2a: Notifications (Mini-capstone assignment solution) + + # This job will run after the Python unit tests and + + # is scaffolded to facilitate sending notifications based + + # on the test results, especially the new *Failure notification. + notifications: + needs: python-unit-tests + runs-on: ubuntu-latest + + if: always() # ensures this job runs even if tests fail + steps: - - name: Notify on test results - run: | - if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - echo "success notifications go here" - else - echo "failure notifications go here" - fi + + - name: Send email on failure + + if: ${{ needs.python-unit-tests.result != 'success' }} + + uses: dawidd6/action-send-mail@v3 + + with: + + server_address: ${{ secrets.SMTP_SERVER }} + + server_port: ${{ secrets.SMTP_PORT }} + + username: ${{ secrets.EMAIL_USERNAME }} + + password: ${{ secrets.EMAIL_PASSWORD }} + + subject: "❌ Unit Tests Failed" + + body: | + + Your GitHub Actions workflow has failed. + + Repository: ${{ github.repository }} + + Branch: ${{ github.ref_name }} + + Commit: ${{ github.sha }} + + Check details here: +https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + + to: ${{ secrets.EMAIL_TO }} + + from: GitHub Actions + From b202e6e1cafe66ff0527c85f23725f1cdb7a991d Mon Sep 17 00:00:00 2001 From: tonygill649 Date: Mon, 4 May 2026 11:03:59 -0700 Subject: [PATCH 2/2] Update testsPython.yml --- .github/workflows/testsPython.yml | 111 +++--------------------------- 1 file changed, 10 insertions(+), 101 deletions(-) diff --git a/.github/workflows/testsPython.yml b/.github/workflows/testsPython.yml index bcf63d9..fbf4405 100644 --- a/.github/workflows/testsPython.yml +++ b/.github/workflows/testsPython.yml @@ -1,201 +1,110 @@ ############################################################################### - # Workflow: Python Unit Tests - # - # Purpose: - # Runs Python unit tests automatically on pull requests and pushes to main/next. - # - # Triggers: - # - On push to main or next branches (Python files only) - # - On pull requests affecting Python files - # - Manual dispatch - # - # Key Steps: - # 1. Checkout repository code - # 2. Set up Python environment using a custom action - # 3. Run unit tests and report results - # - # Notes: - # - secrets are set in https://github.com/smarter-sh/smarter/settings/secrets/actions - # - Integrates with Codecov for coverage reporting - ############################################################################### - name: Python Unit Tests - -on: +on: workflow_dispatch: # Allows the workflow to be manually triggered from the GitHub Actions tab - pull_request: # - paths: # Trigger workflow on pull requests, but - - "**.py" # only if Python files are changed - push: - branches: # - - main # - - next # Trigger workflow on pushes to main and next - paths: # branches, but only if Python files are changed - - "**.py" # - -env: +env: python-version: "3.13" - -jobs: +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 - steps: - - name: Checkout code - id: checkout - uses: actions/checkout@v6 - - - name: Run Python tests + - name: Run Python tests uses: ./.github/actions/tests/python - with: - environment: "local" - python-version: "${{ env.python-version}}" - openai-api-organization: "${{ secrets.OPENAI_API_ORGANIZATION }}" - openai-api-key: "${{ secrets.OPENAI_API_KEY }}" - mysql-host: "${{ secrets.MYSQL_HOST }}" - mysql-port: "${{ secrets.MYSQL_PORT }}" - mysql-user: "${{ secrets.MYSQL_USER }}" - mysql-password: "${{ secrets.MYSQL_PASSWORD }}" - mysql-database: "${{ secrets.MYSQL_DATABASE }}" - mysql-charset: "${{ secrets.MYSQL_CHARSET }}" - codecov-token: "${{ secrets.CODECOV_TOKEN }}" - - # Job #2: Notifications (Mini-capstone assignment) + # 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. - # notifications: - # needs: python-unit-tests - # runs-on: ubuntu-latest - # steps: - # - name: Notify on test results - # run: | - # if [ "${{ needs.python-unit-tests.result }}" == "success" ]; then - # echo "success notifications go here" - # else - # echo "failure notifications go here" - # fi - - # Job #2a: Notifications (Mini-capstone assignment solution) + # Job #2a: Notifications (Mini-capstone assignment solution) # This job will run after the Python unit tests and - # is scaffolded to facilitate sending notifications based - # on the test results, especially the new *Failure notification. - notifications: - needs: python-unit-tests - runs-on: ubuntu-latest - if: always() # ensures this job runs even if tests fail - - steps: + steps: - name: Send email on failure - if: ${{ needs.python-unit-tests.result != 'success' }} - uses: dawidd6/action-send-mail@v3 - with: - server_address: ${{ secrets.SMTP_SERVER }} - server_port: ${{ secrets.SMTP_PORT }} - username: ${{ secrets.EMAIL_USERNAME }} - password: ${{ secrets.EMAIL_PASSWORD }} - subject: "❌ Unit Tests Failed" - body: | - Your GitHub Actions workflow has failed. - - Repository: ${{ github.repository }} + Repository: ${{ github.repository }} Branch: ${{ github.ref_name }} - Commit: ${{ github.sha }} - - Check details here: -https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + Check details here: + https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} to: ${{ secrets.EMAIL_TO }} - from: GitHub Actions -