Skip to content

Commit 0f62908

Browse files
committed
adding kache support
1 parent 7360888 commit 0f62908

2 files changed

Lines changed: 88 additions & 116 deletions

File tree

.github/workflows/_checks-playwright.yaml

Lines changed: 49 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,22 @@ on:
6464
description: "Timeout in minutes for the job"
6565
type: number
6666
default: 30
67-
use_sccache:
68-
description: "Enable sccache for Rust compilation caching"
67+
use_rust_cache:
68+
description: "Enable kache for Rust compilation caching"
6969
type: boolean
7070
default: false
71-
sccache_bucket:
72-
description: "S3-compatible bucket name for sccache (e.g., Cloudflare R2)"
71+
cache_bucket:
72+
description: "S3-compatible bucket name for cache (e.g., Cloudflare R2)"
7373
type: string
7474
default: ""
75-
sccache_endpoint:
76-
description: "S3-compatible endpoint URL for sccache"
75+
cache_endpoint:
76+
description: "S3-compatible endpoint URL for cache"
7777
type: string
7878
default: ""
79-
sccache_region:
80-
description: "S3 region for sccache"
79+
cache_region:
80+
description: "S3 region for cache"
8181
type: string
8282
default: "auto"
83-
sccache_use_ssl:
84-
description: "Use SSL/TLS for sccache S3 connection (set true for HTTPS endpoints)"
85-
type: boolean
86-
default: true
8783
system_deps_command:
8884
description: "Command to install system dependencies (e.g., 'apt-get update && apt-get install -y ...')"
8985
type: string
@@ -148,11 +144,11 @@ on:
148144
app_pem:
149145
description: "GitHub App PEM"
150146
required: false
151-
sccache_access_key_id:
152-
description: "AWS/S3 access key ID for sccache backend"
147+
cache_access_key_id:
148+
description: "AWS/S3 access key ID for cache backend"
153149
required: false
154-
sccache_secret_access_key:
155-
description: "AWS/S3 secret access key for sccache backend"
150+
cache_secret_access_key:
151+
description: "AWS/S3 secret access key for cache backend"
156152
required: false
157153

158154
jobs:
@@ -209,14 +205,9 @@ jobs:
209205
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
210206
HEAD_BRANCH_NAME: ${{ github.head_ref }}
211207

212-
# sccache S3-compatible backend configuration (only if enabled)
213-
SCCACHE_BUCKET: ${{ inputs.use_sccache && inputs.sccache_bucket || '' }}
214-
SCCACHE_ENDPOINT: ${{ inputs.use_sccache && inputs.sccache_endpoint || '' }}
215-
SCCACHE_REGION: ${{ inputs.use_sccache && inputs.sccache_region || 'auto' }}
216-
SCCACHE_S3_USE_SSL: ${{ inputs.use_sccache && inputs.sccache_use_ssl && 'true' || 'false' }}
217-
SCCACHE_CACHE_SIZE: 100G
218-
AWS_ACCESS_KEY_ID: ${{ inputs.use_sccache && secrets.sccache_access_key_id || '' }}
219-
AWS_SECRET_ACCESS_KEY: ${{ inputs.use_sccache && secrets.sccache_secret_access_key || '' }}
208+
# S3 credentials for runs-on/cache steps
209+
AWS_ACCESS_KEY_ID: ${{ inputs.cache_bucket != '' && secrets.cache_access_key_id || '' }}
210+
AWS_SECRET_ACCESS_KEY: ${{ inputs.cache_bucket != '' && secrets.cache_secret_access_key || '' }}
220211
permissions:
221212
contents: read
222213
id-token: write # Required for Workload Identity Federation
@@ -296,15 +287,15 @@ jobs:
296287
echo "Created .env.local file with $(grep -c "=" .env.local) environment variables"
297288
298289
- name: Cache Cargo registry
299-
if: inputs.use_sccache && inputs.sccache_bucket != '' && steps.cache-control.outputs.enabled != 'false'
290+
if: inputs.use_rust_cache && inputs.cache_bucket != '' && steps.cache-control.outputs.enabled != 'false'
300291
uses: runs-on/cache@v4
301292
env:
302-
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.sccache_bucket }}
293+
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.cache_bucket }}
303294
RUNS_ON_S3_FORCE_PATH_STYLE: "true"
304-
AWS_ACCESS_KEY_ID: ${{ secrets.sccache_access_key_id }}
305-
AWS_SECRET_ACCESS_KEY: ${{ secrets.sccache_secret_access_key }}
306-
AWS_ENDPOINT_URL: ${{ inputs.sccache_endpoint }}
307-
AWS_REGION: ${{ inputs.sccache_region }}
295+
AWS_ACCESS_KEY_ID: ${{ secrets.cache_access_key_id }}
296+
AWS_SECRET_ACCESS_KEY: ${{ secrets.cache_secret_access_key }}
297+
AWS_ENDPOINT_URL: ${{ inputs.cache_endpoint }}
298+
AWS_REGION: ${{ inputs.cache_region }}
308299
with:
309300
path: |
310301
~/.cargo/registry/index
@@ -317,15 +308,15 @@ jobs:
317308
${{ runner.os }}-cargo-
318309
319310
- name: Cache Next.js build
320-
if: inputs.enable_nextjs_cache && inputs.sccache_bucket != '' && steps.cache-control.outputs.enabled != 'false'
311+
if: inputs.enable_nextjs_cache && inputs.cache_bucket != '' && steps.cache-control.outputs.enabled != 'false'
321312
uses: runs-on/cache@v4
322313
env:
323-
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.sccache_bucket }}
314+
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.cache_bucket }}
324315
RUNS_ON_S3_FORCE_PATH_STYLE: "true"
325-
AWS_ACCESS_KEY_ID: ${{ secrets.sccache_access_key_id }}
326-
AWS_SECRET_ACCESS_KEY: ${{ secrets.sccache_secret_access_key }}
327-
AWS_ENDPOINT_URL: ${{ inputs.sccache_endpoint }}
328-
AWS_REGION: ${{ inputs.sccache_region }}
316+
AWS_ACCESS_KEY_ID: ${{ secrets.cache_access_key_id }}
317+
AWS_SECRET_ACCESS_KEY: ${{ secrets.cache_secret_access_key }}
318+
AWS_ENDPOINT_URL: ${{ inputs.cache_endpoint }}
319+
AWS_REGION: ${{ inputs.cache_region }}
329320
with:
330321
path: ${{ inputs.nextjs_cache_paths }}
331322
key: ${{ runner.os }}-nextjs-${{ github.sha }}
@@ -368,23 +359,23 @@ jobs:
368359
fi
369360
370361
- name: Get pnpm store directory
371-
if: inputs.sccache_bucket != '' && steps.pm.outputs.pm_name == 'pnpm'
362+
if: inputs.cache_bucket != '' && steps.pm.outputs.pm_name == 'pnpm'
372363
id: pnpm-cache
373364
working-directory: ${{ inputs.working_directory }}
374365
shell: bash
375366
run: |
376367
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
377368
378369
- name: Cache pnpm store
379-
if: inputs.sccache_bucket != '' && steps.pm.outputs.pm_name == 'pnpm' && steps.pnpm-cache.outputs.STORE_PATH != '' && steps.cache-control.outputs.enabled != 'false'
370+
if: inputs.cache_bucket != '' && steps.pm.outputs.pm_name == 'pnpm' && steps.pnpm-cache.outputs.STORE_PATH != '' && steps.cache-control.outputs.enabled != 'false'
380371
uses: runs-on/cache@v4
381372
env:
382-
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.sccache_bucket }}
373+
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.cache_bucket }}
383374
RUNS_ON_S3_FORCE_PATH_STYLE: "true"
384-
AWS_ACCESS_KEY_ID: ${{ secrets.sccache_access_key_id }}
385-
AWS_SECRET_ACCESS_KEY: ${{ secrets.sccache_secret_access_key }}
386-
AWS_ENDPOINT_URL: ${{ inputs.sccache_endpoint }}
387-
AWS_REGION: ${{ inputs.sccache_region }}
375+
AWS_ACCESS_KEY_ID: ${{ secrets.cache_access_key_id }}
376+
AWS_SECRET_ACCESS_KEY: ${{ secrets.cache_secret_access_key }}
377+
AWS_ENDPOINT_URL: ${{ inputs.cache_endpoint }}
378+
AWS_REGION: ${{ inputs.cache_region }}
388379
with:
389380
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
390381
key: ${{ runner.os }}-pnpm-${{ github.ref_name }}
@@ -394,15 +385,15 @@ jobs:
394385
${{ runner.os }}-pnpm-
395386
396387
- name: Cache Bun dependencies
397-
if: inputs.sccache_bucket != '' && steps.pm.outputs.pm_name == 'bun' && steps.cache-control.outputs.enabled != 'false'
388+
if: inputs.cache_bucket != '' && steps.pm.outputs.pm_name == 'bun' && steps.cache-control.outputs.enabled != 'false'
398389
uses: runs-on/cache@v4
399390
env:
400-
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.sccache_bucket }}
391+
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.cache_bucket }}
401392
RUNS_ON_S3_FORCE_PATH_STYLE: "true"
402-
AWS_ACCESS_KEY_ID: ${{ secrets.sccache_access_key_id }}
403-
AWS_SECRET_ACCESS_KEY: ${{ secrets.sccache_secret_access_key }}
404-
AWS_ENDPOINT_URL: ${{ inputs.sccache_endpoint }}
405-
AWS_REGION: ${{ inputs.sccache_region }}
393+
AWS_ACCESS_KEY_ID: ${{ secrets.cache_access_key_id }}
394+
AWS_SECRET_ACCESS_KEY: ${{ secrets.cache_secret_access_key }}
395+
AWS_ENDPOINT_URL: ${{ inputs.cache_endpoint }}
396+
AWS_REGION: ${{ inputs.cache_region }}
406397
with:
407398
path: ~/.bun/install/cache
408399
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lockb', 'bun.lock') }}
@@ -416,11 +407,15 @@ jobs:
416407
mise run ci_postinstall
417408
fi
418409
419-
- name: Setup sccache
420-
if: inputs.use_sccache
421-
uses: mozilla-actions/sccache-action@v0.0.9
410+
- name: Setup kache
411+
if: inputs.use_rust_cache
412+
uses: kunobi-ninja/kache-action@v1
422413
with:
423-
version: "v0.12.0"
414+
s3-bucket: ${{ inputs.cache_bucket }}
415+
s3-endpoint: ${{ inputs.cache_endpoint }}
416+
s3-region: ${{ inputs.cache_region }}
417+
s3-access-key-id: ${{ secrets.cache_access_key_id }}
418+
s3-secret-access-key: ${{ secrets.cache_secret_access_key }}
424419

425420
- name: Install system dependencies
426421
if: inputs.system_deps_command != ''
@@ -507,9 +502,7 @@ jobs:
507502
working-directory: ${{ inputs.working_directory }}
508503
env:
509504
KIND_EXPERIMENTAL_DOCKER_NETWORK: ${{ job.container.network }}
510-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
511-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
512-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
505+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
513506
# Pass project and grep filters via env vars for the test command to use
514507
PLAYWRIGHT_PROJECT: ${{ inputs.playwright_project }}
515508
PLAYWRIGHT_GREP: ${{ inputs.playwright_grep }}

.github/workflows/_checks-rs.yaml

Lines changed: 39 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ on:
128128
type: string
129129
default: "cargo audit"
130130
system_deps_command:
131-
description: "Command to install system dependencies (e.g., 'apt-get update && apt-get install -y sccache')"
131+
description: "Command to install system dependencies"
132132
required: false
133133
type: string
134134
default: ""
@@ -144,26 +144,22 @@ on:
144144
description: "Command to initialize environment (without package manager prefix)"
145145
type: string
146146
default: "env:init:ci"
147-
use_sccache:
148-
description: "Enable sccache for Rust compilation caching"
147+
use_rust_cache:
148+
description: "Enable Rust compilation caching via kache"
149149
type: boolean
150150
default: false
151-
sccache_bucket:
152-
description: "S3-compatible bucket name for sccache (e.g., Cloudflare R2)"
151+
cache_bucket:
152+
description: "S3-compatible bucket name for caching (e.g., Cloudflare R2)"
153153
type: string
154154
default: ""
155-
sccache_endpoint:
156-
description: "S3-compatible endpoint URL for sccache"
155+
cache_endpoint:
156+
description: "S3-compatible endpoint URL for caching"
157157
type: string
158158
default: ""
159-
sccache_region:
160-
description: "S3 region for sccache"
159+
cache_region:
160+
description: "S3 region for caching"
161161
type: string
162162
default: "auto"
163-
sccache_use_ssl:
164-
description: "Use SSL/TLS for sccache S3 connection (set true for HTTPS endpoints)"
165-
type: boolean
166-
default: true
167163
enable_integration_tests:
168164
description: "Enable integration tests (TypeScript client vs Rust server)"
169165
type: boolean
@@ -183,11 +179,11 @@ on:
183179
app_pem:
184180
description: "GitHub App PEM"
185181
required: false
186-
sccache_access_key_id:
187-
description: "AWS/S3 access key ID for sccache backend"
182+
cache_access_key_id:
183+
description: "AWS/S3 access key ID for cache backend"
188184
required: false
189-
sccache_secret_access_key:
190-
description: "AWS/S3 secret access key for sccache backend"
185+
cache_secret_access_key:
186+
description: "AWS/S3 secret access key for cache backend"
191187
required: false
192188

193189
permissions:
@@ -201,14 +197,9 @@ jobs:
201197
timeout-minutes: ${{ inputs.timeout_minutes }}
202198
environment: ${{ inputs.environment }}
203199
env:
204-
# sccache S3-compatible backend configuration (only if enabled)
205-
SCCACHE_BUCKET: ${{ inputs.use_sccache && inputs.sccache_bucket || '' }}
206-
SCCACHE_ENDPOINT: ${{ inputs.use_sccache && inputs.sccache_endpoint || '' }}
207-
SCCACHE_REGION: ${{ inputs.use_sccache && inputs.sccache_region || 'auto' }}
208-
SCCACHE_S3_USE_SSL: ${{ inputs.use_sccache && inputs.sccache_use_ssl && 'true' || 'false' }}
209-
SCCACHE_CACHE_SIZE: 100G
210-
AWS_ACCESS_KEY_ID: ${{ inputs.use_sccache && secrets.sccache_access_key_id || '' }}
211-
AWS_SECRET_ACCESS_KEY: ${{ inputs.use_sccache && secrets.sccache_secret_access_key || '' }}
200+
# S3 credentials for runs-on/cache steps (Cargo registry, pnpm store)
201+
AWS_ACCESS_KEY_ID: ${{ inputs.cache_bucket != '' && secrets.cache_access_key_id || '' }}
202+
AWS_SECRET_ACCESS_KEY: ${{ inputs.cache_bucket != '' && secrets.cache_secret_access_key || '' }}
212203
defaults:
213204
run:
214205
working-directory: ${{ inputs.package_path }}
@@ -263,15 +254,15 @@ jobs:
263254
project_id: ${{ vars.PULUMI_GCP_PROJECT_ID }}
264255

265256
- name: Cache Cargo registry
266-
if: inputs.sccache_bucket != '' && steps.cache-control.outputs.enabled != 'false'
257+
if: inputs.cache_bucket != '' && steps.cache-control.outputs.enabled != 'false'
267258
uses: runs-on/cache@v4
268259
env:
269-
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.sccache_bucket }}
260+
RUNS_ON_S3_BUCKET_CACHE: ${{ inputs.cache_bucket }}
270261
RUNS_ON_S3_FORCE_PATH_STYLE: "true"
271-
AWS_ACCESS_KEY_ID: ${{ secrets.sccache_access_key_id }}
272-
AWS_SECRET_ACCESS_KEY: ${{ secrets.sccache_secret_access_key }}
273-
AWS_ENDPOINT_URL: ${{ inputs.sccache_endpoint }}
274-
AWS_REGION: ${{ inputs.sccache_region }}
262+
AWS_ACCESS_KEY_ID: ${{ secrets.cache_access_key_id }}
263+
AWS_SECRET_ACCESS_KEY: ${{ secrets.cache_secret_access_key }}
264+
AWS_ENDPOINT_URL: ${{ inputs.cache_endpoint }}
265+
AWS_REGION: ${{ inputs.cache_region }}
275266
with:
276267
path: |
277268
~/.cargo/registry/index
@@ -326,14 +317,18 @@ jobs:
326317
working-directory: ${{ inputs.package_path }}
327318
run: ${{ steps.pm.outputs.pm }} ${{ inputs.env_init_command }}
328319

329-
- name: Setup sccache
330-
if: inputs.use_sccache
331-
uses: mozilla-actions/sccache-action@v0.0.9
320+
- name: Setup kache
321+
if: inputs.use_rust_cache
322+
uses: kunobi-ninja/kache-action@v1
332323
with:
333-
version: "v0.12.0"
324+
s3-bucket: ${{ inputs.cache_bucket }}
325+
s3-endpoint: ${{ inputs.cache_endpoint }}
326+
s3-region: ${{ inputs.cache_region }}
327+
s3-access-key-id: ${{ secrets.cache_access_key_id }}
328+
s3-secret-access-key: ${{ secrets.cache_secret_access_key }}
334329

335330
- name: Setup Rust cache
336-
if: inputs.cache_cargo && !inputs.use_sccache && steps.cache-control.outputs.enabled != 'false'
331+
if: inputs.cache_cargo && !inputs.use_rust_cache && steps.cache-control.outputs.enabled != 'false'
337332
uses: Swatinem/rust-cache@v2
338333
with:
339334
workspaces: ${{ inputs.package_path }}
@@ -363,42 +358,32 @@ jobs:
363358

364359
- name: Check formatting
365360
env:
366-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
367-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
368-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
361+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
369362
run: ${{ inputs.format_command }}
370363

371364
- name: Run clippy
372365
if: inputs.enable_linting
373366
env:
374-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
375-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
376-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
367+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
377368
RUSTFLAGS: "-D warnings"
378369
run: ${{ inputs.lint_command }}
379370

380371
- name: Run tests
381372
if: inputs.enable_tests && !inputs.enable_coverage
382373
env:
383-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
384-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
385-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
374+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
386375
run: ${{ inputs.test_command }} ${{ inputs.test_args }}
387376

388377
- name: Run tests with coverage
389378
if: inputs.enable_tests && inputs.enable_coverage
390379
env:
391-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
392-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
393-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
380+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
394381
run: ${{ inputs.coverage_command }} ${{ inputs.test_args }}
395382

396383
- name: Build integration test binaries
397384
if: inputs.enable_integration_tests && inputs.integration_build_command != ''
398385
env:
399-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
400-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
401-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
386+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
402387
run: ${{ inputs.integration_build_command }}
403388

404389
- name: Run integration tests
@@ -408,25 +393,19 @@ jobs:
408393
- name: Build
409394
if: inputs.enable_build
410395
env:
411-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
412-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
413-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
396+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
414397
run: ${{ inputs.build_command }}
415398

416399
- name: Security audit with cargo-audit
417400
if: inputs.enable_security_audit
418401
env:
419-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
420-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
421-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
402+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
422403
run: ${{ inputs.audit_command }}
423404

424405
- name: Security audit with cargo-deny
425406
if: inputs.enable_security_audit
426407
env:
427-
RUSTC_WRAPPER: ${{ inputs.use_sccache && 'sccache' || '' }}
428-
SCCACHE_GHA_ENABLED: ${{ inputs.use_sccache && 'true' || '' }}
429-
CARGO_INCREMENTAL: ${{ inputs.use_sccache && '0' || '' }}
408+
CARGO_INCREMENTAL: ${{ inputs.use_rust_cache && '0' || '' }}
430409
run: cargo deny check
431410

432411
- name: Quality Gate - Test coverage shall be above threshold

0 commit comments

Comments
 (0)