Skip to content

Commit 7a72f40

Browse files
authored
[mlir-python-bindings-wasm] fix ccache in GHA (#254)
1 parent b78aab4 commit 7a72f40

File tree

1 file changed

+36
-15
lines changed

1 file changed

+36
-15
lines changed

.github/workflows/build_mlir_python_bindings_wheel.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -407,29 +407,57 @@ jobs:
407407
echo "WHEEL_VERSION=${DATETIME}+${LLVM_PROJECT_COMMIT}" >> $GITHUB_ENV
408408
409409
- name: Setup Emscripten
410-
uses: mymindstorm/setup-emsdk@v14
411-
with:
412-
version: ${{ env.EMSCRIPTEN_VERSION }}
410+
run: |
411+
412+
git clone https://github.com/emscripten-core/emsdk.git
413+
pushd emsdk
414+
./emsdk install ${{ env.EMSCRIPTEN_VERSION }}
415+
./emsdk activate ${{ env.EMSCRIPTEN_VERSION }}
416+
echo "EMSDK=$PWD" >> $GITHUB_ENV
417+
popd
413418
414419
- name: Setup ccache
415420
run: |
416421
422+
source "$EMSDK/emsdk_env.sh"
423+
424+
$CMAKE_C_COMPILER_LAUNCHER -z
417425
# https://github.com/juj/ccache/blob/c4284c78e9ff286ee5208f449af4c2aaba062d37/cmake/StandardWarnings.cmake#L5
418426
# https://github.com/juj/ccache/blob/c4284c78e9ff286ee5208f449af4c2aaba062d37/CMakeLists.txt#L61
419427
# error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
420-
CCACHE_COMPILERCHECK="$(g++ --version | head -n 1)" CC=gcc CXX=g++ emsdk install ccache-git-emscripten-64bit
428+
VERBOSE=1 CCACHE_COMPILERCHECK="string:$(g++ --version | head -n 1)" CC=gcc CXX=g++ emsdk install ccache-git-emscripten-64bit
429+
$CMAKE_C_COMPILER_LAUNCHER -s
421430
emsdk activate ccache-git-emscripten-64bit
422431
423432
echo "PATH=$EMSDK/ccache/git-emscripten_64bit/bin:$PATH" >> $GITHUB_ENV
424-
echo "CCACHE_COMPILERCHECK=$($EMSDK/upstream/bin/clang --version | head -n 1)" >> $GITHUB_ENV
425-
echo "LLVM_CCACHE_BUILD=ON" >> $GITHUB_ENV
426-
echo "CMAKE_C_COMPILER_LAUNCHER=$EMSDK/ccache/git-emscripten_64bit/bin/ccache" >> $GITHUB_ENV
427-
echo "CMAKE_CXX_COMPILER_LAUNCHER=$EMSDK/ccache/git-emscripten_64bit/bin/ccache" >> $GITHUB_ENV
433+
export CCACHE_COMPILERCHECK="string:$($EMSDK/upstream/bin/clang --version | head -n 1)"
434+
echo "CCACHE_COMPILERCHECK=$CCACHE_COMPILERCHECK" >> $GITHUB_ENV
435+
export CCACHE="$EMSDK/ccache/git-emscripten_64bit/bin/ccache"
436+
echo "CMAKE_C_COMPILER_LAUNCHER=$CCACHE" >> $GITHUB_ENV
437+
echo "CMAKE_CXX_COMPILER_LAUNCHER=$CCACHE" >> $GITHUB_ENV
438+
$CCACHE -p
439+
$CCACHE -s
428440
429441
- name: build wasm python wheel
430442
run: |
431443
444+
source "$EMSDK/emsdk_env.sh"
445+
$CMAKE_C_COMPILER_LAUNCHER -z
432446
pyodide build projects/mlir-python-bindings-wasm -o wheelhouse --compression-level 10
447+
$CMAKE_C_COMPILER_LAUNCHER -s
448+
449+
- name: Upload ccache log
450+
uses: actions/upload-artifact@v4
451+
with:
452+
name: llvm_ccache_log_wasm32
453+
path: '/tmp/ccache.log'
454+
455+
- name: "Save cache"
456+
uses: actions/cache/save@v3
457+
if: (!cancelled() && github.event_name == 'push' && github.ref_name == 'main')
458+
with:
459+
path: ${{ steps.setup_base.outputs.cache-dir }}
460+
key: ${{ env.cache-key }}
433461

434462
- name: Install pyodide and test
435463
shell: bash
@@ -456,13 +484,6 @@ jobs:
456484
path: wheelhouse/*.whl
457485
name: build_artifact_python_bindings-ubuntu-wasm
458486

459-
- name: "Save cache"
460-
uses: actions/cache/save@v3
461-
if: (!cancelled() && github.event_name == 'push' && github.ref_name == 'main')
462-
with:
463-
path: ${{ steps.setup_base.outputs.cache-dir }}
464-
key: ${{ env.cache-key }}
465-
466487
- name: Release current commit
467488
if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
468489
uses: ncipollo/[email protected]

0 commit comments

Comments
 (0)