182 lines
7.2 KiB
YAML
182 lines
7.2 KiB
YAML
|
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||
|
name: build wamr lldb
|
||
|
|
||
|
on:
|
||
|
workflow_call:
|
||
|
inputs:
|
||
|
arch:
|
||
|
description: arch of the release
|
||
|
type: string
|
||
|
required: false
|
||
|
default: x86_64
|
||
|
runner:
|
||
|
description: OS of compilation
|
||
|
type: string
|
||
|
required: true
|
||
|
upload_url:
|
||
|
description: upload binary assets to the URL of release
|
||
|
type: string
|
||
|
required: true
|
||
|
ver_num:
|
||
|
description: a semantic version number
|
||
|
type: string
|
||
|
required: true
|
||
|
|
||
|
jobs:
|
||
|
try_reuse:
|
||
|
uses: ./.github/workflows/reuse_latest_release_binaries.yml
|
||
|
with:
|
||
|
binary_name_stem: "wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}"
|
||
|
last_commit: "ea63ba4bd010c2285623ad4acc0262a4d63bcfea"
|
||
|
the_path: "./build-scripts/lldb-wasm.patch"
|
||
|
upload_url: ${{ inputs.upload_url }}
|
||
|
|
||
|
build:
|
||
|
needs: try_reuse
|
||
|
if: needs.try_reuse.outputs.result != 'hit'
|
||
|
runs-on: ${{ inputs.runner }}
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
|
||
|
- name: Cache build
|
||
|
id: lldb_build_cache
|
||
|
uses: actions/cache@v3
|
||
|
with:
|
||
|
path: |
|
||
|
./core/deps/llvm-project/build/bin
|
||
|
./core/deps/llvm-project/build/include
|
||
|
./core/deps/llvm-project/build/lib
|
||
|
./core/deps/llvm-project/build/libexec
|
||
|
./core/deps/llvm-project/build/share
|
||
|
./core/deps/llvm-project/lldb/tools/
|
||
|
./core/deps/llvm-project/inst/
|
||
|
key: ${{inputs.arch}}-${{ inputs.runner }}-lldb_build
|
||
|
|
||
|
- name: setup xcode macos
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||
|
uses: maxim-lobanov/setup-xcode@v1
|
||
|
with:
|
||
|
xcode-version: latest-stable
|
||
|
|
||
|
# Remove xCode command line tools, to prevent duplicate symbol compilation failures
|
||
|
- name: install utils macos
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||
|
run: |
|
||
|
brew install swig cmake ninja libedit
|
||
|
sudo rm -rf /Library/Developer/CommandLineTools
|
||
|
|
||
|
- name: intsall utils ubuntu
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
|
||
|
run: sudo apt update && sudo apt-get install -y lld ninja-build
|
||
|
|
||
|
# `git clone` takes ~7m
|
||
|
- name: download llvm
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
|
||
|
run: |
|
||
|
wget https://github.com/llvm/llvm-project/archive/1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
|
||
|
unzip -q 1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
|
||
|
mv llvm-project-1f27fe6128769f00197925c3b8f6abb9d0e5cd2e llvm-project
|
||
|
working-directory: core/deps/
|
||
|
|
||
|
- name: apply wamr patch
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
|
||
|
run: |
|
||
|
git init
|
||
|
git config user.email "action@github.com"
|
||
|
git config user.name "github action"
|
||
|
git apply ../../../build-scripts/lldb-wasm.patch
|
||
|
working-directory: core/deps/llvm-project
|
||
|
|
||
|
- name: build lldb ubuntu
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
|
||
|
run: |
|
||
|
echo "start to build lldb..."
|
||
|
mkdir -p inst
|
||
|
cmake -S ./llvm -B build \
|
||
|
-G Ninja \
|
||
|
-DCMAKE_INSTALL_PREFIX=../inst \
|
||
|
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" \
|
||
|
-DLLVM_TARGETS_TO_BUILD=X86 \
|
||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
|
||
|
-DLLVM_BUILD_DOCS:BOOL=OFF -DLLVM_BUILD_EXAMPLES:BOOL=OFF \
|
||
|
-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF -DLLVM_BUILD_TESTS:BOOL=OFF \
|
||
|
-DLLVM_ENABLE_BINDINGS:BOOL=OFF -DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF \
|
||
|
-DLLVM_INCLUDE_DOCS:BOOL=OFF -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
|
||
|
-DLLVM_INCLUDE_TESTS:BOOL=OFF -DLLVM_ENABLE_LLD:BOOL=ON
|
||
|
cmake --build build --target lldb install --parallel $(nproc)
|
||
|
working-directory: core/deps/llvm-project
|
||
|
|
||
|
- name: build lldb macos
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||
|
run: |
|
||
|
echo "start to build lldb..."
|
||
|
mkdir -p inst
|
||
|
cmake -S ./llvm -B build \
|
||
|
-G Ninja \
|
||
|
-DCMAKE_INSTALL_PREFIX=../inst \
|
||
|
-DCMAKE_BUILD_TYPE:STRING="Release" \
|
||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||
|
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
|
||
|
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
|
||
|
-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
|
||
|
-DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
|
||
|
-DLLVM_BUILD_DOCS:BOOL=OFF \
|
||
|
-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF \
|
||
|
-DLLVM_ENABLE_BINDINGS:BOOL=OFF \
|
||
|
-DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" \
|
||
|
-DLLVM_ENABLE_LIBXML2:BOOL=ON \
|
||
|
-DLLDB_ENABLE_PYTHON:BOOL=OFF \
|
||
|
-DLLDB_BUILD_FRAMEWORK:BOOL=OFF
|
||
|
cmake --build build --target lldb install --parallel $(nproc)
|
||
|
working-directory: core/deps/llvm-project
|
||
|
|
||
|
- name: pack a distribution
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
|
||
|
run: |
|
||
|
mkdir -p inst/bin
|
||
|
mkdir -p inst/lib
|
||
|
cp build/bin/lldb* inst/bin
|
||
|
cp lldb/tools/lldb-vscode/package.json inst
|
||
|
cp -r lldb/tools/lldb-vscode/syntaxes/ inst
|
||
|
working-directory: core/deps/llvm-project
|
||
|
|
||
|
- name: pack ubuntu specific libraries
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
|
||
|
run: |
|
||
|
cp build/lib/liblldb*.so inst/lib
|
||
|
cp build/lib/liblldb*.so.* inst/lib
|
||
|
working-directory: core/deps/llvm-project
|
||
|
|
||
|
- name: pack macos specific libraries
|
||
|
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||
|
run: |
|
||
|
cp build/lib/liblldb*.dylib inst/lib
|
||
|
working-directory: core/deps/llvm-project
|
||
|
|
||
|
- name: compress the binary
|
||
|
run: |
|
||
|
tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz inst
|
||
|
zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip inst
|
||
|
working-directory: core/deps/llvm-project
|
||
|
|
||
|
- name: upload release tar.gz
|
||
|
uses: actions/upload-release-asset@v1
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
with:
|
||
|
upload_url: ${{ inputs.upload_url }}
|
||
|
asset_path: core/deps/llvm-project/wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
|
||
|
asset_name: wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
|
||
|
asset_content_type: application/x-gzip
|
||
|
|
||
|
- name: upload release zip
|
||
|
uses: actions/upload-release-asset@v1
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
with:
|
||
|
upload_url: ${{ inputs.upload_url }}
|
||
|
asset_path: core/deps/llvm-project/wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||
|
asset_name: wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
|
||
|
asset_content_type: application/zip
|