Skip to content

feat: implement full plugin protocol workflow (Plan + Generate) #35

feat: implement full plugin protocol workflow (Plan + Generate)

feat: implement full plugin protocol workflow (Plan + Generate) #35

Workflow file for this run

name: ci
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: calculate_hash
name: Calculate source file hash
run: |-
set -e
echo 'Calculating source file hash...'
TEMP_HASH_FILE="/tmp/source_files_for_hash"
rm -f "$TEMP_HASH_FILE"
find . -path './src/**/*.rs' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './Cargo.toml' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './Cargo.lock' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
if [ -s "$TEMP_HASH_FILE" ]; then
# Calculate hash of file contents
JOB_HASH=$(xargs -I{{}} sh -c 'cat "{{}}"' < "$TEMP_HASH_FILE" | sha256sum | cut -d' ' -f1)
echo "Hash calculated: $JOB_HASH"
echo "JOB_HASH=$JOB_HASH" >> $GITHUB_ENV
else
JOB_HASH="empty"
echo "No source files found, using empty hash"
echo "JOB_HASH=$JOB_HASH" >> $GITHUB_ENV
fi
shell: bash
- id: check_skip
name: Check if job should be skipped
run: |-
set -e
SKIP_CACHE_DIR="/tmp/cigen_skip_cache"
SKIP_MARKER="$SKIP_CACHE_DIR/job_${{ env.JOB_HASH }}_amd64"
if [ -f "$SKIP_MARKER" ]; then
echo "✓ Job already completed successfully for this file hash. Skipping..."
exit 0
else
echo "→ No previous successful run found. Proceeding with job..."
mkdir -p "$SKIP_CACHE_DIR"
fi
shell: bash
- name: Clippy check
run: cargo clippy --all-targets --all-features -- -D warnings
- id: record_completion
name: Record job completion
run: |-
set -e
SKIP_CACHE_DIR="/tmp/cigen_skip_cache"
SKIP_MARKER="$SKIP_CACHE_DIR/job_${{ env.JOB_HASH }}_amd64"
echo "Recording successful completion for hash ${{ env.JOB_HASH }}"
mkdir -p "$SKIP_CACHE_DIR"
echo "$(date): Job completed successfully" > "$SKIP_MARKER"
shell: bash
test:
runs-on: ubuntu-latest
needs:
- clippy
- fmt
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: calculate_hash
name: Calculate source file hash
run: |-
set -e
echo 'Calculating source file hash...'
TEMP_HASH_FILE="/tmp/source_files_for_hash"
rm -f "$TEMP_HASH_FILE"
find . -path './src/**/*.rs' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './Cargo.toml' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './Cargo.lock' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './tests/**/*.rs' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './tests/**/*.yml' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './tests/**/*.trycmd' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './examples/**/*.yml' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './examples/**/*.yaml' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
if [ -s "$TEMP_HASH_FILE" ]; then
# Calculate hash of file contents
JOB_HASH=$(xargs -I{{}} sh -c 'cat "{{}}"' < "$TEMP_HASH_FILE" | sha256sum | cut -d' ' -f1)
echo "Hash calculated: $JOB_HASH"
echo "JOB_HASH=$JOB_HASH" >> $GITHUB_ENV
else
JOB_HASH="empty"
echo "No source files found, using empty hash"
echo "JOB_HASH=$JOB_HASH" >> $GITHUB_ENV
fi
shell: bash
- id: check_skip
name: Check if job should be skipped
run: |-
set -e
SKIP_CACHE_DIR="/tmp/cigen_skip_cache"
SKIP_MARKER="$SKIP_CACHE_DIR/job_${{ env.JOB_HASH }}_amd64"
if [ -f "$SKIP_MARKER" ]; then
echo "✓ Job already completed successfully for this file hash. Skipping..."
exit 0
else
echo "→ No previous successful run found. Proceeding with job..."
mkdir -p "$SKIP_CACHE_DIR"
fi
shell: bash
- name: Run tests
run: cargo test --all-features
- id: record_completion
name: Record job completion
run: |-
set -e
SKIP_CACHE_DIR="/tmp/cigen_skip_cache"
SKIP_MARKER="$SKIP_CACHE_DIR/job_${{ env.JOB_HASH }}_amd64"
echo "Recording successful completion for hash ${{ env.JOB_HASH }}"
mkdir -p "$SKIP_CACHE_DIR"
echo "$(date): Job completed successfully" > "$SKIP_MARKER"
shell: bash
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: calculate_hash
name: Calculate source file hash
run: |-
set -e
echo 'Calculating source file hash...'
TEMP_HASH_FILE="/tmp/source_files_for_hash"
rm -f "$TEMP_HASH_FILE"
find . -path './src/**/*.rs' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './Cargo.toml' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
find . -path './Cargo.lock' -type f 2>/dev/null | sort >> "$TEMP_HASH_FILE" || true
if [ -s "$TEMP_HASH_FILE" ]; then
# Calculate hash of file contents
JOB_HASH=$(xargs -I{{}} sh -c 'cat "{{}}"' < "$TEMP_HASH_FILE" | sha256sum | cut -d' ' -f1)
echo "Hash calculated: $JOB_HASH"
echo "JOB_HASH=$JOB_HASH" >> $GITHUB_ENV
else
JOB_HASH="empty"
echo "No source files found, using empty hash"
echo "JOB_HASH=$JOB_HASH" >> $GITHUB_ENV
fi
shell: bash
- id: check_skip
name: Check if job should be skipped
run: |-
set -e
SKIP_CACHE_DIR="/tmp/cigen_skip_cache"
SKIP_MARKER="$SKIP_CACHE_DIR/job_${{ env.JOB_HASH }}_amd64"
if [ -f "$SKIP_MARKER" ]; then
echo "✓ Job already completed successfully for this file hash. Skipping..."
exit 0
else
echo "→ No previous successful run found. Proceeding with job..."
mkdir -p "$SKIP_CACHE_DIR"
fi
shell: bash
- name: Format check
run: cargo fmt -- --check
- id: record_completion
name: Record job completion
run: |-
set -e
SKIP_CACHE_DIR="/tmp/cigen_skip_cache"
SKIP_MARKER="$SKIP_CACHE_DIR/job_${{ env.JOB_HASH }}_amd64"
echo "Recording successful completion for hash ${{ env.JOB_HASH }}"
mkdir -p "$SKIP_CACHE_DIR"
echo "$(date): Job completed successfully" > "$SKIP_MARKER"
shell: bash