mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 02:07:55 +00:00
7f81f37e0c
Pre-eliminary support for LLVM releases and resolc binary releases by streamlining the build process for all supported hosts platforms. - Introduce the revive-llvm-builder crate with the revive-llvm builder utilty. - Do not rely on the LLVM dependency in $PATH to decouple the system LLVM installation from the LLVM host dependency. - Fix the emscripten build by decoupling the host and native LLVM dependencies. Thus allowing a single LLVM emscripten release that can be used on any host platform. - An example Dockerfile building an alpine container with a fully statically linked resolc ELF binary. - Remove the Debian builder utilities and workflow.
127 lines
3.8 KiB
YAML
127 lines
3.8 KiB
YAML
name: Build revive-wasm
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
pull_request:
|
|
branches: ["main"]
|
|
workflow_dispatch:
|
|
|
|
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
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Cache LLVM build
|
|
id: cache-llvm
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
target-llvm
|
|
# 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') }}
|
|
|
|
- name: Install 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
|
|
make install-llvm-builder
|
|
revive-llvm --target-env emscripten clone
|
|
|
|
- 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
|
|
cargo --version
|
|
rustup +nightly show
|
|
cargo +nightly --version
|
|
cmake --version
|
|
bash --version
|
|
|
|
- name: Use Cached LLVM
|
|
if: steps.cache-llvm.outputs.cache-hit == 'true'
|
|
run: |
|
|
echo "Using cached LLVM"
|
|
|
|
- name: Build revive
|
|
run: |
|
|
source emsdk/emsdk_env.sh
|
|
make install-wasm
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: revive-wasm
|
|
path: |
|
|
${{ env.REVIVE_WASM_INSTALL_DIR }}/resolc.js
|
|
${{ env.REVIVE_WASM_INSTALL_DIR }}/resolc.wasm
|
|
retention-days: 1
|
|
|
|
test-revive-wasm:
|
|
needs: build-revive-wasm
|
|
strategy:
|
|
matrix:
|
|
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Create Target Directory
|
|
run: mkdir -p ${{ env.REVIVE_WASM_INSTALL_DIR }}
|
|
|
|
- name: Download Artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: revive-wasm
|
|
path: ${{ env.REVIVE_WASM_INSTALL_DIR }}
|
|
|
|
- name: Set Up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Install Bun on Windows
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
|
|
scoop install bun@${{ env.BUN_VERSION }}
|
|
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
|
|
|
|
- name: Install Bun on macOS and Linux
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
curl -fsSL https://bun.sh/install | bash -s bun-v${{ env.BUN_VERSION }}
|
|
echo "$HOME/.bun/bin" >> $GITHUB_PATH
|
|
|
|
- name: Confirm Installations
|
|
run: |
|
|
node --version
|
|
bun --version
|
|
|
|
- name: Test revive
|
|
run: |
|
|
echo "Running tests for ${{ matrix.os }}"
|
|
npm install
|
|
npm run test:wasm
|