Repository navigation
Decision Agent CI/CD ⚖️🤔💡 - Bulletproof Logic Gates! 🧠🔩 #76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # filename: .github/workflows/test_decision_agent.yml | |
| # Path: .github/workflows/test_decision_agent.yml | |
| name: Decision Agent CI/CD ⚖️🤔💡 - Bulletproof Logic Gates! 🧠🔩 | |
| # Controls when the workflow will run | |
| on: | |
| # Triggers the workflow on push or pull request events | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'decision_agent.py' | |
| - 'test_decision_agent.py' | |
| - 'requirements.txt' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'decision_agent.py' | |
| - 'test_decision_agent.py' | |
| - 'requirements.txt' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Schedule the workflow to run daily at a specific time | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| # This job runs linters and tests for the DecisionAgent | |
| build-and-test: | |
| strategy: | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository Code Base! 📥 | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} Environment 🏗️ | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache Python dependencies for Speed ⚡ | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-python-${{ matrix.python-version }}- | |
| - name: Install Dependencies including Formatters & Linters 🛠️📦 | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black isort flake8 pytest pytest-cov pytest-html pytest-asyncio | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Check Code Formatting with Black and isort ✨🎨 | |
| run: | | |
| black --check . | |
| isort --check-only . | |
| - name: Run Flake8 Code Linter (Non-Blocking) 🧐 | |
| run: | | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics | |
| - name: Execute Pytest Tests with Coverage & HTML Report 🏆📄 | |
| run: | | |
| # The --cov flag is updated for the decision_agent | |
| python -m pytest -v --cov=decision_agent --cov-report=xml --html=report.html --self-contained-html | |
| - name: Upload Coverage Report Artifact 📤📊 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report-py${{ matrix.python-version }} | |
| path: coverage.xml | |
| if-no-files-found: ignore | |
| - name: Upload HTML Test Report Artifact 📤📜 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: html-test-report-py${{ matrix.python-version }} | |
| path: report.html | |
| if-no-files-found: ignore |