diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index e2d5dd3..ce98f98 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -3,38 +3,65 @@ definitions: - script: &install pip install uv; uv sync --group dev --group test; - -pipelines: - default: - - step: + steps: + - step: &install-deps name: Install Dependencies image: python:3.12.7 script: - *install caches: - pip + - step: &lint + name: Lint (black) + image: python:3.12.7 + script: + - *install + - uv run black --check src/ + caches: + - pip + - step: &typecheck + name: Type Check (mypy) + image: python:3.12.7 + script: + - *install + - uv run mypy src/ + caches: + - pip + - step: &unit-tests + name: Unit Tests (pytest) + image: python:3.12.7 + script: + - *install + - uv run pytest src/tests/ + caches: + - pip + +pipelines: + default: + - step: *install-deps - parallel: - - step: - name: Lint (black) - image: python:3.12.7 - script: - - *install - - uv run black --check src/ - caches: - - pip - - step: - name: Type Check (mypy) - image: python:3.12.7 - script: - - *install - - uv run mypy src/ - caches: - - pip - - step: - name: Unit Tests (pytest) - image: python:3.12.7 - script: - - *install - - uv run pytest src/tests/ - caches: - - pip + - step: *lint + - step: *typecheck + - step: *unit-tests + + pull-requests: + '**': + - step: *install-deps + - parallel: + - step: *lint + - step: *typecheck + - step: *unit-tests + - step: + name: AI Code Review + image: python:3.12-slim + oidc: true + script: + - apt-get update && apt-get install -y git + - pip install boto3 requests + - export AWS_REGION=us-east-1 + - export AWS_ROLE_ARN=arn:aws:iam::975049960860:role/DoczyAI-Bitbucket-OIDC + - export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token + - echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token + - git clone https://x-token-auth:${BITBUCKET_CLONE_TOKEN}@bitbucket.org/${BITBUCKET_WORKSPACE}/code-review-agent.git + - export PR_URL="https://bitbucket.org/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/pull-requests/${BITBUCKET_PR_ID}" + - cd code-review-agent && python main.py "$PR_URL"