Add fork welcome automation and contributor email script #254
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
| name: Cortex Automation | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov pytest-mock | |
| - name: Run tests | |
| run: | | |
| python -m pytest test/ -v --cov=cortex --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| if: matrix.python-version == '3.11' | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install linting tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black pylint mypy | |
| - name: Check formatting with black | |
| run: | | |
| black --check cortex/ || echo "::warning::Code formatting issues found. Run 'black cortex/' to fix." | |
| - name: Lint with pylint | |
| run: | | |
| pylint cortex/ --exit-zero --output-format=text | tee pylint-report.txt | |
| score=$(tail -n 2 pylint-report.txt | head -n 1 | grep -oP '\d+\.\d+') | |
| echo "Pylint score: $score" | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install security tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install bandit safety | |
| - name: Run Bandit security linter | |
| run: | | |
| bandit -r cortex/ -ll -ii || echo "::warning::Security issues found. Please review." | |
| - name: Check dependencies with safety | |
| run: | | |
| pip install -r requirements.txt | |
| safety check --full-report || echo "::warning::Vulnerable dependencies found." |