Run CI tests in Docker image#359
Open
Dagonite wants to merge 1 commit into
Open
Conversation
CI workflow now builds a Docker test image and runs pytest inside it instead of setting up Python and installing deps on the runner. Added TEST_IMAGE env, replaced setup-python and pip steps with docker/build-push-action, and mount the workspace so coverage.xml is written back. Dockerfile converted to multi-stage (base/test/runtime): copy minimal sources, install package in base, install test deps in test stage, and keep a runtime stage for production. .dockerignore updated to exclude more build/test artifacts and caches.
There was a problem hiding this comment.
Pull request overview
This PR updates CI to execute pytest inside the project’s built Docker “test” image, aligning automated testing with the containerized environment the service is intended to run in (per Issue #25).
Changes:
- Refactors the
Dockerfileinto multi-stage builds (base,test,runtime) to support test execution within a built image. - Updates the GitHub Actions test workflow to build the
teststage image and run pytest viadocker run, exportingcoverage.xmlto the workspace. - Refreshes
.dockerignoreto reduce build context noise by excluding common local caches and generated artifacts.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Dockerfile | Introduces base/test/runtime stages to support container-based testing and runtime execution. |
| .github/workflows/test.yml | Builds the Docker test image and runs pytest inside the built container, emitting coverage XML. |
| .dockerignore | Expands ignored patterns to reduce Docker build context size and exclude local/generated files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
8
to
10
| RUN python -m pip install --upgrade pip \ | ||
| && python -m pip install --no-cache-dir . | ||
|
|
| - name: Set up python | ||
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v4.5.0 | ||
| - name: Build test image | ||
| uses: docker/build-push-action@v7 |
Member
|
@Dagonite When using copilot could you respond to it's review before putting it in the In review column so it's ready for a person's review |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #25.
Description
testimage and run pytest inside the built container..dockerignoreso the Docker build context excludes local caches and generated files.