-
Notifications
You must be signed in to change notification settings - Fork 4
Set up CI pipeline with GitHub Actions #9 #23
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
vreddy-commits
wants to merge
6
commits into
dhedhialy:main
Choose a base branch
from
vreddy-commits:feature/git_ci
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
03f88bc
Add CI workflow for Python project
vreddy-commits a77e417
Create .gitkeep
vreddy-commits 8339904
Add Pyright and update dev dependencies
vreddy-commits 90f1c1e
Implement integration test for FHIRAdapter inheritance
vreddy-commits 636afa0
Update test_monitor.py
vreddy-commits 92445d3
Add CI and badge links to README
vreddy-commits 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,43 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| ci: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 3 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| cache: pip | ||
|
|
||
| - name: Install package with dev dependencies | ||
| run: pip install -e ".[dev]" | ||
|
|
||
| - name: Lint | ||
| run: ruff check src/ sim/ | ||
|
|
||
| - name: Format check | ||
| run: ruff format --check src/ sim/ | ||
|
|
||
| - name: Type check | ||
| run: pyright src/ | ||
|
|
||
| - name: Test | ||
| run: pytest -v --tb=short --cov=src/cyberhosp --cov-report=xml --cov-report=term tests/ | ||
|
|
||
| - name: Upload coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report | ||
| path: coverage.xml | ||
| if-no-files-found: error | ||
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
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 @@ | ||
|
|
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 |
|---|---|---|
| @@ -1,5 +1,15 @@ | ||
| """Integration layer tests.""" | ||
|
|
||
| from cyberhosp.integration.base import EHRAdapter, EHRConfig | ||
| from cyberhosp.integration.fhir import FHIRAdapter | ||
|
|
||
|
|
||
| class TestEHRAdapter: | ||
| pass | ||
| def test_fhir_adapter_inherits_ehradapter(self) -> None: | ||
| config = EHRConfig( | ||
| vendor="test", | ||
| base_url="https://example.com/fhir", | ||
| auth_method="oauth2", | ||
| api_version="R4", | ||
| ) | ||
| assert isinstance(FHIRAdapter(config), EHRAdapter) |
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 |
|---|---|---|
| @@ -1,5 +1,14 @@ | ||
| """Audit and monitoring tests.""" | ||
|
|
||
| from cyberhosp.monitor.analyzer import BehaviorAnalyzer | ||
| from cyberhosp.monitor.audit import AuditPipeline | ||
|
|
||
|
|
||
| class TestAuditPipeline: | ||
| pass | ||
| def test_audit_pipeline_instantiable(self) -> None: | ||
| assert type(AuditPipeline()) is AuditPipeline | ||
|
|
||
|
|
||
| class TestBehaviorAnalyzer: | ||
| def test_behavior_analyzer_instantiable(self) -> None: | ||
| assert type(BehaviorAnalyzer()) is BehaviorAnalyzer |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Disable credential persistence to prevent token leakage.
By default,
actions/checkoutpersists the repository'sGITHUB_TOKENin the local Git configuration. This introduces a security risk where the token could be exposed if the Git directory is read by untrusted tools or inadvertently packaged into an artifact. Setpersist-credentials: falseto mitigate this risk.🔒️ Proposed fix
- name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.26.1)
[warning] 14-15: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Source: Linters/SAST tools