open-notebook/.github/workflows/build-dev.yml
LUIS NOVO fc872ff6e3 ci: remove single-container build from dev workflow
Reduces CI time by only building the multi-container Dockerfile
during pull requests. The single-container build is still available
in the production build-and-release workflow.
2026-01-09 20:53:32 -03:00

103 lines
3.2 KiB
YAML

name: Development Build
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
paths-ignore:
- '**.md'
- 'docs/**'
- 'notebooks/**'
- '.github/workflows/claude*.yml'
workflow_dispatch:
inputs:
platform:
description: 'Platform to build'
required: true
default: 'linux/amd64'
type: choice
options:
- linux/amd64
- linux/arm64
- linux/amd64,linux/arm64
env:
REGISTRY: docker.io
IMAGE_NAME: lfnovo/open_notebook
jobs:
extract-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from pyproject.toml
id: version
run: |
VERSION=$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
test-build:
needs: extract-version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache-dev
key: ${{ runner.os }}-buildx-dev-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-dev-
- name: Build image (test only)
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: ${{ github.event.inputs.platform || 'linux/amd64' }}
push: false
tags: ${{ env.IMAGE_NAME }}:${{ needs.extract-version.outputs.version }}-dev
cache-from: type=local,src=/tmp/.buildx-cache-dev
cache-to: type=local,dest=/tmp/.buildx-cache-dev-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache-dev
mv /tmp/.buildx-cache-dev-new /tmp/.buildx-cache-dev
summary:
needs: [extract-version, test-build]
runs-on: ubuntu-latest
if: always()
steps:
- name: Development Build Summary
run: |
echo "## Development Build Summary" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ needs.extract-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "**Platform:** ${{ github.event.inputs.platform || 'linux/amd64' }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Results:" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.test-build.result }}" == "success" ]]; then
echo "✅ **Dockerfile:** Build successful" >> $GITHUB_STEP_SUMMARY
elif [[ "${{ needs.test-build.result }}" == "skipped" ]]; then
echo "⏭️ **Dockerfile:** Skipped" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Dockerfile:** Build failed" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Notes:" >> $GITHUB_STEP_SUMMARY
echo "- This is a development build (no images pushed to registry)" >> $GITHUB_STEP_SUMMARY
echo "- For production releases, use the 'Build and Release' workflow" >> $GITHUB_STEP_SUMMARY