Skip to content

Commit 99de604

Browse files
pRizzclaude
andcommitted
ci: add Docker layer caching to context guard and timeouts to all jobs
Add GHA + registry cache to docker-context-guard so unchanged layers are reused across CI runs (~3 min → ~30s on cache hit). Previously this ran a bare `docker build` with no caching at all. Add timeout-minutes to all 9 CI jobs to prevent runaway jobs from burning runner minutes at GitHub's default 6-hour timeout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 710f1d6 commit 99de604

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
format:
2121
name: Format Check
2222
runs-on: ubuntu-latest
23+
timeout-minutes: 5
2324
steps:
2425
- uses: actions/checkout@v6
2526

@@ -35,6 +36,7 @@ jobs:
3536
bun-ecosystem:
3637
name: Bun Ecosystem Checks
3738
runs-on: ubuntu-latest
39+
timeout-minutes: 5
3840
steps:
3941
- uses: actions/checkout@v6
4042

@@ -64,6 +66,7 @@ jobs:
6466
marketplace-validate:
6567
name: Marketplace Packer Validate
6668
runs-on: ubuntu-latest
69+
timeout-minutes: 5
6770
steps:
6871
- uses: actions/checkout@v6
6972

@@ -89,6 +92,7 @@ jobs:
8992
compose-validate:
9093
name: Compose File Validate
9194
runs-on: ubuntu-latest
95+
timeout-minutes: 5
9296
steps:
9397
- uses: actions/checkout@v6
9498

@@ -98,20 +102,34 @@ jobs:
98102
docker-context-guard:
99103
name: Docker Context Guard
100104
runs-on: ubuntu-latest
105+
timeout-minutes: 15
101106
steps:
102107
- uses: actions/checkout@v6
103108

109+
- name: Set up Docker Buildx
110+
uses: docker/setup-buildx-action@v3
111+
112+
# Use docker/build-push-action with GHA + registry cache so unchanged
113+
# layers are reused across CI runs (~3 min → ~30s on cache hit).
114+
# Previously this ran a bare `docker build` with no caching at all.
104115
- name: Build Docker target stage
105-
run: |
106-
DOCKER_BUILDKIT=1 docker build \
107-
--file packages/core/src/docker/Dockerfile \
108-
--target opencode-build \
109-
--tag opencode-cloud-sandbox:ci-check \
110-
.
116+
uses: docker/build-push-action@v6
117+
with:
118+
context: .
119+
file: packages/core/src/docker/Dockerfile
120+
target: opencode-build
121+
push: false
122+
load: false
123+
cache-from: |
124+
type=gha,scope=opencode-cloud-sandbox-context-guard,version=2
125+
type=gha,scope=opencode-cloud-sandbox-amd64,version=2
126+
type=registry,ref=ghcr.io/prizz/opencode-cloud-sandbox:buildcache-amd64
127+
cache-to: type=gha,scope=opencode-cloud-sandbox-context-guard,mode=min,version=2
111128

112129
cargo-package-verify:
113130
name: Cargo Package Verify
114131
runs-on: ubuntu-latest
132+
timeout-minutes: 15
115133
steps:
116134
- uses: actions/checkout@v6
117135

@@ -197,6 +215,7 @@ jobs:
197215
build:
198216
name: Build (${{ matrix.os }})
199217
runs-on: ${{ matrix.os }}
218+
timeout-minutes: 20
200219
strategy:
201220
fail-fast: false
202221
matrix:
@@ -266,6 +285,7 @@ jobs:
266285
cli-parity:
267286
name: CLI Parity Tests
268287
runs-on: ubuntu-latest
288+
timeout-minutes: 5
269289
needs: [build]
270290
steps:
271291
- uses: actions/checkout@v6
@@ -309,6 +329,7 @@ jobs:
309329
e2e:
310330
name: E2E Tests
311331
runs-on: ubuntu-latest
332+
timeout-minutes: 30
312333
needs: [build]
313334
steps:
314335
- uses: actions/checkout@v6

0 commit comments

Comments
 (0)