@@ -29,45 +29,73 @@ jobs:
2929 # ── 1. Checkout ──────────────────────────────────────────────────────────
3030 - uses : actions/checkout@v4
3131
32+ - name : Decide whether boot verification should run
33+ id : scope
34+ run : |
35+ set -euo pipefail
36+ if [[ "${{ github.event_name }}" != "pull_request" ]]; then
37+ echo "run=true" >> "$GITHUB_OUTPUT"
38+ exit 0
39+ fi
40+
41+ BASE_SHA="${{ github.event.pull_request.base.sha }}"
42+ HEAD_SHA="${{ github.event.pull_request.head.sha }}"
43+ CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" || true)
44+ echo "$CHANGED_FILES"
45+
46+ if echo "$CHANGED_FILES" | grep -Eq '^(src/|config/crd/|Cargo\.toml|Cargo\.lock|build\.rs|Makefile)'; then
47+ echo "run=true" >> "$GITHUB_OUTPUT"
48+ else
49+ echo "run=false" >> "$GITHUB_OUTPUT"
50+ fi
51+
3252 # ── 2. Rust toolchain + cache ────────────────────────────────────────────
3353 - name : Install Rust toolchain
54+ if : steps.scope.outputs.run == 'true'
3455 uses : dtolnay/rust-toolchain@stable
3556
3657 - name : Setup Rust cache
58+ if : steps.scope.outputs.run == 'true'
3759 uses : Swatinem/rust-cache@v2
3860 with :
3961 shared-key : " verify-boot"
4062
4163 # ── 3. Build release binary (AC #1) ─────────────────────────────────────
4264 - name : Build release binary
65+ if : steps.scope.outputs.run == 'true'
4366 run : cargo build --release --locked --bin stellar-operator
4467
4568 - name : Confirm binary exists
69+ if : steps.scope.outputs.run == 'true'
4670 run : |
4771 ls -lh target/release/stellar-operator
4872 echo "✅ cargo build --release succeeded"
4973
5074 # ── 4. Create kind cluster (AC #2) ──────────────────────────────────────
5175 - name : Install kind
76+ if : steps.scope.outputs.run == 'true'
5277 uses : helm/kind-action@v1.13.0
5378 with :
5479 install_only : true
5580
5681 - name : Create kind cluster
82+ if : steps.scope.outputs.run == 'true'
5783 run : |
5884 kind create cluster --name ${{ env.CLUSTER_NAME }} --wait 60s
5985 kubectl cluster-info --context kind-${{ env.CLUSTER_NAME }}
6086 echo "✅ kind cluster '${{ env.CLUSTER_NAME }}' is ready"
6187
6288 # ── 5. Install CRD ───────────────────────────────────────────────────────
6389 - name : Install StellarNode CRD
90+ if : steps.scope.outputs.run == 'true'
6491 run : |
6592 kubectl apply -f config/crd/stellarnode-crd.yaml
6693 kubectl wait --for condition=established --timeout=30s \
6794 crd/stellarnodes.stellar.org || true
6895
6996 # ── 6. Run operator and verify log line (AC #2 + AC #3) ─────────────────
7097 - name : Run operator and verify cluster connection
98+ if : steps.scope.outputs.run == 'true'
7199 run : |
72100 # Run the operator in the background, capture output
73101 ./target/release/stellar-operator run \
@@ -107,7 +135,7 @@ jobs:
107135
108136 # ── 7. Report any runtime errors ────────────────────────────────────────
109137 - name : Report runtime errors
110- if : always()
138+ if : always() && steps.scope.outputs.run == 'true'
111139 run : |
112140 echo "--- Runtime error check ---"
113141 if grep -iE "error|panic|missing env" /tmp/operator.log 2>/dev/null; then
@@ -118,7 +146,7 @@ jobs:
118146
119147 # ── 8. Upload log as artifact ────────────────────────────────────────────
120148 - name : Upload operator log
121- if : always()
149+ if : always() && steps.scope.outputs.run == 'true'
122150 uses : actions/upload-artifact@v4
123151 with :
124152 name : operator-boot-log
@@ -127,5 +155,10 @@ jobs:
127155
128156 # ── 9. Cleanup ───────────────────────────────────────────────────────────
129157 - name : Delete kind cluster
130- if : always()
158+ if : always() && steps.scope.outputs.run == 'true'
131159 run : kind delete cluster --name ${{ env.CLUSTER_NAME }} || true
160+
161+ - name : Skip message
162+ if : steps.scope.outputs.run != 'true'
163+ run : |
164+ echo "Skipping verify-operator-boot: no operator/runtime files changed."
0 commit comments