CI/CD Setup #7
Workflow file for this run
This file contains 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: Python CI All | |
on: | |
pull_request: | |
branches: | |
- main | |
- dev | |
# paths: | |
# - 'sweepai/**' | |
# - 'tests/**' | |
push: | |
branches: | |
- main | |
- dev | |
paths: | |
- 'sweepai/**' | |
- 'tests/**' | |
jobs: | |
setup-and-dependencies: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
outputs: | |
cache-key: ${{ steps.cache-dependencies.outputs.cache-key }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.67.0 | |
override: true | |
- uses: Swatinem/rust-cache@v1 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV | |
- run: pip install uv | |
- run: uv pip install -r requirements.txt | |
- run: uv pip install black ruff pylint uvicorn pytest | |
code-quality: | |
needs: setup-and-dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV | |
- name: Lint with Ruff | |
run: ruff check sweepai | |
- name: Lint with Pylint | |
run: pylint sweepai --errors-only | |
unit-tests: | |
needs: setup-and-dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 # Choose based on your project's needs | |
- name: Run Unit Tests | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: python -m unittest sweepai/**/*_test.py | |
e2e-tests: | |
needs: unit-tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 # Choose based on your project's needs | |
- name: Set up Redis (for e2e tests) | |
run: | | |
sudo apt-get update | |
sudo apt-get install redis-server | |
sudo lsof -i :6379 || true | |
- name: Run e2e Tests | |
env: | |
GITHUB_PAT: ${{ secrets.GH_PAT }} | |
GITHUB_APP_ID: ${{ secrets.GH_APP_ID }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
GITHUB_APP_PEM: ${{ secrets.GH_APP_PEM }} | |
OPENAI_API_TYPE: azure | |
OPENAI_API_BASE: ${{ secrets.GH_OPENAI_API_BASE }} | |
OPENAI_API_VERSION: 2024-02-15-preview | |
AZURE_API_KEY: ${{ secrets.GH_AZURE_API_KEY }} | |
AZURE_OPENAI_DEPLOYMENT: ${{ secrets.GH_AZURE_OPENAI_DEPLOYMENT }} | |
run: PYTHONPATH=. pytest -n 4 tests/e2e -s | |
timeout-minutes: 30 |