Skip to content

Commit a2419ec

Browse files
chore(platform,qupath): enable additional tests
chore(ai): improve Claude Code Workflows for GitHub
1 parent 53f425c commit a2419ec

File tree

7 files changed

+291
-122
lines changed

7 files changed

+291
-122
lines changed

.github/workflows/claude-agent.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Claude Code / Automation / PR Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
# Optional: Filter by PR author
16+
# if: |
17+
# github.event.pull_request.user.login == 'external-contributor' ||
18+
# github.event.pull_request.user.login == 'new-developer' ||
19+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: write
25+
issues: read
26+
id-token: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Install uv
35+
uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
36+
with:
37+
version-file: "pyproject.toml"
38+
enable-cache: true
39+
cache-dependency-glob: uv.lock
40+
41+
- name: Install dev tools
42+
if: ${{ matrix.runner == 'ubuntu-latest' || matrix.runner == 'ubuntu-24.04-arm' }}
43+
shell: bash
44+
run: .github/workflows/_install_dev_tools.bash
45+
46+
- name: Install Python, venv and dependencies
47+
shell: bash
48+
run: uv sync --all-extras --frozen --link-mode=copy
49+
50+
- name: Setup display
51+
uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2
52+
53+
- name: Print development version info
54+
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
55+
shell: bash
56+
run: |
57+
TOML_VERSION=$(uv run python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['version'])")
58+
echo "Development build - Current version in pyproject.toml: $TOML_VERSION"
59+
60+
- name: Run Claude Code / Automation / PR Review
61+
id: claude-code-automation-pr-review
62+
uses: anthropics/[email protected]
63+
with:
64+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
65+
track_progress: true
66+
additional_permissions: |
67+
actions: read
68+
allowed_bots: "dependabot[bot],renovate[bot]"
69+
claude_args: >-
70+
--max-turns 200
71+
--model claude-sonnet-4-5-20250929
72+
--allowed-tools "mcp__github_inline_comment__create_inline_comment,Read,Write,Edit,MultiEdit,Glob,Grep,LS,WebFetch,WebSearch,Bash(git:*),Bash(bun:*),Bash(npm:*),Bash(npx:*),Bash(gh:*),Bash(uv:*),Bash(make:*)"
73+
--system-prompt "Enable the contributor while insisting on highest standards:
74+
* Apply best practices in enterprise grade software engineering.
75+
* Use the repository's CLAUDE.md and recursively referenced documents for guidance on style and conventions.
76+
* Raise the bar on engineering and operational excellence in this repository.
77+
* Do research on any libraries, frameworks, principles or tools you are not familiar with.
78+
* uv, python and further development dependencies are already installed.
79+
* Use `uv sync --all-extras` to install any missing dependencies for your branch.
80+
* Use 'uv run pytest -k ...' to run a particular test.
81+
* Use 'uv run aignostics ...' to run the CLI.
82+
"
83+
prompt: |
84+
REPO: ${{ github.repository }}
85+
PR NUMBER: ${{ github.event.pull_request.number }}
86+
87+
Perform a comprehensive code review with the following focus areas:
88+
89+
1. **Code Quality**
90+
- Clean code principles and best practices
91+
- Proper error handling and edge cases
92+
- Code readability and maintainability
93+
94+
2. **Security**
95+
- Check for potential security vulnerabilities
96+
- Validate input sanitization
97+
- Review authentication/authorization logic
98+
99+
3. **Performance**
100+
- Identify potential performance bottlenecks
101+
- Review database queries for efficiency
102+
- Check for memory leaks or resource issues
103+
104+
4. **Testing**
105+
- Verify adequate test coverage
106+
- Review test quality and edge cases
107+
- Check for missing test scenarios
108+
109+
5. **Documentation**
110+
- Ensure code is properly documented
111+
- Verify README updates for new features
112+
- Check API documentation accuracy
113+
114+
Provide detailed feedback using inline comments for specific issues.
115+
Use top-level comments for general observations or praise.
116+
117+
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
118+
119+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
120+
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Claude Code / Interactive
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned, labeled]
10+
pull_request:
11+
types: [opened, assigned, labeled]
12+
pull_request_review:
13+
types: [submitted]
14+
15+
jobs:
16+
claude:
17+
if: |
18+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
19+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
20+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
21+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude') || (github.event.action == 'labeled' && github.event.label.name == 'claude'))) ||
22+
(github.event_name == 'pull_request' && (contains(github.event.pull_request.body, '@claude') || contains(github.event.pull_request.title, '@claude') || (github.event.action == 'labeled' && github.event.label.name == 'claude')))
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: write
26+
pull-requests: write
27+
issues: write
28+
id-token: write
29+
actions: read # Required for Claude to read CI results on PRs
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
33+
with:
34+
fetch-depth: 0
35+
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
38+
with:
39+
version-file: "pyproject.toml"
40+
enable-cache: true
41+
cache-dependency-glob: uv.lock
42+
43+
- name: Install dev tools
44+
if: ${{ matrix.runner == 'ubuntu-latest' || matrix.runner == 'ubuntu-24.04-arm' }}
45+
shell: bash
46+
run: .github/workflows/_install_dev_tools.bash
47+
48+
- name: Install Python, venv and dependencies
49+
shell: bash
50+
run: uv sync --all-extras --frozen --link-mode=copy
51+
52+
- name: Setup display
53+
uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2
54+
55+
- name: Create .env file
56+
uses: SpicyPizza/create-envfile@ace6d4f5d7802b600276c23ca417e669f1a06f6f # v2.0.3
57+
with:
58+
envkey_AIGNOSTICS_CLIENT_ID_DEVICE: ${{ secrets.AIGNOSTICS_CLIENT_ID_DEVICE }}
59+
envkey_AIGNOSTICS_REFRESH_TOKEN: ${{ secrets.AIGNOSTICS_REFRESH_TOKEN }}
60+
fail_on_empty: false
61+
62+
- name: Set up GCP credentials for bucket access
63+
shell: bash
64+
env:
65+
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
66+
run: |
67+
echo "$GCP_CREDENTIALS" | base64 -d > credentials.json
68+
echo "GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/credentials.json" >> $GITHUB_ENV
69+
70+
- name: Print development version info
71+
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
72+
shell: bash
73+
run: |
74+
TOML_VERSION=$(uv run python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['version'])")
75+
echo "Development build - Current version in pyproject.toml: $TOML_VERSION"
76+
77+
- name: Run Claude Code / Interactive
78+
id: claude-code-interactive
79+
uses: anthropics/claude-code-action@v1
80+
with:
81+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
82+
track_progress: true
83+
additional_permissions: |
84+
actions: read
85+
allowed_bots: "dependabot[bot],renovate[bot]"
86+
claude_args: >-
87+
--max-turns 200
88+
--model claude-sonnet-4-5-20250929
89+
--allowed-tools "mcp__github_inline_comment__create_inline_comment,Read,Write,Edit,MultiEdit,Glob,Grep,LS,WebFetch,WebSearch,Bash(git:*),Bash(bun:*),Bash(npm:*),Bash(npx:*),Bash(gh:*),Bash(uv:*),Bash(make:*)"
90+
--system-prompt "Enable the contributor given their ask while insisting on highest standards:
91+
* Apply best practices in enterprise grade software engineering.
92+
* Use the repository's CLAUDE.md and recursively referenced documents for guidance on style and conventions.
93+
* Raise the bar on engineering and operational excellence in this repository.
94+
* Do research on any libraries, frameworks, principles or tools you are not familiar with.
95+
* uv, python and further development dependencies are already installed.
96+
* Use `uv sync --all-extras` to install any missing dependencies for your branch.
97+
* Use 'uv run pytest ...' to run tests you created.
98+
* Use 'uv run aignostics ...' to run the CLI and commands you added.
99+
* As a final validation of your code changes run the unit, integration and e2e test suite.
100+
* Use 'make test_unit' to run the unit test suite.
101+
* Use 'make test_integration' to run the integration test suite.
102+
* Use 'make test e2e' to run the e2e tests suite.
103+
* If the validation fails, iterate.
104+
"
105+
106+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
107+
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options

.github/workflows/claude-code-review.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)