-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from smiasojed/resolc.js
Add compilation to NodeJS module
- Loading branch information
Showing
29 changed files
with
1,319 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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 }}/js/dist/revive-cjs | ||
EMSCRIPTEN_VERSION: 3.1.64 | ||
|
||
jobs: | ||
build-revive-wasm: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Cache LLVM build | ||
id: cache-llvm | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
llvm18.0-emscripten | ||
# Use a unique key based on LLVM version or configuration files to avoid cache invalidation | ||
key: llvm-build-${{ runner.os }}-${{ hashFiles('clone-llvm.sh', 'emscripten-build-llvm.sh') }} | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y cmake ninja-build libncurses5 | ||
rustup target add wasm32-unknown-emscripten | ||
# Install LLVM required for the compiler runtime, runtime-api and stdlib | ||
curl -sSL --output llvm.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.4/clang+llvm-18.1.4-x86_64-linux-gnu-ubuntu-18.04.tar.xz | ||
tar Jxf llvm.tar.xz | ||
mv clang+llvm-18.1.4-x86_64-linux-gnu-ubuntu-18.04 llvm18/ | ||
echo "$(pwd)/llvm18/bin" >> $GITHUB_PATH | ||
# Install Emscripten | ||
git clone https://github.com/emscripten-core/emsdk.git | ||
cd emsdk | ||
./emsdk install ${{ env.EMSCRIPTEN_VERSION }} | ||
./emsdk activate ${{ env.EMSCRIPTEN_VERSION }} | ||
- run: | | ||
rustup show | ||
cargo --version | ||
rustup +nightly show | ||
cargo +nightly --version | ||
cmake --version | ||
bash --version | ||
llvm-config --version | ||
- name: Build LLVM | ||
if: steps.cache-llvm.outputs.cache-hit != 'true' | ||
run: | | ||
export EMSDK_ROOT=${PWD}/emsdk | ||
./emscripten-build-llvm.sh | ||
- name: Use Cached LLVM | ||
if: steps.cache-llvm.outputs.cache-hit == 'true' | ||
run: | | ||
echo "Using cached LLVM" | ||
- name: Build revive | ||
run: | | ||
export LLVM_LINK_PREFIX=${PWD}/llvm18.0-emscripten | ||
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 }}/worker.js | ||
${{ env.REVIVE_WASM_INSTALL_DIR }}/resolc.wasm | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.