Repository navigation
Migrate tests to testcontainers and add CI workflows - #15
Conversation
Replace tox-docker with testcontainers: PostgreSQL and ClickHouse containers are now managed from tests/conftest.py (session-scoped), so the suite runs via plain pytest with no env-var wiring. Drop the [docker:*] sections from tox.ini and swap tox-docker for testcontainers[postgres] in requirements-dev.txt. Add a CI workflow (test matrix py3.10-3.14, lint, build, security, ci-success gate) replacing run-tests.yml, and rework sbom.yml to generate/scan/sign CycloneDX + SPDX SBOMs. Update README, CHANGELOG, and CLAUDE.md accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reviewer's GuideReplaces tox-docker–managed database containers with testcontainers-based pytest fixtures, introduces a new GitHub Actions CI pipeline (tests, lint, build, security, ci-success gate), and expands the SBOM workflow to generate, scan, sign, and publish CycloneDX/SPDX SBOMs while updating docs and changelog accordingly. Sequence diagram for updated SBOM generation and scanning workflowsequenceDiagram
participant GA as GitHubActions_runner
participant CycloneDX as cyclonedx-py
participant Syft as syft
participant Grype as grype
participant Cosign as cosign
participant DTrack as DependencyTrack
participant Release as GitHubRelease
GA->>CycloneDX: cyclonedx-py environment -o sbom-cyclonedx.json
GA->>DTrack: curl POST /api/v1/bom (sbom-cyclonedx.json)
GA->>Syft: syft . -o spdx-json > sbom-spdx.json
GA->>Grype: grype sbom:sbom-cyclonedx.json --fail-on high
GA->>Grype: grype sbom:sbom-spdx.json --fail-on high
GA->>Cosign: cosign sign-blob sbom-cyclonedx.json
GA->>Cosign: cosign sign-blob sbom-spdx.json
GA->>Release: softprops/action-gh-release (upload SBOM files)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The workflows reference
actions/checkout@v6andactions/setup-python@v6, but the latest published majors are@v4and@v5respectively; using non-existent major versions will cause the workflows to fail, so these should be pinned to existing majors. - In
sbom.yml, generating the SBOM withcyclonedx-py environmentafterpip install . cyclonedx-bomwill include tooling likecyclonedx-bomitself in the SBOM; if the intent is to describe just this project’s artifacts and dependencies, consider switching to aproject-based invocation (or equivalent) that scopes to the package rather than the whole environment. - The SBOM workflow installs Syft and Grype via
curl | shon every run, which can be slow and brittle; using the official GitHub Actions (or caching the binaries) would make the job faster and more maintainable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The workflows reference `actions/checkout@v6` and `actions/setup-python@v6`, but the latest published majors are `@v4` and `@v5` respectively; using non-existent major versions will cause the workflows to fail, so these should be pinned to existing majors.
- In `sbom.yml`, generating the SBOM with `cyclonedx-py environment` after `pip install . cyclonedx-bom` will include tooling like `cyclonedx-bom` itself in the SBOM; if the intent is to describe just this project’s artifacts and dependencies, consider switching to a `project`-based invocation (or equivalent) that scopes to the package rather than the whole environment.
- The SBOM workflow installs Syft and Grype via `curl | sh` on every run, which can be slow and brittle; using the official GitHub Actions (or caching the binaries) would make the job faster and more maintainable.
## Individual Comments
### Comment 1
<location path=".github/workflows/sbom.yml" line_range="48-52" />
<code_context>
+ -F "projectVersion=${PROJECT_VERSION}" \
+ -F "bom=@sbom-cyclonedx.json"
+
+ - name: Install Syft
+ run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
+
+ - name: Install Grype
+ run: curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin
+
+ - name: Install Cosign
</code_context>
<issue_to_address>
**🚨 issue (security):** Installing Syft/Grype via `curl | sh` without pinning versions or verifying integrity is a security and stability risk.
Both tools are installed via `curl ... | sh` from the `main` branch, which both breaks reproducibility and runs unauthenticated remote code. Please pin to a specific release (e.g., a tagged install script or versioned binary) and/or verify checksums before execution to reduce these risks.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| - name: Install Syft | ||
| run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin | ||
|
|
||
| - name: Install Grype | ||
| run: curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin |
There was a problem hiding this comment.
🚨 issue (security): Installing Syft/Grype via curl | sh without pinning versions or verifying integrity is a security and stability risk.
Both tools are installed via curl ... | sh from the main branch, which both breaks reproducibility and runs unauthenticated remote code. Please pin to a specific release (e.g., a tagged install script or versioned binary) and/or verify checksums before execution to reduce these risks.
Replace tox-docker with testcontainers: PostgreSQL and ClickHouse containers are now managed from tests/conftest.py (session-scoped), so the suite runs via plain pytest with no env-var wiring. Drop the [docker:*] sections from tox.ini and swap tox-docker for testcontainers[postgres] in requirements-dev.txt.
Add a CI workflow (test matrix py3.10-3.14, lint, build, security, ci-success gate) replacing run-tests.yml, and rework sbom.yml to generate/scan/sign CycloneDX + SPDX SBOMs. Update README, CHANGELOG, and CLAUDE.md accordingly.
Summary by Sourcery
Migrate database integration tests to use session-scoped testcontainers and introduce a comprehensive GitHub Actions CI pipeline with enhanced SBOM generation, scanning, and signing.
New Features:
Enhancements:
CI:
Documentation:
Tests: