Skip to content

Commit 31ed920

Browse files
committed
ci(alloy): pull/push ghcr cache for checks
1 parent 7a2fee3 commit 31ed920

2 files changed

Lines changed: 44 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,20 @@ jobs:
138138
with:
139139
lfs: true
140140

141+
- name: Login to GitHub Container Registry
142+
uses: docker/login-action@v3
143+
with:
144+
registry: ghcr.io
145+
username: ${{ github.actor }}
146+
password: ${{ secrets.GITHUB_TOKEN }}
147+
148+
- name: Pre-pull Alloy image cache
149+
run: |
150+
docker pull ghcr.io/graphistry/alloy6:6.2.0 || true
151+
141152
- name: Run Alloy checks (full scopes)
142153
run: |
143-
FULL=1 bash alloy/check_fbf_where.sh
154+
ALLOY_PUSH=1 FULL=1 bash alloy/check_fbf_where.sh
144155
145156
test-minimal-python:
146157
needs: [changes, python-lint-types]

alloy/check_fbf_where.sh

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,41 @@ set -euo pipefail
33

44
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
ALS="/work/gfql_fbf_where.als"
6-
IMAGE="local/alloy6:latest"
6+
IMAGE="${ALLOY_IMAGE:-ghcr.io/graphistry/alloy6:6.2.0}"
7+
LOCAL_FALLBACK_IMAGE="${ALLOY_FALLBACK_IMAGE:-local/alloy6:latest}"
78
FULL=${FULL:-0}
89
MULTI=${MULTI:-0}
10+
PUSH=${ALLOY_PUSH:-0}
911

10-
# Build image if missing
11-
if ! docker image inspect "$IMAGE" >/dev/null 2>&1; then
12-
docker build -t "$IMAGE" "$HERE"
13-
fi
12+
# Resolve image: pull ghcr if possible, otherwise build local; optionally push built image to ghcr for caching
13+
resolve_image() {
14+
local img="$IMAGE"
15+
if docker image inspect "$img" >/dev/null 2>&1; then
16+
IMAGE="$img"
17+
return
18+
fi
19+
20+
if docker pull "$img" >/dev/null 2>&1; then
21+
IMAGE="$img"
22+
return
23+
fi
24+
25+
# Fall back to local build
26+
if ! docker image inspect "$LOCAL_FALLBACK_IMAGE" >/dev/null 2>&1; then
27+
docker build -t "$LOCAL_FALLBACK_IMAGE" "$HERE"
28+
fi
29+
30+
# Optionally publish to ghcr for future pulls
31+
if [ "$PUSH" = "1" ]; then
32+
docker tag "$LOCAL_FALLBACK_IMAGE" "$img"
33+
docker push "$img" || true
34+
IMAGE="$img"
35+
else
36+
IMAGE="$LOCAL_FALLBACK_IMAGE"
37+
fi
38+
}
39+
40+
resolve_image
1441

1542
if [ "$FULL" = "1" ]; then
1643
docker run --rm -v "$HERE":/work "$IMAGE" exec -c SpecNoWhereEqAlgoNoWhere -o - "$ALS"

0 commit comments

Comments
 (0)