mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-01 18:19:18 -05:00
style: apply consistent whitespace and formatting across codebase
This commit is contained in:
32
.github/workflows/infra-container-linux.yml
vendored
32
.github/workflows/infra-container-linux.yml
vendored
@@ -59,7 +59,7 @@ on:
|
||||
required: false
|
||||
default: 'latest'
|
||||
type: string
|
||||
|
||||
|
||||
outputs:
|
||||
build-status:
|
||||
description: "Container build status (success/failure/skipped)"
|
||||
@@ -73,7 +73,7 @@ on:
|
||||
cache-hit:
|
||||
description: "Whether build used cache (true/false)"
|
||||
value: ${{ jobs.build.outputs.cache-hit }}
|
||||
|
||||
|
||||
# Re-enable automatic triggers
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # Weekly rebuild (Sunday at midnight)
|
||||
@@ -91,12 +91,12 @@ env:
|
||||
# MLSysBook content lives under book/ to accommodate TinyTorch at root
|
||||
# Use ${{ vars.BOOK_ROOT }}, ${{ vars.BOOK_DOCKER }}, etc. in workflow steps
|
||||
# Variables: BOOK_ROOT, BOOK_DOCKER, BOOK_TOOLS, BOOK_QUARTO, BOOK_DEPS
|
||||
|
||||
|
||||
# Container Registry Configuration (configurable via inputs)
|
||||
REGISTRY: ${{ (github.event_name == 'workflow_dispatch' && inputs.container_registry) || 'ghcr.io' }}
|
||||
IMAGE_NAME: ${{ github.repository }}/${{ (github.event_name == 'workflow_dispatch' && inputs.container_name) || 'quarto-linux' }}
|
||||
CONTAINER_TAG: ${{ (github.event_name == 'workflow_dispatch' && inputs.container_tag) || 'latest' }}
|
||||
|
||||
|
||||
# Container Build Configuration
|
||||
PLATFORM: linux/amd64
|
||||
# Using vars.BOOK_DOCKER (repository variable) - works in all contexts
|
||||
@@ -130,7 +130,7 @@ jobs:
|
||||
echo "📊 Workflow: ${{ github.workflow }}"
|
||||
echo "📊 Run ID: ${{ github.run_id }}"
|
||||
echo "📊 Run Number: ${{ github.run_number }}"
|
||||
|
||||
|
||||
# Check if we have the required permissions
|
||||
echo "🔍 Checking permissions..."
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
@@ -142,7 +142,7 @@ jobs:
|
||||
else
|
||||
echo "⚠️ Unknown event type: ${{ github.event_name }}"
|
||||
fi
|
||||
|
||||
|
||||
# Check if secrets are available
|
||||
echo "🔍 Checking secrets availability..."
|
||||
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
|
||||
@@ -151,7 +151,7 @@ jobs:
|
||||
echo "❌ GITHUB_TOKEN is not available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "✅ Environment check completed"
|
||||
|
||||
- name: 📥 Checkout repository
|
||||
@@ -162,14 +162,14 @@ jobs:
|
||||
echo "🧹 Freeing up disk space for large container build..."
|
||||
echo "📊 Disk space before cleanup:"
|
||||
df -h /
|
||||
|
||||
|
||||
# Remove unnecessary packages and files
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
sudo rm -rf /usr/local/lib/android
|
||||
sudo rm -rf /opt/ghc
|
||||
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
||||
sudo docker system prune -af
|
||||
|
||||
|
||||
echo "📊 Disk space after cleanup:"
|
||||
df -h /
|
||||
echo "✅ Disk cleanup complete"
|
||||
@@ -213,7 +213,7 @@ jobs:
|
||||
echo "📊 Repository: ${{ github.repository }}"
|
||||
echo "📊 Actor: ${{ github.actor }}"
|
||||
echo "📊 Event: ${{ github.event_name }}"
|
||||
|
||||
|
||||
# Test if we can access the registry
|
||||
echo "🔍 Testing Docker daemon access..."
|
||||
if docker info >/dev/null 2>&1; then
|
||||
@@ -222,7 +222,7 @@ jobs:
|
||||
echo "❌ Docker daemon not accessible"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Test registry login with detailed error checking
|
||||
echo "🔍 Testing container registry login..."
|
||||
if echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin; then
|
||||
@@ -241,7 +241,7 @@ jobs:
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Verify we can actually push to the registry
|
||||
echo "🔍 Testing registry write permissions..."
|
||||
TEST_IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/test-push:latest"
|
||||
@@ -305,18 +305,18 @@ jobs:
|
||||
else
|
||||
BUILD_STATUS="failure"
|
||||
fi
|
||||
|
||||
|
||||
# Extract build information
|
||||
IMAGE_NAME="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.CONTAINER_TAG }}"
|
||||
IMAGE_DIGEST="${{ steps.build.outputs.digest }}"
|
||||
CACHE_HIT="${{ steps.build.outputs.cache-hit }}"
|
||||
|
||||
|
||||
echo "build-status=$BUILD_STATUS" >> $GITHUB_OUTPUT
|
||||
echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT
|
||||
echo "image-digest=$IMAGE_DIGEST" >> $GITHUB_OUTPUT
|
||||
echo "cache-hit=$CACHE_HIT" >> $GITHUB_OUTPUT
|
||||
|
||||
|
||||
echo "📊 Build Status: $BUILD_STATUS"
|
||||
echo "🐳 Image: $IMAGE_NAME"
|
||||
echo "🔍 Digest: $IMAGE_DIGEST"
|
||||
echo "💾 Cache Hit: $CACHE_HIT"
|
||||
echo "💾 Cache Hit: $CACHE_HIT"
|
||||
|
||||
Reference in New Issue
Block a user