Skip to content

Commit 8cf2225

Browse files
committed
Enable ccache on Windows CI
This PR adds support for ccache to Windows builds on CI and enables caches save/load. The ccache usage logic is the same as with Linux/Mac added in duckdb#471.
1 parent 2b52340 commit 8cf2225

File tree

1 file changed

+73
-10
lines changed

1 file changed

+73
-10
lines changed

.github/workflows/Java.yml

Lines changed: 73 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -422,27 +422,47 @@ jobs:
422422

423423
java-windows-amd64:
424424
name: Windows (amd64)
425-
if: ${{ false }}
426425
runs-on: windows-latest
427426
needs: java-linux-amd64
427+
env:
428+
CC: 'ccache cl'
429+
CXX: 'ccache cl'
430+
CCACHE_DIR: ${{ github.workspace }}/ccache
428431
steps:
429432
- uses: actions/checkout@v4
430433
with:
431434
fetch-depth: 0
432435
ref: ${{ inputs.git_ref }}
433436

434-
- uses: actions/setup-python@v5
437+
- name: Cache Key
438+
id: cache_key
439+
shell: bash
440+
run: |
441+
DUCKDB_VERSION=$(python ./scripts/print_duckdb_version.py)
442+
KEY="${{ runner.os }}-${{ runner.arch }}-$DUCKDB_VERSION"
443+
echo "value=${KEY}" >> "${GITHUB_OUTPUT}"
444+
445+
- name: Restore Cache
446+
uses: actions/cache/restore@v4
435447
with:
436-
python-version: "3.12"
448+
path: ${{ github.workspace }}/ccache
449+
key: ${{ steps.cache_key.outputs.value }}
437450

438451
- name: Build
439-
shell: bash
440-
run: make release
452+
shell: cmd
453+
run: |
454+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
455+
mkdir build
456+
cd build
457+
mkdir release
458+
cd release
459+
cmake ../.. -G Ninja -DCMAKE_BUILD_TYPE=Release
460+
cmake --build . --config Release
441461
442462
- name: List Symbols
443463
shell: cmd
444464
run: |
445-
call "c:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
465+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
446466
dumpbin.exe /exports build\release\Release\libduckdb_java.so_windows_amd64
447467
448468
- name: Java Tests
@@ -464,11 +484,20 @@ jobs:
464484
path: |
465485
build/release/duckdb_jdbc.jar
466486
487+
- name: Save Cache
488+
uses: actions/cache/save@v4
489+
with:
490+
path: ${{ github.workspace }}/ccache
491+
key: ${{ steps.cache_key.outputs.value }}
492+
467493
java-windows-aarch64:
468494
name: Windows (aarch64)
469-
if: ${{ false }}
470495
runs-on: windows-11-arm
471496
needs: java-linux-amd64
497+
env:
498+
CC: 'ccache cl'
499+
CXX: 'ccache cl'
500+
CCACHE_DIR: ${{ github.workspace }}/ccache
472501
steps:
473502
- uses: actions/checkout@v4
474503
with:
@@ -479,14 +508,42 @@ jobs:
479508
with:
480509
python-version: "3.12"
481510

482-
- name: Build
511+
- name: Dependencies
483512
shell: bash
484-
run: make release
513+
run: |
514+
choco install \
515+
ccache \
516+
-y --force --no-progress
517+
518+
- name: Cache Key
519+
id: cache_key
520+
shell: bash
521+
run: |
522+
DUCKDB_VERSION=$(python ./scripts/print_duckdb_version.py)
523+
KEY="${{ runner.os }}-${{ runner.arch }}-$DUCKDB_VERSION"
524+
echo "value=${KEY}" >> "${GITHUB_OUTPUT}"
525+
526+
- name: Restore Cache
527+
uses: actions/cache/restore@v4
528+
with:
529+
path: ${{ github.workspace }}/ccache
530+
key: ${{ steps.cache_key.outputs.value }}
531+
532+
- name: Build
533+
shell: cmd
534+
run: |
535+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat"
536+
mkdir build
537+
cd build
538+
mkdir release
539+
cd release
540+
cmake ../.. -G Ninja -DCMAKE_BUILD_TYPE=Release
541+
cmake --build . --config Release
485542
486543
- name: List Symbols
487544
shell: cmd
488545
run: |
489-
call "c:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat"
546+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat"
490547
dumpbin.exe /exports build\release\Release\libduckdb_java.so_windows_arm64
491548
492549
# Test runs are failing because windows_arm64 extensions are missing
@@ -509,6 +566,12 @@ jobs:
509566
path: |
510567
build/release/duckdb_jdbc.jar
511568
569+
- name: Save Cache
570+
uses: actions/cache/save@v4
571+
with:
572+
path: ${{ github.workspace }}/ccache
573+
key: ${{ steps.cache_key.outputs.value }}
574+
512575
java-osx-universal:
513576
name: macOS (Universal)
514577
runs-on: macos-14

0 commit comments

Comments
 (0)