Fix the Wasm build cache (#159)

Follow-ups for https://github.com/paritytech/revive/pull/154
- Fix the cache in the Wasm build
- Remove a no longer needed script
- The Wasm build job uses parity-large
This commit is contained in:
Cyrill Leutwiler
2025-01-15 11:36:59 +01:00
committed by GitHub
parent 939138d0cd
commit 4fbfb97b9e
3 changed files with 26 additions and 33 deletions
-1
View File
@@ -1 +0,0 @@
1
+26 -14
View File
@@ -9,12 +9,11 @@ on:
env:
CARGO_TERM_COLOR: always
REVIVE_WASM_INSTALL_DIR: ${{ github.workspace }}/target/wasm32-unknown-emscripten/release
EMSCRIPTEN_VERSION: 3.1.64
BUN_VERSION: 1.1.43
jobs:
build-revive-wasm:
runs-on: ubuntu-24.04
runs-on: parity-large
defaults:
run:
shell: bash
@@ -26,30 +25,43 @@ jobs:
uses: actions/cache@v3
with:
path: |
target-llvm
target-llvm/emscripten/target-final
target-llvm/gnu/target-final
# Use a unique key based on LLVM version or configuration files to avoid cache invalidation
key: llvm-build-${{ runner.os }}-${{ hashFiles('LLVM.lock', '.github/trigger-wasm-llvm-build') }}
key: llvm-build-${{ runner.os }}-${{ hashFiles('LLVM.lock', 'Cargo.toml', 'Cargo.lock', 'crates/llvm-builder/**', '.github/workflows/build-revive-wasm.yml') }}
- name: Install Dependencies
- name: Install system dependencies
run: |
# system dependencies
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld
rustup target add wasm32-unknown-emscripten
# host LLVM
curl -sSL --output llvm.tar.xz https://github.com/paritytech/revive/releases/download/v0.1.0-dev.7/clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-24.04.tar.xz
mkdir llvm18
tar Jxf llvm.tar.xz -C llvm18/
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm18" >> $GITHUB_ENV
# Clone LLVM and install the Emscripten SDK
- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rust-src
target: wasm32-unknown-emscripten
- name: Install LLVM build dependencies
run: |
make install-llvm-builder
revive-llvm --target-env emscripten clone
- name: Setup revive environment variables
run: |
echo "LLVM_SYS_181_PREFIX=$(pwd)/target-llvm/gnu/target-final" >> $GITHUB_ENV
echo "REVIVE_LLVM_TARGET_PREFIX=$(pwd)/target-llvm/emscripten/target-final" >> $GITHUB_ENV
- name: Build host LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
revive-llvm build
- name: Build target LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
source emsdk/emsdk_env.sh
revive-llvm --target-env emscripten build
echo "REVIVE_LLVM_TARGET_PREFIX=${PWD}/target-llvm/emscripten/target-final" >> $GITHUB_ENV
- run: |
rustup show
-18
View File
@@ -1,18 +0,0 @@
#!/bin/bash
set -euo pipefail
# Default directory for cloning the llvm-project repository
DEFAULT_DIR="llvm-project"
# Check if a directory argument is provided
if [ $# -eq 1 ]; then
DIR=$1
else
DIR=$DEFAULT_DIR
fi
# Clone LLVM 18 (any revision after commit bd32aaa is supposed to work)
if [ ! -d "${DIR}" ]; then
git clone --depth 1 --branch release/18.x https://github.com/llvm/llvm-project.git "${DIR}"
fi