-
Notifications
You must be signed in to change notification settings - Fork 0
ci: Implement Prebuilt Image for stable test pipeline #83
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c9160a0
ci: add prebuilt image workflow and configure tests to use it
seonghobae b4fdad2
ci: satisfy workflow security checks
seonghobae ea77f60
ci: use correct SHAs for docker actions
seonghobae d6d705f
ci: resolve CodeRabbit review comments
seonghobae 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,59 @@ | ||
| name: Build CI Environment Image | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, develop] | ||
| paths: | ||
| - 'Dockerfile.test' | ||
| - '.github/workflows/build-ci-image.yml' | ||
| pull_request: | ||
| paths: | ||
| - 'Dockerfile.test' | ||
| - '.github/workflows/build-ci-image.yml' | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # Convert repository owner to lowercase for Docker compatibility | ||
| - name: Lowercase repository owner | ||
| id: lowercase_owner | ||
| run: | | ||
| echo "owner=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Extract metadata for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 | ||
| with: | ||
| images: ghcr.io/${{ steps.lowercase_owner.outputs.owner }}/newsdom-api/ci-env | ||
| tags: | | ||
| type=raw,value=latest | ||
| type=sha | ||
|
|
||
| - name: Build and push test image | ||
| uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile.test | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
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,36 @@ | ||
| FROM python:3.10-slim | ||
|
|
||
| ENV UV_VERSION=0.11.3 | ||
|
|
||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| libgl1 \ | ||
| libglib2.0-0 \ | ||
| curl \ | ||
| git \ | ||
| && rm -rf /var/lib/apt/lists/* \ | ||
| && useradd -m -s /bin/bash ciuser | ||
|
|
||
| # Install uv (pin to match .github/workflows/tests.yml) | ||
| RUN curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh | ||
|
|
||
| ENV PATH="/usr/local/bin:${PATH}" | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Pre-warm dependencies only (source is mounted at runtime by Actions) | ||
| COPY pyproject.toml README.md ./ | ||
| COPY src/newsdom_api/__init__.py ./src/newsdom_api/__init__.py | ||
|
|
||
| # Install dependencies using uv | ||
| # Install to system Python so that it's accessible without activating a venv | ||
| RUN uv pip install --system -e ".[dev,mineru]" | ||
|
|
||
| # Now set permissions and switch to non-root user | ||
| RUN chown -R ciuser:ciuser /app | ||
| USER ciuser | ||
|
|
||
| ENV PYTHONPATH=/app/src | ||
|
|
||
| CMD ["pytest"] |
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.