-
Notifications
You must be signed in to change notification settings - Fork 0
add ci #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
damnthonyy
wants to merge
5
commits into
main
Choose a base branch
from
test/violation-pr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add ci #1
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0ebff7d
add ci
damnthonyy e10fd26
Update GitHub Actions workflow
damnthonyy 9a2f819
Update PR analysis step in GitHub Actions workflow to use specific fe…
damnthonyy 1867b2c
Refactor PR analysis step in GitHub Actions workflow to use main entr…
damnthonyy 54d4eff
Add intentional layer violations in domain and infrastructure files f…
damnthonyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - develop | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
|
|
||
| - name: Install struct-ia | ||
| run: | | ||
| pip install git+https://github.com/struct-ai/struct-ai.git@feat/20-github-action-analyse-pr | ||
|
|
||
| - name: Verify Python sources | ||
| run: python -m compileall -q src |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: PR Analysis | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - reopened | ||
|
|
||
| # Minimal permissions: read code, write PR comments. | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| struct-ia-review: | ||
| name: struct-ia — Clean Architecture Analysis | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # Full history required for git diff against origin/main | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install dependencies | ||
| run: pip install "git+https://github.com/struct-ai/struct-ai.git@feat/20-github-action-analyse-pr" | ||
|
|
||
| - name: Run struct-ia PR analysis | ||
| run: python -m struct_ai.entrypoints.github_action.main | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GITHUB_REPOSITORY: ${{ github.repository }} | ||
| PR_NUMBER: ${{ github.event.number }} | ||
| GITHUB_WORKSPACE: ${{ github.workspace }} | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| # Uncomment the provider you want to use instead of OpenAI: | ||
| # ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| # GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | ||
| # MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} | ||
| # OLLAMA_BASE_URL: ${{ secrets.OLLAMA_BASE_URL }} | ||
| # | ||
| # Set to "false" to make violations warnings-only (CI won't fail). | ||
| STRUCT_IA_FAIL_ON_VIOLATION: "true" | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| """Intentional violation: domain re-declares infrastructure coupling.""" | ||
|
|
||
| # struct-ia: expect layer_violation — domain imports infrastructure. | ||
| from app.infrastructure.repository import SqlUserRepository | ||
|
|
||
|
|
||
| def make_repository() -> SqlUserRepository: | ||
| return SqlUserRepository() | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| """Intentional violation: domain must not depend on entrypoints (outer layer).""" | ||
|
|
||
| # struct-ia: expect layer_violation — domain imports entrypoints. | ||
| from app.entrypoints.main import APP_CONFIG | ||
|
|
||
|
|
||
| def get_configured_db_path() -> str: | ||
| return str(APP_CONFIG.get("db_path", "db/users.json")) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| """Intentional violation: infrastructure must not depend on entrypoints.""" | ||
|
|
||
| from typing import Any, Dict | ||
|
|
||
| # struct-ia: expect layer_violation — infrastructure imports entrypoints. | ||
| from app.entrypoints.main import create_user_from_http_payload | ||
|
|
||
|
|
||
| def bootstrap_user_from_cli_payload(payload: Dict[str, Any]) -> None: | ||
| create_user_from_http_payload(payload) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.